Skip to content

Commit 72f3f95

Browse files
committed
Match all multicast and broadcast in one flow.
Thanks to Richard Sanger for pointing this out to me: Ethernet frames with a value of 1 in the least-significant bit of the first octet[note 2] of the destination address are treated as multicast frames and are flooded to all points on the network. While frames with ones in all bits of the destination address (FF-FF-FF-FF-FF-FF) are sometimes referred to as broadcasts, Ethernet network equipment generally does not distinguish between multicast and broadcast frames.
1 parent df84128 commit 72f3f95

File tree

1 file changed

+3
-29
lines changed

1 file changed

+3
-29
lines changed

valve.py

+3-29
Original file line numberDiff line numberDiff line change
@@ -310,33 +310,19 @@ def _packet_in_handler(self, ev):
310310
matches = []
311311
action = []
312312
if datapath.ports[in_port].is_tagged():
313-
# send rule for mathcing packets arriving on tagged ports
313+
# send rule for matching packets arriving on tagged ports
314314
strip_act = [parser.OFPActionPopVlan()]
315315
if tagged_act:
316316
action += tagged_act
317317
if untagged_act:
318318
action += strip_act + untagged_act
319319

320-
matches.append(parser.OFPMatch(vlan_vid=vid|ofproto_v1_3.OFPVID_PRESENT,
321-
in_port=in_port, eth_src=src, eth_dst='ff:ff:ff:ff:ff:ff'))
322-
320+
# match multicast/broadcast
323321
matches.append(parser.OFPMatch(vlan_vid=vid|ofproto_v1_3.OFPVID_PRESENT,
324322
in_port=in_port,
325323
eth_src=src,
326324
eth_dst=('01:00:00:00:00:00',
327325
'01:00:00:00:00:00')))
328-
329-
matches.append(parser.OFPMatch(vlan_vid=vid|ofproto_v1_3.OFPVID_PRESENT,
330-
in_port=in_port,
331-
eth_src=src,
332-
eth_dst=('01:00:5E:00:00:00',
333-
'ff:ff:ff:00:00:00')))
334-
335-
matches.append(parser.OFPMatch(vlan_vid=vid|ofproto_v1_3.OFPVID_PRESENT,
336-
in_port=in_port,
337-
eth_src=src,
338-
eth_dst=('33:33:00:00:00:00',
339-
'ff:ff:00:00:00:00')))
340326
elif datapath.ports[in_port].is_untagged():
341327
# send rule for each untagged port
342328
push_act = [
@@ -348,24 +334,12 @@ def _packet_in_handler(self, ev):
348334
if tagged_act:
349335
action += push_act + tagged_act
350336

351-
matches.append(parser.OFPMatch(in_port=in_port, eth_src=src,
352-
eth_dst='ff:ff:ff:ff:ff:ff'))
353-
337+
# match multicast/broadcast
354338
matches.append(parser.OFPMatch(in_port=in_port,
355339
eth_src=src,
356340
eth_dst=('01:00:00:00:00:00',
357341
'01:00:00:00:00:00')))
358342

359-
matches.append(parser.OFPMatch(in_port=in_port,
360-
eth_src=src,
361-
eth_dst=('01:00:5E:00:00:00',
362-
'ff:ff:ff:00:00:00')))
363-
364-
matches.append(parser.OFPMatch(in_port=in_port,
365-
eth_src=src,
366-
eth_dst=('33:33:00:00:00:00',
367-
'ff:ff:00:00:00:00')))
368-
369343
# install broadcast/multicast rules onto datapath
370344
if datapath.config_default['smart_broadcast']:
371345
for match in matches:

0 commit comments

Comments
 (0)