summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2010-01-20 18:27:16 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2017-08-27 23:40:34 +0200
commite8d19a05075a1f291bcfc9f86ff9aac8adbc01cc (patch)
tree5653accbea34793421051ebabf5fcb3aad707da5
parenta3008857cbf5c0122dda88e178d5c4378d7e4591 (diff)
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 <equinox@opensourcerouting.org>
-rw-r--r--zebra/if_netlink.c12
1 files 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);