From e8d19a05075a1f291bcfc9f86ff9aac8adbc01cc Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Wed, 20 Jan 2010 18:27:16 +0100 Subject: [PATCH] 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 --- zebra/if_netlink.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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); -- 2.39.5