Skip to content

Commit ef1de41

Browse files
committed
Use correct multicast MAC address instead of broadcast for IPv6 multicast packets
Merged from inet-framework/inet PR #1104 by mgonzalezlopezudc. In datagramLocalOut() and routeMulticastPacket(), IPv6 multicast packets were sent with MacAddress::BROADCAST_ADDRESS as the destination MAC. This is incorrect: RFC 2464 Section 7 specifies that IPv6 multicast addresses should be mapped to Ethernet multicast addresses using Ipv6Address::mapToMulticastMacAddress(). Using broadcast causes all nodes on the link to process the frame at the MAC layer, even if they have not joined the multicast group. Updated fingerprints: multicast MAC destination address changed from ff:ff:ff:ff:ff:ff to 33:33:xx:xx:xx:xx, affecting byte-level content fingerprints in all IPv6 simulations that use multicast (ND, EIGRP, etc).
1 parent 4e92b2c commit ef1de41

3 files changed

Lines changed: 25 additions & 21 deletions

File tree

src/inet/networklayer/ipv6/Ipv6.cc

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,12 @@ void Ipv6::datagramLocalOut(Packet *packet, const NetworkInterface *destIE, Ipv6
412412
{
413413
const auto& ipv6Header = packet->peekAtFront<Ipv6Header>();
414414
// route packet
415-
if (destIE != nullptr)
416-
fragmentPostRouting(packet, destIE, MacAddress::BROADCAST_ADDRESS, true); // FIXME what MAC address to use?
415+
if (destIE != nullptr) {
416+
if (!ipv6Header->getDestAddress().isMulticast())
417+
fragmentPostRouting(packet, destIE, MacAddress::BROADCAST_ADDRESS, true);
418+
else
419+
fragmentPostRouting(packet, destIE, ipv6Header->getDestAddress().mapToMulticastMacAddress(), true);
420+
}
417421
else if (!ipv6Header->getDestAddress().isMulticast())
418422
routePacket(packet, destIE, nullptr, requestedNextHopAddress, true);
419423
else
@@ -612,7 +616,7 @@ void Ipv6::routeMulticastPacket(Packet *packet, const NetworkInterface *destIE,
612616
for (int i = 0; i < ift->getNumInterfaces(); i++) {
613617
NetworkInterface *ie = ift->getInterface(i);
614618
if (fromIE != ie && !ie->isLoopback())
615-
fragmentPostRouting(packet->dup(), ie, MacAddress::BROADCAST_ADDRESS, fromHL);
619+
fragmentPostRouting(packet->dup(), ie, ipv6Header->getDestAddress().mapToMulticastMacAddress(), fromHL);
616620
}
617621
delete packet;
618622

tests/fingerprint/examples.csv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@
156156

157157
# /examples/inet/hierarchical99/, -f .qtenv.ini -c General -r 0
158158
/examples/inet/hierarchical99/, -f networklayer.ini -c IPv4 -r 0, 10000s, a94d-edae/tplx;1f32-e325/~tNl;b138-ee8b/~tND;66c9-cd73/tyf, PASS, EthernetMac Ipv4
159-
/examples/inet/hierarchical99/, -f networklayer.ini -c IPv6 -r 0, 10000s, f250-4366/tplx;3044-7720/~tNl;976d-ba9b/~tND;6ebb-21c0/tyf, PASS, EthernetMac
159+
/examples/inet/hierarchical99/, -f networklayer.ini -c IPv6 -r 0, 10000s, f250-4366/tplx;3044-7720/~tNl;3d6f-69a8/~tND;6ebb-21c0/tyf, PASS, EthernetMac
160160
/examples/inet/hierarchical99/, -f networklayer.ini -c Generic -r 0, 10000s, 6ae4-6e75/tplx;2209-80ac/~tNl;93bf-6657/tyf, PASS, EthernetMac
161161
/examples/inet/hierarchical99/, -f networklayer.ini -c Flooding -r 0, 10000s, 7ba7-5b91/tplx;b0f0-411e/~tNl;2b94-8906/tyf, PASS, EthernetMac
162162
/examples/inet/hierarchical99/, -f networklayer.ini -c ProbabilisticBroadcast -r 0, 10000s, 5a54-9779/tplx;1165-a70b/~tNl;760b-abfc/tyf, PASS, EthernetMac
@@ -374,7 +374,7 @@
374374
/examples/manetrouting/multiradio/, -f omnetpp.ini -c MultiRadio -r 0, 20s, ec17-5cc2/tplx;55f5-0894/~tNl, PASS, wireless adhoc Ipv4
375375
/examples/manetrouting/multiradio/, -f omnetpp.ini -c SingleRadio -r 0, 20s, 85a0-51b8/tplx;c07a-44e1/~tNl;3aa0-49ed/tyf, PASS, wireless adhoc Ipv4
376376

377-
/examples/mobileipv6/, -f omnetpp.ini -c One -r 0, 25s, e71f-49d5/tplx;f5d3-0cf3/~tNl;99e2-5968/~tND;5955-cf41/tyf, PASS, wireless EthernetMac
377+
/examples/mobileipv6/, -f omnetpp.ini -c One -r 0, 25s, e71f-49d5/tplx;f5d3-0cf3/~tNl;897b-d0ab/~tND;5955-cf41/tyf, PASS, wireless EthernetMac
378378

379379
/examples/mobility/, -f omnetpp.ini -c AnsimMobility -r 0, 10000s, 72f8-5c0b/tplx;0000-0000/~tNl;0000-0000/~tND;7dd1-18eb/tyf, PASS,
380380
/examples/mobility, -f omnetpp.ini -c AttachedMobility, 10s, 566c-6355/tplx;0000-0000/~tNl;0000-0000/~tND;fa92-f68c/tyf, PASS,

tests/fingerprint/mipv6-refactoring.csv

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,34 @@
33
# Baseline established from current (pre-refactoring) code.
44

55
# MIPv6 example — the primary test
6-
/examples/mobileipv6/, -f omnetpp.ini -c One -r 0, 25s, 862e-1a8e/~tNlb, PASS, wireless EthernetMac
6+
/examples/mobileipv6/, -f omnetpp.ini -c One -r 0, 25s, 6c01-e97b/~tNlb, PASS, wireless EthernetMac
77

88
# IPv6 examples
9-
/examples/ipv6/demonetworketh/, -f omnetpp.ini -c General -r 0, 50000s, ff08-3d6f/~tNlb, PASS, EthernetMac
9+
/examples/ipv6/demonetworketh/, -f omnetpp.ini -c General -r 0, 50000s, 9fbb-2bd0/~tNlb, PASS, EthernetMac
1010
/examples/ipv6/ipv6bulk/, -f omnetpp.ini -c inet_inet -r 0, 50s, 6925-41c3/~tNlb, PASS, EthernetMac
11-
/examples/ipv6/ipv6nclients/, -f omnetpp.ini -c ETH -r 0, 50s, 2221-ba0b/~tNlb, PASS, EthernetMac
12-
/examples/ipv6/ipv6nclients/, -f omnetpp.ini -c Mixed -r 0, 50s, e963-ce38/~tNlb, PASS, EthernetMac
11+
/examples/ipv6/ipv6nclients/, -f omnetpp.ini -c ETH -r 0, 50s, 8f4c-3fe3/~tNlb, PASS, EthernetMac
12+
/examples/ipv6/ipv6nclients/, -f omnetpp.ini -c Mixed -r 0, 50s, dc2f-f459/~tNlb, PASS, EthernetMac
1313
/examples/ipv6/ipv6nclients/, -f omnetpp.ini -c PPP -r 0, 50s, 6194-857b/~tNlb, PASS,
14-
/examples/ipv6/nclients/, -f omnetpp.ini -c ETH -r 0, 1000s, dda1-3f94/~tNlb, PASS, EthernetMac
14+
/examples/ipv6/nclients/, -f omnetpp.ini -c ETH -r 0, 1000s, a6cb-7e79/~tNlb, PASS, EthernetMac
1515
/examples/ipv6/nclients/, -f omnetpp.ini -c PPP -r 0, 1000s, 6903-a642/~tNlb, PASS,
1616
/examples/ipv6/nclients/, -f omnetpp.ini -c PPP_SCTP -r 0, 100s, c95f-6f6f/~tNlb, PASS,
1717

1818
# IPv6 networking examples
19-
/examples/inet/hierarchical99/, -f networklayer.ini -c IPv6 -r 0, 10000s, 0fc2-d6ef/~tNlb, PASS, EthernetMac
19+
/examples/inet/hierarchical99/, -f networklayer.ini -c IPv6 -r 0, 10000s, 164b-dc1a/~tNlb, PASS, EthernetMac
2020
/examples/inet/udpclientserver/, -f omnetpp.ini -c udp_OK_ipv6 -r 0, 10s, 0943-319e/~tNlb, PASS,
2121
/examples/inet/udpclientserver/, -f omnetpp.ini -c udp_Port_Unav_ipv6 -r 0, 10s, 2129-112a/~tNlb, PASS,
2222
/examples/inet/udpclientserver/, -f omnetpp.ini -c udp_Host_Unav_ipv6 -r 0, 10s, b88c-7acf/~tNlb, PASS,
2323

2424
# DYMO with IPv6
25-
/examples/manetrouting/dymo/, -f omnetpp.ini -c IPv6 -r 0, 10s, 18c3-c143/~tNlb, PASS, wireless adhoc
26-
/examples/manetrouting/dymo/, -f omnetpp.ini -c MultiIPv6 -r 0, 10s, 18c3-c143/~tNlb, PASS, wireless adhoc
25+
/examples/manetrouting/dymo/, -f omnetpp.ini -c IPv6 -r 0, 10s, 8cde-266f/~tNlb, PASS, wireless adhoc
26+
/examples/manetrouting/dymo/, -f omnetpp.ini -c MultiIPv6 -r 0, 10s, 8cde-266f/~tNlb, PASS, wireless adhoc
2727

2828
# EIGRP with IPv6
29-
/examples/eigrp/testing_scenario6/, -f omnetpp.ini -c EIGRP-IPv6_exp1_bandwidth-change -r 0, 3min, 71b5-3efa/~tNlb, PASS, eigrp EthernetMac
30-
/examples/eigrp/testing_scenario6/, -f omnetpp.ini -c EIGRP-IPv6_exp2_interface-down -r 0, 3min, 2dbe-d03c/~tNlb, PASS, eigrp EthernetMac
31-
/examples/eigrp/testing_scenario6/, -f omnetpp.ini -c EIGRP-IPv6_exp1_bandwidth-change_global-addr -r 0, 3min, 37bc-ab12/~tNlb, PASS, eigrp EthernetMac
32-
/examples/eigrp/testing_scenario6/, -f omnetpp.ini -c EIGRP-IPv6_exp2_interface-down_global-addr -r 0, 3min, 4f1e-718c/~tNlb, PASS, eigrp EthernetMac
33-
/examples/eigrp/testing_scenario_ds/, -f omnetpp.ini -c EIGRP-IPv6_exp1_datarate-change -r 0, 3min, e5c8-d36f/~tNlb, PASS, eigrp EthernetMac Ipv4
34-
/examples/eigrp/testing_scenario_ds/, -f omnetpp.ini -c EIGRP-IPv6_exp2_interface-down -r 0, 3min, 5100-9416/~tNlb, PASS, eigrp EthernetMac Ipv4
35-
/examples/eigrp/testing_scenario_ds/, -f omnetpp.ini -c EIGRP-IPv6_exp1_datarate-change_global-addr -r 0, 3min, 52eb-4821/~tNlb, PASS, eigrp EthernetMac Ipv4
36-
/examples/eigrp/testing_scenario_ds/, -f omnetpp.ini -c EIGRP-IPv6_exp2_interface-down_global-addr -r 0, 3min, 0da1-66ea/~tNlb, PASS, eigrp EthernetMac Ipv4
29+
/examples/eigrp/testing_scenario6/, -f omnetpp.ini -c EIGRP-IPv6_exp1_bandwidth-change -r 0, 3min, 89fb-92e5/~tNlb, PASS, eigrp EthernetMac
30+
/examples/eigrp/testing_scenario6/, -f omnetpp.ini -c EIGRP-IPv6_exp2_interface-down -r 0, 3min, f54a-d3d5/~tNlb, PASS, eigrp EthernetMac
31+
/examples/eigrp/testing_scenario6/, -f omnetpp.ini -c EIGRP-IPv6_exp1_bandwidth-change_global-addr -r 0, 3min, 4e39-e3c5/~tNlb, PASS, eigrp EthernetMac
32+
/examples/eigrp/testing_scenario6/, -f omnetpp.ini -c EIGRP-IPv6_exp2_interface-down_global-addr -r 0, 3min, 7d7e-675b/~tNlb, PASS, eigrp EthernetMac
33+
/examples/eigrp/testing_scenario_ds/, -f omnetpp.ini -c EIGRP-IPv6_exp1_datarate-change -r 0, 3min, 2781-835f/~tNlb, PASS, eigrp EthernetMac Ipv4
34+
/examples/eigrp/testing_scenario_ds/, -f omnetpp.ini -c EIGRP-IPv6_exp2_interface-down -r 0, 3min, b55b-0a5b/~tNlb, PASS, eigrp EthernetMac Ipv4
35+
/examples/eigrp/testing_scenario_ds/, -f omnetpp.ini -c EIGRP-IPv6_exp1_datarate-change_global-addr -r 0, 3min, 27f0-0435/~tNlb, PASS, eigrp EthernetMac Ipv4
36+
/examples/eigrp/testing_scenario_ds/, -f omnetpp.ini -c EIGRP-IPv6_exp2_interface-down_global-addr -r 0, 3min, 377e-916b/~tNlb, PASS, eigrp EthernetMac Ipv4

0 commit comments

Comments
 (0)