Skip to content

Commit 97037f6

Browse files
authored
Merge pull request #3527 from anarkiwi/learnping
Learn once from echo if host didn't ARP/ND for VIP first.
2 parents 382ba1f + 2f1f3bf commit 97037f6

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

faucet/valve_route.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ def _control_plane_arp_handler(self, now, pkt_meta):
886886
self.notify_learn(pkt_meta)
887887
return ofmsgs
888888

889-
def _control_plane_icmp_handler(self, pkt_meta, ipv4_pkt):
889+
def _control_plane_icmp_handler(self, now, pkt_meta, ipv4_pkt):
890890
"""Handle ICMP packets destined for the router"""
891891
ofmsgs = []
892892
if ipv4_pkt.proto != valve_of.inet.IPPROTO_ICMP:
@@ -903,6 +903,11 @@ def _control_plane_icmp_handler(self, pkt_meta, ipv4_pkt):
903903
pkt_meta.vlan.faucet_mac, pkt_meta.eth_src,
904904
pkt_meta.l3_dst, pkt_meta.l3_src,
905905
icmp_pkt.data))
906+
# ping but no previous ARP request for FAUCET VIP
907+
# from this host. Missed ARP request or host has
908+
# static ARP entry for us?
909+
if self._cached_nexthop_eth_dst(pkt_meta.vlan, pkt_meta.l3_src) is None:
910+
ofmsgs.extend(self.add_host_fib_route_from_pkt(now, pkt_meta))
906911
return ofmsgs
907912

908913
def control_plane_handler(self, now, pkt_meta):
@@ -915,7 +920,7 @@ def control_plane_handler(self, now, pkt_meta):
915920
if ipv4_pkt is None:
916921
return []
917922
icmp_replies = self._control_plane_icmp_handler(
918-
pkt_meta, ipv4_pkt)
923+
now, pkt_meta, ipv4_pkt)
919924
if icmp_replies:
920925
return icmp_replies
921926
return super(ValveIPv4RouteManager, self).control_plane_handler(now, pkt_meta)
@@ -1039,7 +1044,7 @@ def _router_solicit_handler(self, _now, pkt_meta, _ipv6_pkt, _icmpv6_pkt):
10391044
break
10401045
return ofmsgs
10411046

1042-
def _echo_request_handler(self, _now, pkt_meta, ipv6_pkt, icmpv6_pkt):
1047+
def _echo_request_handler(self, now, pkt_meta, ipv6_pkt, icmpv6_pkt):
10431048
ofmsgs = []
10441049
if self._unicast_to_vip(pkt_meta):
10451050
ofmsgs.append(
@@ -1049,6 +1054,11 @@ def _echo_request_handler(self, _now, pkt_meta, ipv6_pkt, icmpv6_pkt):
10491054
pkt_meta.l3_dst, pkt_meta.l3_src, ipv6_pkt.hop_limit,
10501055
icmpv6_pkt.data.id, icmpv6_pkt.data.seq,
10511056
icmpv6_pkt.data.data))
1057+
# ping but no previous ND request for FAUCET VIP
1058+
# from this host. Missed ND request or host has
1059+
# static ND entry for us?
1060+
if self._cached_nexthop_eth_dst(pkt_meta.vlan, pkt_meta.l3_src) is None:
1061+
ofmsgs.extend(self.add_host_fib_route_from_pkt(now, pkt_meta))
10521062
return ofmsgs
10531063

10541064
_icmpv6_handlers = {

0 commit comments

Comments
 (0)