Jamal Hadi Salim | d892afe | 2007-10-26 02:49:09 -0700 | [diff] [blame] | 1 | |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 2 | The "environmental" rules for authors of any new tc actions are: |
Jamal Hadi Salim | d892afe | 2007-10-26 02:49:09 -0700 | [diff] [blame] | 3 | |
| 4 | 1) If you stealeth or borroweth any packet thou shalt be branching |
| 5 | from the righteous path and thou shalt cloneth. |
| 6 | |
Matt LaPlante | d919588 | 2008-07-25 19:45:33 -0700 | [diff] [blame] | 7 | For example if your action queues a packet to be processed later, |
| 8 | or intentionally branches by redirecting a packet, then you need to |
Jamal Hadi Salim | d892afe | 2007-10-26 02:49:09 -0700 | [diff] [blame] | 9 | clone the packet. |
Matt LaPlante | d919588 | 2008-07-25 19:45:33 -0700 | [diff] [blame] | 10 | |
Jamal Hadi Salim | d892afe | 2007-10-26 02:49:09 -0700 | [diff] [blame] | 11 | 2) If you munge any packet thou shalt call pskb_expand_head in the case |
| 12 | someone else is referencing the skb. After that you "own" the skb. |
Jamal Hadi Salim | d892afe | 2007-10-26 02:49:09 -0700 | [diff] [blame] | 13 | |
Matt LaPlante | d919588 | 2008-07-25 19:45:33 -0700 | [diff] [blame] | 14 | 3) Dropping packets you don't own is a no-no. You simply return |
Jamal Hadi Salim | d892afe | 2007-10-26 02:49:09 -0700 | [diff] [blame] | 15 | TC_ACT_SHOT to the caller and they will drop it. |
| 16 | |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 17 | The "environmental" rules for callers of actions (qdiscs etc) are: |
Jamal Hadi Salim | d892afe | 2007-10-26 02:49:09 -0700 | [diff] [blame] | 18 | |
Matt LaPlante | d919588 | 2008-07-25 19:45:33 -0700 | [diff] [blame] | 19 | *) Thou art responsible for freeing anything returned as being |
Jamal Hadi Salim | d892afe | 2007-10-26 02:49:09 -0700 | [diff] [blame] | 20 | TC_ACT_SHOT/STOLEN/QUEUED. If none of TC_ACT_SHOT/STOLEN/QUEUED is |
Matt LaPlante | d919588 | 2008-07-25 19:45:33 -0700 | [diff] [blame] | 21 | returned, then all is great and you don't need to do anything. |
Jamal Hadi Salim | d892afe | 2007-10-26 02:49:09 -0700 | [diff] [blame] | 22 | |
| 23 | Post on netdev if something is unclear. |
| 24 | |