]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: add function to get iface link-local
authorQuentin Young <qlyoung@cumulusnetworks.com>
Fri, 25 Jan 2019 21:48:17 +0000 (21:48 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Fri, 17 May 2019 00:27:08 +0000 (00:27 +0000)
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
lib/if.c
lib/if.h

index 8888411903b5b29822e91a6a81f3a250cc39d921..3f489e0c3e054875970746de1ddb75d48e563647 100644 (file)
--- a/lib/if.c
+++ b/lib/if.c
@@ -904,6 +904,19 @@ struct connected *connected_add_by_prefix(struct interface *ifp,
        return ifc;
 }
 
+struct connected *connected_get_linklocal(struct interface *ifp)
+{
+       struct listnode *n;
+       struct connected *c = NULL;
+
+       for (ALL_LIST_ELEMENTS_RO(ifp->connected, n, c)) {
+               if (c->address->family == AF_INET6
+                   && IN6_IS_ADDR_LINKLOCAL(&c->address->u.prefix6))
+                       break;
+       }
+       return c;
+}
+
 #if 0  /* this route_table of struct connected's is unused                     \
        * however, it would be good to use a route_table rather than           \
        * a list..                                                             \
index a98f907c5c4f22a0f4458e2789137dedc81e840d..ef596d45dc00035ad8f6e490bcaff241733e5de1 100644 (file)
--- a/lib/if.h
+++ b/lib/if.h
@@ -542,6 +542,7 @@ extern struct connected *connected_lookup_prefix_exact(struct interface *,
 extern struct nbr_connected *nbr_connected_new(void);
 extern void nbr_connected_free(struct nbr_connected *);
 struct nbr_connected *nbr_connected_check(struct interface *, struct prefix *);
+struct connected *connected_get_linklocal(struct interface *ifp);
 
 /* link parameters */
 struct if_link_params *if_link_params_get(struct interface *);