From: vivek Date: Fri, 13 May 2016 05:57:40 +0000 (-0700) Subject: zebra: Accept and process RAs with lifetime of zero X-Git-Tag: frr-2.0-rc1~917 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=1d20ccf32c13805147fe71c6e39295c9b3ed6bc5;p=matthieu%2Ffrr.git zebra: Accept and process RAs with lifetime of zero Fix code to not discard received RAs with a lifetime of 0. The router lifetime is only applicable for default router processing which is not relevant here. For the purposes of BGP unnumbered, the neighbor should be learnt without consideration of the value of router lifetime in received RA. Note: This patch brings in a portion of the earlier commit 690baa53592320dddee5c729f959150cc9a72699 - this included some additional changes which have been reverted. Signed-off-by: Vivek Venkatraman Reviewed-by: Daniel Walton Ticket: CM-10943 Reviewed By: CCR-4611 Testing Done: bgp-smoke --- diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 02499a3557..59542481dd 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -448,6 +448,7 @@ rtadv_process_advert (u_char *msg, unsigned int len, struct interface *ifp, struct nd_router_advert *radvert; char addr_str[INET6_ADDRSTRLEN]; struct zebra_if *zif; + struct prefix p; zif = ifp->info; @@ -501,15 +502,13 @@ rtadv_process_advert (u_char *msg, unsigned int len, struct interface *ifp, ifp->name, ifp->ifindex, addr_str); } - /* Currently supporting only P2P links, so any new RA source address is - considered as the replacement of the previously learnt Link-Local address. - As per the RFC, lifetime zero is to be considered a delete */ - if (ntohs(radvert->nd_ra_router_lifetime)) - nbr_connected_replacement_add_ipv6(ifp, &addr->sin6_addr, 128); - else - nbr_connected_delete_ipv6(ifp, &addr->sin6_addr, 128); + /* Create entry for neighbor if not known. */ + p.family = AF_INET6; + IPV6_ADDR_COPY (&p.u.prefix, &addr->sin6_addr); + p.prefixlen = IPV6_MAX_PREFIXLEN; - return; + if (!nbr_connected_check(ifp, &p)) + nbr_connected_add_ipv6 (ifp, &addr->sin6_addr); } diff --git a/zebra/zserv.c b/zebra/zserv.c index e9698a82a8..d6de0792e1 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -471,21 +471,16 @@ zsend_interface_vrf_update (struct zserv *client, struct interface *ifp, return zebra_server_send_message(client); } -/* Add new nbr connected IPv6 address if none exists already, or replace the - existing one if an ifc entry is found on the interface. */ +/* Add new nbr connected IPv6 address */ void -nbr_connected_replacement_add_ipv6 (struct interface *ifp, struct in6_addr *address, - u_char prefixlen) +nbr_connected_add_ipv6 (struct interface *ifp, struct in6_addr *address) { struct nbr_connected *ifc; struct prefix p; p.family = AF_INET6; IPV6_ADDR_COPY (&p.u.prefix, address); - p.prefixlen = prefixlen; - - if (nbr_connected_check(ifp, &p)) - return; + p.prefixlen = IPV6_MAX_PREFIXLEN; if (!(ifc = listnode_head(ifp->nbr_connected))) { @@ -504,15 +499,14 @@ nbr_connected_replacement_add_ipv6 (struct interface *ifp, struct in6_addr *addr } void -nbr_connected_delete_ipv6 (struct interface *ifp, struct in6_addr *address, - u_char prefixlen) +nbr_connected_delete_ipv6 (struct interface *ifp, struct in6_addr *address) { struct nbr_connected *ifc; struct prefix p; p.family = AF_INET6; IPV6_ADDR_COPY (&p.u.prefix, address); - p.prefixlen = prefixlen; + p.prefixlen = IPV6_MAX_PREFIXLEN; ifc = nbr_connected_check(ifp, &p); if (!ifc) diff --git a/zebra/zserv.h b/zebra/zserv.h index 7fde4adb5e..16700ee523 100644 --- a/zebra/zserv.h +++ b/zebra/zserv.h @@ -155,9 +155,8 @@ extern int zsend_interface_delete (struct zserv *, struct interface *); extern int zsend_interface_addresses (struct zserv *, struct interface *); extern int zsend_interface_address (int, struct zserv *, struct interface *, struct connected *); -extern void nbr_connected_replacement_add_ipv6 (struct interface *, - struct in6_addr *, u_char); -extern void nbr_connected_delete_ipv6 (struct interface *, struct in6_addr *, u_char); +extern void nbr_connected_add_ipv6 (struct interface *, struct in6_addr *); +extern void nbr_connected_delete_ipv6 (struct interface *, struct in6_addr *); extern int zsend_interface_update (int, struct zserv *, struct interface *); extern int zsend_redistribute_route (int, struct zserv *, struct prefix *, struct rib *);