From: David Lamparter Date: Wed, 20 Jan 2010 17:27:16 +0000 (+0100) Subject: zebra: netlink backend support setting a P-t-P address X-Git-Tag: frr-4.0-dev~358^2~7 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=e8d19a05075a1f291bcfc9f86ff9aac8adbc01cc;p=mirror%2Ffrr.git zebra: netlink backend support setting a P-t-P address add a few bits to properly set a pointopoint address via netlink. the structures have all the neccessary support, just need to send the proper message bits to the kernel. Signed-off-by: David Lamparter --- diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index 0d08155178..329f7ee578 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -830,18 +830,24 @@ static int 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; addattr_l(&req.n, sizeof req, IFA_LOCAL, &p->u.prefix, bytelen); - if (family == AF_INET && cmd == RTM_NEWADDR) { - if (!CONNECTED_PEER(ifc) && ifc->destination) { + if (family == AF_INET) { + if (CONNECTED_PEER(ifc)) { + p = ifc->destination; + 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);