Commit f57a46d
sdarayan
click/etherswitch: Forward traffic to a set of ports
The default behavior of etherswitch is to forward traffic
to all ports except the source when broadcast or to the
destination port found in lookup of etherswitch's mac table.
This commit expands the functionality of etherswitch to
send packet(s) out port(s) iff the port to forward traffic
is enabled. Thus, etherswitch can selectively forward traffic
to particular ports, a feature proving useful with broadcast
traffic so as to avoid traffic loops between click and other
external hardware (e.g. switch).
Ports can selectively be removed and the port forwarding map
can be reset via write handlers "remove_port_forwarding" and
"reset_port_forwarding".
The arguments to "remove_port_forwarding" write handler is a
list of numbers with the first one being a source port and
the others being ports to remove.
For example, "1 2 3 4, 2 3 4" means port 1 will not forward
traffic to ports 2, 3, and 4 -- in addition port 2 will not
forward traffic to ports 3 and 4.
No arguments are necessary for "reset_port_forwarding" write
handler.
Also, the port forwarding map can be viewed via read handler
"port_forwarding".1 parent 23da763 commit f57a46d
2 files changed
+130
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
41 | | - | |
| 43 | + | |
42 | 44 | | |
43 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
44 | 53 | | |
45 | 54 | | |
46 | 55 | | |
47 | 56 | | |
48 | 57 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
55 | 65 | | |
56 | | - | |
| 66 | + | |
57 | 67 | | |
58 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
59 | 106 | | |
60 | 107 | | |
61 | 108 | | |
| |||
83 | 130 | | |
84 | 131 | | |
85 | 132 | | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
90 | 137 | | |
91 | 138 | | |
92 | 139 | | |
| |||
102 | 149 | | |
103 | 150 | | |
104 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
105 | 160 | | |
106 | 161 | | |
107 | 162 | | |
108 | 163 | | |
109 | 164 | | |
110 | 165 | | |
111 | | - | |
| 166 | + | |
112 | 167 | | |
113 | 168 | | |
114 | | - | |
115 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
116 | 189 | | |
117 | 190 | | |
118 | 191 | | |
| |||
121 | 194 | | |
122 | 195 | | |
123 | 196 | | |
| 197 | + | |
124 | 198 | | |
| 199 | + | |
| 200 | + | |
125 | 201 | | |
126 | 202 | | |
127 | 203 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
57 | 76 | | |
58 | 77 | | |
59 | 78 | | |
| |||
85 | 104 | | |
86 | 105 | | |
87 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
88 | 123 | | |
89 | 124 | | |
| 125 | + | |
| 126 | + | |
90 | 127 | | |
91 | 128 | | |
92 | 129 | | |
| |||
0 commit comments