From: tmartiro Date: Mon, 17 Jul 2017 14:23:20 +0000 (+0300) Subject: merge with upstream X-Git-Tag: frr-4.0-dev~502^2~2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=a8a4fa8954fd3b4e5b4f9bc9173eef79a827a8ff;p=mirror%2Ffrr.git merge with upstream --- a8a4fa8954fd3b4e5b4f9bc9173eef79a827a8ff diff --cc zebra/interface.c index e355c88316,26b2433826..11d02f6b9d --- a/zebra/interface.c +++ b/zebra/interface.c @@@ -716,130 -708,108 +708,120 @@@ void if_delete_update(struct interface } /* VRF change for an interface */ - void - if_handle_vrf_change (struct interface *ifp, vrf_id_t vrf_id) + void if_handle_vrf_change(struct interface *ifp, vrf_id_t vrf_id) { - vrf_id_t old_vrf_id; + vrf_id_t old_vrf_id; - old_vrf_id = ifp->vrf_id; + old_vrf_id = ifp->vrf_id; - /* Uninstall connected routes. */ - if_uninstall_connected (ifp); + /* Uninstall connected routes. */ + if_uninstall_connected(ifp); - /* Delete any IPv4 neighbors created to implement RFC 5549 */ - if_nbr_ipv6ll_to_ipv4ll_neigh_del_all (ifp); + /* Delete any IPv4 neighbors created to implement RFC 5549 */ + if_nbr_ipv6ll_to_ipv4ll_neigh_del_all(ifp); - /* Delete all neighbor addresses learnt through IPv6 RA */ - if_down_del_nbr_connected (ifp); + /* Delete all neighbor addresses learnt through IPv6 RA */ + if_down_del_nbr_connected(ifp); - /* Send out notification on interface VRF change. */ - /* This is to issue an UPDATE or a DELETE, as appropriate. */ - zebra_interface_vrf_update_del (ifp, vrf_id); + /* Send out notification on interface VRF change. */ + /* This is to issue an UPDATE or a DELETE, as appropriate. */ + zebra_interface_vrf_update_del(ifp, vrf_id); - /* update VRF */ - if_update_to_new_vrf (ifp, vrf_id); + /* update VRF */ + if_update_to_new_vrf(ifp, vrf_id); - /* Send out notification on interface VRF change. */ - /* This is to issue an ADD, if needed. */ - zebra_interface_vrf_update_add (ifp, old_vrf_id); + /* Send out notification on interface VRF change. */ + /* This is to issue an ADD, if needed. */ + zebra_interface_vrf_update_add(ifp, old_vrf_id); - /* Install connected routes (in new VRF). */ - if_install_connected (ifp); + /* Install connected routes (in new VRF). */ + if_install_connected(ifp); - /* Due to connected route change, schedule RIB processing for both old - * and new VRF. - */ - if (IS_ZEBRA_DEBUG_RIB_DETAILED) - zlog_debug ("%u: IF %s VRF change, scheduling RIB processing", - ifp->vrf_id, ifp->name); - rib_update (old_vrf_id, RIB_UPDATE_IF_CHANGE); - rib_update (ifp->vrf_id, RIB_UPDATE_IF_CHANGE); + /* Due to connected route change, schedule RIB processing for both old + * and new VRF. + */ + if (IS_ZEBRA_DEBUG_RIB_DETAILED) + zlog_debug("%u: IF %s VRF change, scheduling RIB processing", + ifp->vrf_id, ifp->name); + rib_update(old_vrf_id, RIB_UPDATE_IF_CHANGE); + rib_update(ifp->vrf_id, RIB_UPDATE_IF_CHANGE); - zebra_vrf_static_route_interface_fixup (ifp); + zebra_vrf_static_route_interface_fixup(ifp); } - static void - ipv6_ll_address_to_mac (struct in6_addr *address, u_char *mac) + static void ipv6_ll_address_to_mac(struct in6_addr *address, u_char *mac) { - mac[0] = address->s6_addr[8] ^ 0x02; - mac[1] = address->s6_addr[9]; - mac[2] = address->s6_addr[10]; - mac[3] = address->s6_addr[13]; - mac[4] = address->s6_addr[14]; - mac[5] = address->s6_addr[15]; + mac[0] = address->s6_addr[8] ^ 0x02; + mac[1] = address->s6_addr[9]; + mac[2] = address->s6_addr[10]; + mac[3] = address->s6_addr[13]; + mac[4] = address->s6_addr[14]; + mac[5] = address->s6_addr[15]; } - void - if_nbr_ipv6ll_to_ipv4ll_neigh_update (struct interface *ifp, - struct in6_addr *address, - int add) + void if_nbr_ipv6ll_to_ipv4ll_neigh_update(struct interface *ifp, + struct in6_addr *address, int add) { - struct zebra_vrf *zvrf = vrf_info_lookup(ifp->vrf_id); - char buf[16] = "169.254.0.1"; - struct in_addr ipv4_ll; - char mac[6]; + struct zebra_vrf *zvrf = vrf_info_lookup(ifp->vrf_id); + char buf[16] = "169.254.0.1"; + struct in_addr ipv4_ll; + char mac[6]; - inet_pton (AF_INET, buf, &ipv4_ll); + inet_pton(AF_INET, buf, &ipv4_ll); - ipv6_ll_address_to_mac(address, (u_char *)mac); - ipv6_ll_address_to_mac(address, (u_char *)mac); - kernel_neigh_update(add, ifp->ifindex, ipv4_ll.s_addr, mac, 6); ++ ipv6_ll_address_to_mac(address, (u_char *)mac); + - /* - * Remove existed arp record for the interface, - * because netlink protocol does not support message for update. - * supported commands RTM_NEWNEIGH or RTM_DELNEIGH - */ ++ /* ++ * Remove existed arp record for the interface, ++ * because netlink protocol does not support message for update. ++ * supported commands RTM_NEWNEIGH or RTM_DELNEIGH ++ */ + - kernel_neigh_update (0, ifp->ifindex, ipv4_ll.s_addr, mac, 6); - - /* - * Add arp record - */ - kernel_neigh_update (add, ifp->ifindex, ipv4_ll.s_addr, mac, 6); ++ kernel_neigh_update (0, ifp->ifindex, ipv4_ll.s_addr, mac, 6); + - zvrf->neigh_updates++; ++ /* ++ * Add arp record ++ */ ++ kernel_neigh_update (add, ifp->ifindex, ipv4_ll.s_addr, mac, 6); + zvrf->neigh_updates++; } - static void - if_nbr_ipv6ll_to_ipv4ll_neigh_add_all (struct interface *ifp) + static void if_nbr_ipv6ll_to_ipv4ll_neigh_add_all(struct interface *ifp) { - if (listhead(ifp->nbr_connected)) - { - struct nbr_connected *nbr_connected; - struct listnode *node; + if (listhead(ifp->nbr_connected)) { + struct nbr_connected *nbr_connected; + struct listnode *node; - for (ALL_LIST_ELEMENTS_RO (ifp->nbr_connected, node, nbr_connected)) - if_nbr_ipv6ll_to_ipv4ll_neigh_update (ifp, - &nbr_connected->address->u.prefix6, - 1); - } + for (ALL_LIST_ELEMENTS_RO(ifp->nbr_connected, node, + nbr_connected)) + if_nbr_ipv6ll_to_ipv4ll_neigh_update( + ifp, &nbr_connected->address->u.prefix6, 1); + } } - void - if_nbr_ipv6ll_to_ipv4ll_neigh_del_all (struct interface *ifp) + void if_nbr_ipv6ll_to_ipv4ll_neigh_del_all(struct interface *ifp) { - if (listhead(ifp->nbr_connected)) - { - struct nbr_connected *nbr_connected; - struct listnode *node; + if (listhead(ifp->nbr_connected)) { + struct nbr_connected *nbr_connected; + struct listnode *node; - for (ALL_LIST_ELEMENTS_RO (ifp->nbr_connected, node, nbr_connected)) - if_nbr_ipv6ll_to_ipv4ll_neigh_update (ifp, - &nbr_connected->address->u.prefix6, - 0); - } + for (ALL_LIST_ELEMENTS_RO(ifp->nbr_connected, node, + nbr_connected)) + if_nbr_ipv6ll_to_ipv4ll_neigh_update( + ifp, &nbr_connected->address->u.prefix6, 0); + } } - static void - if_down_del_nbr_connected (struct interface *ifp) + static void if_down_del_nbr_connected(struct interface *ifp) { - struct nbr_connected *nbr_connected; - struct listnode *node, *nnode; + struct nbr_connected *nbr_connected; + struct listnode *node, *nnode; - for (ALL_LIST_ELEMENTS (ifp->nbr_connected, node, nnode, nbr_connected)) - { - listnode_delete (ifp->nbr_connected, nbr_connected); - nbr_connected_free (nbr_connected); - } + for (ALL_LIST_ELEMENTS(ifp->nbr_connected, node, nnode, + nbr_connected)) { + listnode_delete(ifp->nbr_connected, nbr_connected); + nbr_connected_free(nbr_connected); + } } /* Interface is up. */