]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: netlink backend support setting a P-t-P address
authorDavid Lamparter <equinox@diac24.net>
Wed, 20 Jan 2010 17:27:16 +0000 (18:27 +0100)
committerDavid Lamparter <equinox@opensourcerouting.org>
Sun, 27 Aug 2017 21:40:34 +0000 (23:40 +0200)
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>
zebra/if_netlink.c

index 0d081551785b47c64474b6afacd33fabf4fa5ef8..329f7ee5789fa8069884ce2f4f77affc9c96e296 100644 (file)
@@ -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);