/* Wake up configured address if it is not in current kernel address. */ static void if_addr_wakeup (struct interface *ifp) { struct listnode *node, *nnode; struct connected *ifc; struct prefix *p; int ret; for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, ifc)) { p = ifc->address; if (CHECK_FLAG (ifc->conf, ZEBRA_IFC_CONFIGURED) && ! CHECK_FLAG (ifc->conf, ZEBRA_IFC_REAL)) { /* Address check. */ if (p->family == AF_INET) { if (! if_is_up (ifp)) { /* XXX: WTF is it trying to set flags here? * caller has just gotten a new interface, has been * handed the flags already. This code has no business * trying to override administrative status of the interface. * The only call path to here which doesn't originate from * kernel event is irdp - what on earth is it trying to do? * * further RUNNING is not a settable flag on any system * I (paulj) am aware of. */ if_set_flags (ifp, IFF_UP | IFF_RUNNING); if_refresh (ifp); } ret = if_set_prefix (ifp, ifc); if (ret < 0) { zlog_warn ("Can't set interface's address: %s", safe_strerror(errno)); continue; } /* Add to subnet chain list. */ if_subnet_add (ifp, ifc); SET_FLAG (ifc->conf, ZEBRA_IFC_REAL); zebra_interface_address_add_update (ifp, ifc); if (if_is_operative(ifp)) connected_up_ipv4 (ifp, ifc); } #ifdef HAVE_IPV6 if (p->family == AF_INET6) { if (! if_is_up (ifp)) { /* XXX: See long comment above */ if_set_flags (ifp, IFF_UP | IFF_RUNNING); if_refresh (ifp); } ret = if_prefix_add_ipv6 (ifp, ifc); if (ret < 0) { zlog_warn ("Can't set interface's address: %s", safe_strerror(errno)); continue; } SET_FLAG (ifc->conf, ZEBRA_IFC_REAL); zebra_interface_address_add_update (ifp, ifc); if (if_is_operative(ifp)) connected_up_ipv6 (ifp, ifc); } #endif /* HAVE_IPV6 */ } } }
/* Wake up configured address if it is not in current kernel address. */ void if_addr_wakeup (struct interface *ifp) { struct listnode *node; struct connected *ifc; struct prefix *p; int ret; for (node = listhead (ifp->connected); node; nextnode (node)) { ifc = getdata (node); p = ifc->address; if (CHECK_FLAG (ifc->conf, ZEBRA_IFC_CONFIGURED) && ! CHECK_FLAG (ifc->conf, ZEBRA_IFC_REAL)) { /* Address check. */ if (p->family == AF_INET) { if (! if_is_up (ifp)) { if_set_flags (ifp, IFF_UP | IFF_RUNNING); if_refresh (ifp); } ret = if_set_prefix (ifp, ifc); if (ret < 0) { zlog_warn ("Can't set interface's address: %s", strerror(errno)); continue; } SET_FLAG (ifc->conf, ZEBRA_IFC_REAL); zebra_interface_address_add_update (ifp, ifc); if (if_is_up(ifp)) connected_up_ipv4 (ifp, ifc); } #ifdef HAVE_IPV6 if (p->family == AF_INET6) { if (! if_is_up (ifp)) { if_set_flags (ifp, IFF_UP | IFF_RUNNING); if_refresh (ifp); } ret = if_prefix_add_ipv6 (ifp, ifc); if (ret < 0) { zlog_warn ("Can't set interface's address: %s", strerror(errno)); continue; } SET_FLAG (ifc->conf, ZEBRA_IFC_REAL); zebra_interface_address_add_update (ifp, ifc); if (if_is_up(ifp)) connected_up_ipv6 (ifp, ifc); } #endif /* HAVE_IPV6 */ } } }
/* Wake up configured address if it is not in current kernel address. */ static void if_addr_wakeup (struct interface *ifp) { struct listnode *node, *nnode; struct connected *ifc; struct prefix *p; int ret; for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, ifc)) { p = ifc->address; if (CHECK_FLAG (ifc->conf, ZEBRA_IFC_CONFIGURED) && ! CHECK_FLAG (ifc->conf, ZEBRA_IFC_QUEUED)) { /* Address check. */ if (p->family == AF_INET) { if (! if_is_up (ifp)) { /* Assume zebra is configured like following: * * interface gre0 * ip addr 192.0.2.1/24 * ! * * As soon as zebra becomes first aware that gre0 exists in the * kernel, it will set gre0 up and configure its addresses. * * (This may happen at startup when the interface already exists * or during runtime when the interface is added to the kernel) * * XXX: IRDP code is calling here via if_add_update - this seems * somewhat weird. * XXX: RUNNING is not a settable flag on any system * I (paulj) am aware of. */ if_set_flags (ifp, IFF_UP | IFF_RUNNING); if_refresh (ifp); } ret = if_set_prefix (ifp, ifc); if (ret < 0) { zlog_warn ("Can't set interface's address: %s", safe_strerror(errno)); continue; } SET_FLAG (ifc->conf, ZEBRA_IFC_QUEUED); /* The address will be advertised to zebra clients when the notification * from the kernel has been received. * It will also be added to the interface's subnet list then. */ } #ifdef HAVE_IPV6 if (p->family == AF_INET6) { if (! if_is_up (ifp)) { /* See long comment above */ if_set_flags (ifp, IFF_UP | IFF_RUNNING); if_refresh (ifp); } ret = if_prefix_add_ipv6 (ifp, ifc); if (ret < 0) { zlog_warn ("Can't set interface's address: %s", safe_strerror(errno)); continue; } SET_FLAG (ifc->conf, ZEBRA_IFC_QUEUED); /* The address will be advertised to zebra clients when the notification * from the kernel has been received. */ } #endif /* HAVE_IPV6 */ } } }