Skip to content

Commit 547340b

Browse files
ZoltanBojthelevy
authored andcommitted
ipv6: reduce usage of INET_WITH_xMIPv6 macro
1 parent ef9496c commit 547340b

File tree

2 files changed

+10
-29
lines changed

2 files changed

+10
-29
lines changed

src/inet/networklayer/icmpv6/Ipv6NeighbourDiscovery.cc

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2100,43 +2100,33 @@ void Ipv6NeighbourDiscovery::sendUnsolicitedNa(NetworkInterface *ie)
21002100
// Section 7.2.6: Sending Unsolicited Neighbor Advertisements
21012101
#ifdef INET_WITH_xMIPv6
21022102
Enter_Method("sendUnsolicitedNa");
2103-
#endif /* INET_WITH_xMIPv6 */
21042103

2105-
#ifndef INET_WITH_xMIPv6
21062104
// In some cases a node may be able to determine that its link-layer
21072105
// address has changed (e.g., hot-swap of an interface card) and may
21082106
// wish to inform its neighbors of the new link-layer address quickly.
21092107
// In such cases a node MAY send up to MAX_NEIGHBOR_ADVERTISEMENT
21102108
// unsolicited Neighbor Advertisement messages to the all-nodes
21112109
// multicast address. These advertisements MUST be separated by at
21122110
// least RetransTimer seconds.
2113-
#else /* INET_WITH_xMIPv6 */
21142111
auto na = makeShared<Ipv6NeighbourAdvertisement>();
21152112
Ipv6Address myIPv6Addr = ie->getProtocolData<Ipv6InterfaceData>()->getPreferredAddress();
2116-
#endif /* INET_WITH_xMIPv6 */
21172113

21182114
// The Target Address field in the unsolicited advertisement is set to
21192115
// an IP address of the interface, and the Target Link-Layer Address
21202116
// option is filled with the new link-layer address.
2121-
#ifdef INET_WITH_xMIPv6
21222117
na->setTargetAddress(myIPv6Addr);
21232118
auto sla = new Ipv6NdTargetLinkLayerAddress();
21242119
sla->setLinkLayerAddress(ie->getMacAddress());
21252120
na->getOptionsForUpdate().appendOption(sla);
21262121
na->addChunkLength(IPv6ND_LINK_LAYER_ADDRESS_OPTION_LENGTH);
2127-
#endif /* INET_WITH_xMIPv6 */
21282122

21292123
// The Solicited flag MUST be set to zero, in order to avoid confusing
21302124
// the Neighbor Unreachability Detection algorithm.
2131-
#ifdef INET_WITH_xMIPv6
21322125
na->setSolicitedFlag(false);
2133-
#endif /* INET_WITH_xMIPv6 */
21342126

21352127
// If the node is a router, it MUST set the Router flag to one;
21362128
// otherwise it MUST set it to zero.
2137-
#ifdef INET_WITH_xMIPv6
21382129
na->setRouterFlag(rt6->isRouter());
2139-
#endif /* INET_WITH_xMIPv6 */
21402130

21412131
// The Override flag MAY be set to either zero or one. In either case,
21422132
// neighboring nodes will immediately change the state of their Neighbor
@@ -2145,9 +2135,7 @@ void Ipv6NeighbourDiscovery::sendUnsolicitedNa(NetworkInterface *ie)
21452135
// one, neighboring nodes will install the new link-layer address in
21462136
// their caches. Otherwise, they will ignore the new link-layer
21472137
// address, choosing instead to probe the cached address.
2148-
#ifdef INET_WITH_xMIPv6
21492138
na->setOverrideFlag(true);
2150-
#endif /* INET_WITH_xMIPv6 */
21512139

21522140
// A node that has multiple IP addresses assigned to an interface MAY
21532141
// multicast a separate Neighbor Advertisement for each address. In
@@ -2174,7 +2162,6 @@ void Ipv6NeighbourDiscovery::sendUnsolicitedNa(NetworkInterface *ie)
21742162
// Neighbor Unreachability Detection algorithm ensures that all nodes
21752163
// obtain a reachable link-layer address, though the delay may be
21762164
// slightly longer.
2177-
#ifdef INET_WITH_xMIPv6
21782165
auto packet = new Packet("NApacket");
21792166
Icmpv6::insertCrc(crcMode, na, packet);
21802167
packet->insertAtFront(na);

src/inet/networklayer/ipv6/Ipv6InterfaceData.cc

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ std::string Ipv6InterfaceData::RouterMulticastData::detailedInfo()
7171
Ipv6InterfaceData::Ipv6InterfaceData()
7272
: InterfaceProtocolData(NetworkInterface::F_IPV6_DATA)
7373
{
74-
#ifdef INET_WITH_xMIPv6
75-
// rt6 = IPv6RoutingTableAccess().get();
76-
#endif /* INET_WITH_xMIPv6 */
7774
/*******************Setting host/node/router Protocol Constants************/
7875
routerConstants.maxInitialRtrAdvertInterval = IPv6_MAX_INITIAL_RTR_ADVERT_INTERVAL;
7976
routerConstants.maxInitialRtrAdvertisements = IPv6_MAX_INITIAL_RTR_ADVERTISEMENTS;
@@ -85,15 +82,6 @@ Ipv6InterfaceData::Ipv6InterfaceData()
8582
hostConstants.rtrSolicitationInterval = IPv6_RTR_SOLICITATION_INTERVAL;
8683
hostConstants.maxRtrSolicitations = IPv6_MAX_RTR_SOLICITATIONS;
8784

88-
#ifdef INET_WITH_xMIPv6
89-
hostConstants.initialBindAckTimeout = MIPv6_INITIAL_BINDACK_TIMEOUT; // MIPv6: added by Zarrar Yousaf @ CNI UniDo 17.06.07
90-
hostConstants.maxBindAckTimeout = MIPv6_MAX_BINDACK_TIMEOUT; // MIPv6: added by Zarrar Yousaf @ CNI UniDo 17.06.07
91-
hostConstants.initialBindAckTimeoutFirst = MIPv6_INITIAL_BINDACK_TIMEOUT_FIRST; // MIPv6: 12.9.07 - CB
92-
hostConstants.maxRRBindingLifeTime = MIPv6_MAX_RR_BINDING_LIFETIME; // 14.9.07 - CB
93-
hostConstants.maxHABindingLifeTime = MIPv6_MAX_HA_BINDING_LIFETIME; // 14.9.07 - CB
94-
hostConstants.maxTokenLifeTime = MIPv6_MAX_TOKEN_LIFETIME; // 14.9.07 - CB
95-
#endif /* INET_WITH_xMIPv6 */
96-
9785
nodeConstants.maxMulticastSolicit = IPv6_MAX_MULTICAST_SOLICIT;
9886
nodeConstants.maxUnicastSolicit = IPv6_MAX_UNICAST_SOLICIT;
9987
nodeConstants.maxAnycastDelayTime = IPv6_MAX_ANYCAST_DELAY_TIME;
@@ -120,16 +108,22 @@ Ipv6InterfaceData::Ipv6InterfaceData()
120108
rtrVars.advManagedFlag = false;
121109
rtrVars.advOtherConfigFlag = false;
122110

123-
#ifdef INET_WITH_xMIPv6
124-
rtrVars.advHomeAgentFlag = false; // Zarrar Yousaf Feb-March 2007
125-
#endif /* INET_WITH_xMIPv6 */
126-
127111
rtrVars.advLinkMTU = IPv6_MIN_MTU;
128112
rtrVars.advReachableTime = IPv6_DEFAULT_ADV_REACHABLE_TIME;
129113
rtrVars.advRetransTimer = IPv6_DEFAULT_ADV_RETRANS_TIMER;
130114
rtrVars.advCurHopLimit = IPv6_DEFAULT_ADVCURHOPLIMIT;
131115
rtrVars.advDefaultLifetime = 3 * rtrVars.maxRtrAdvInterval;
132116

117+
#ifdef INET_WITH_xMIPv6
118+
rtrVars.advHomeAgentFlag = false; // Zarrar Yousaf Feb-March 2007
119+
hostConstants.initialBindAckTimeout = MIPv6_INITIAL_BINDACK_TIMEOUT; // MIPv6: added by Zarrar Yousaf @ CNI UniDo 17.06.07
120+
hostConstants.maxBindAckTimeout = MIPv6_MAX_BINDACK_TIMEOUT; // MIPv6: added by Zarrar Yousaf @ CNI UniDo 17.06.07
121+
hostConstants.initialBindAckTimeoutFirst = MIPv6_INITIAL_BINDACK_TIMEOUT_FIRST; // MIPv6: 12.9.07 - CB
122+
hostConstants.maxRRBindingLifeTime = MIPv6_MAX_RR_BINDING_LIFETIME; // 14.9.07 - CB
123+
hostConstants.maxHABindingLifeTime = MIPv6_MAX_HA_BINDING_LIFETIME; // 14.9.07 - CB
124+
hostConstants.maxTokenLifeTime = MIPv6_MAX_TOKEN_LIFETIME; // 14.9.07 - CB
125+
#endif /* INET_WITH_xMIPv6 */
126+
133127
#if USE_MOBILITY
134128
if (rtrVars.advDefaultLifetime < 1)
135129
rtrVars.advDefaultLifetime = 1;

0 commit comments

Comments
 (0)