diff options
Diffstat (limited to 'zebra/rt_netlink.c')
-rw-r--r-- | zebra/rt_netlink.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 7652f80a..d25543ff 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -549,6 +549,7 @@ netlink_interface_addr (struct sockaddr_nl *snl, struct nlmsghdr *h) char buf[BUFSIZ]; zlog_debug ("netlink_interface_addr %s %s:", lookup (nlmsg_str, h->nlmsg_type), ifp->name); + zlog_debug (" ifa_scope %s", connected_scope_name (ifa->ifa_scope)); if (tb[IFA_LOCAL]) zlog_debug (" IFA_LOCAL %s/%d", inet_ntop (ifa->ifa_family, RTA_DATA (tb[IFA_LOCAL]), @@ -616,7 +617,7 @@ netlink_interface_addr (struct sockaddr_nl *snl, struct nlmsghdr *h) if (h->nlmsg_type == RTM_NEWADDR) connected_add_ipv4 (ifp, flags, (struct in_addr *) addr, ifa->ifa_prefixlen, - (struct in_addr *) broad, label); + (struct in_addr *) broad, label, ifa->ifa_scope, 0); else connected_delete_ipv4 (ifp, flags, (struct in_addr *) addr, ifa->ifa_prefixlen, @@ -628,7 +629,7 @@ netlink_interface_addr (struct sockaddr_nl *snl, struct nlmsghdr *h) if (h->nlmsg_type == RTM_NEWADDR) connected_add_ipv6 (ifp, flags, (struct in6_addr *) addr, ifa->ifa_prefixlen, - (struct in6_addr *) broad, label); + (struct in6_addr *) broad, label, ifa->ifa_scope); else connected_delete_ipv6 (ifp, (struct in6_addr *) addr, ifa->ifa_prefixlen, @@ -1778,20 +1779,30 @@ netlink_address (int cmd, int family, struct interface *ifp, req.ifa.ifa_family = family; req.ifa.ifa_index = ifp->ifindex; - req.ifa.ifa_prefixlen = p->prefixlen; + req.ifa.ifa_scope = ifc->scope; addattr_l (&req.n, sizeof req, IFA_LOCAL, &p->u.prefix, bytelen); - if (family == AF_INET && cmd == RTM_NEWADDR) + if (family == AF_INET) { - if (!CONNECTED_PEER(ifc) && ifc->destination) + if (CONNECTED_PEER(ifc)) { p = ifc->destination; - addattr_l (&req.n, sizeof req, IFA_BROADCAST, &p->u.prefix, + addattr_l (&req.n, sizeof req, IFA_ADDRESS, &p->u.prefix, bytelen); } + else + if (cmd == RTM_NEWADDR && ifc->destination) + { + p = ifc->destination; + addattr_l (&req.n, sizeof req, IFA_BROADCAST, &p->u.prefix, + bytelen); + } } + /* p is now either ifc->address or ifc->destination */ + req.ifa.ifa_prefixlen = p->prefixlen; + if (CHECK_FLAG (ifc->flags, ZEBRA_IFA_SECONDARY)) SET_FLAG (req.ifa.ifa_flags, IFA_F_SECONDARY); |