diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-12-17 22:28:47 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-12-19 14:58:33 +0100 |
commit | 9ba0e5706c6206e1ba8035b2ae1aa0136f36f4bb (patch) | |
tree | 4330e4b87a46d13e464e409cfb47ba426583c78d /zebra/rt_socket.c | |
parent | zebra: Convert socket interface to use `union sockunion` (diff) | |
download | frr-9ba0e5706c6206e1ba8035b2ae1aa0136f36f4bb.tar.xz frr-9ba0e5706c6206e1ba8035b2ae1aa0136f36f4bb.zip |
zebra: Move sin6_masklen to earlier in the file
I'm going to rearrage the kernel_rtm_ipv4 and v6 functions
so the sin6_masklen needs to be moved a bit earlier.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra/rt_socket.c')
-rw-r--r-- | zebra/rt_socket.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/zebra/rt_socket.c b/zebra/rt_socket.c index 38c362a19..d5a4fcb11 100644 --- a/zebra/rt_socket.c +++ b/zebra/rt_socket.c @@ -89,6 +89,30 @@ static int kernel_rtm_add_labels(struct mpls_label_stack *nh_label, } #endif +#ifdef SIN6_LEN +/* Calculate sin6_len value for netmask socket value. */ +static int sin6_masklen(struct in6_addr mask) +{ + struct sockaddr_in6 sin6; + char *p, *lim; + int len; + + if (IN6_IS_ADDR_UNSPECIFIED(&mask)) + return sizeof(long); + + sin6.sin6_addr = mask; + len = sizeof(struct sockaddr_in6); + + lim = (char *)&sin6.sin6_addr; + p = lim + sizeof(sin6.sin6_addr); + + while (*--p == 0 && p >= lim) + len--; + + return len; +} +#endif /* SIN6_LEN */ + /* Interface between zebra message and rtm message. */ static int kernel_rtm_ipv4(int cmd, const struct prefix *p, const struct nexthop_group *ng, uint32_t metric) @@ -253,30 +277,6 @@ static int kernel_rtm_ipv4(int cmd, const struct prefix *p, return 0; /*XXX*/ } -#ifdef SIN6_LEN -/* Calculate sin6_len value for netmask socket value. */ -static int sin6_masklen(struct in6_addr mask) -{ - struct sockaddr_in6 sin6; - char *p, *lim; - int len; - - if (IN6_IS_ADDR_UNSPECIFIED(&mask)) - return sizeof(long); - - sin6.sin6_addr = mask; - len = sizeof(struct sockaddr_in6); - - lim = (char *)&sin6.sin6_addr; - p = lim + sizeof(sin6.sin6_addr); - - while (*--p == 0 && p >= lim) - len--; - - return len; -} -#endif /* SIN6_LEN */ - /* Interface between zebra message and rtm message. */ static int kernel_rtm_ipv6(int cmd, const struct prefix *p, const struct nexthop_group *ng, uint32_t metric) |