diff options
author | Donald Sharp <sharpd@nvidia.com> | 2020-10-29 11:59:42 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@nvidia.com> | 2020-10-29 12:01:40 +0100 |
commit | b66ec22ca9b227c4b7f78f71918be7eff30fb552 (patch) | |
tree | 7a6c3ee4d3bc8db5eeee484c8218da3ae49bd7b0 /ospf6d/ospf6_network.c | |
parent | ospf6d: Clean up ospf6_network.h header (diff) | |
download | frr-b66ec22ca9b227c4b7f78f71918be7eff30fb552.tar.xz frr-b66ec22ca9b227c4b7f78f71918be7eff30fb552.zip |
ospf6d: ifindex should not be a pointer for ospf6_sendmsg
Let's cleanup the ospf6_sendmsg api and not pass in a pointer
to the ifindex to use. It's an integer.
Also remove the assert(*ifindex); We never use ifindex of 0
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'ospf6d/ospf6_network.c')
-rw-r--r-- | ospf6d/ospf6_network.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/ospf6d/ospf6_network.c b/ospf6d/ospf6_network.c index 6c83881bf..43b6d08b5 100644 --- a/ospf6d/ospf6_network.c +++ b/ospf6d/ospf6_network.c @@ -171,7 +171,7 @@ static int iov_totallen(struct iovec *iov) } int ospf6_sendmsg(struct in6_addr *src, struct in6_addr *dst, - ifindex_t *ifindex, struct iovec *message, int ospf6_sock) + ifindex_t ifindex, struct iovec *message, int ospf6_sock) { int retval; struct msghdr smsghdr; @@ -184,7 +184,6 @@ int ospf6_sendmsg(struct in6_addr *src, struct in6_addr *dst, struct sockaddr_in6 dst_sin6; assert(dst); - assert(*ifindex); memset(&cmsgbuf, 0, sizeof(cmsgbuf)); scmsgp = (struct cmsghdr *)&cmsgbuf; @@ -192,7 +191,7 @@ int ospf6_sendmsg(struct in6_addr *src, struct in6_addr *dst, memset(&dst_sin6, 0, sizeof(struct sockaddr_in6)); /* source address */ - pktinfo->ipi6_ifindex = *ifindex; + pktinfo->ipi6_ifindex = ifindex; if (src) memcpy(&pktinfo->ipi6_addr, src, sizeof(struct in6_addr)); else @@ -204,7 +203,7 @@ int ospf6_sendmsg(struct in6_addr *src, struct in6_addr *dst, dst_sin6.sin6_len = sizeof(struct sockaddr_in6); #endif /*SIN6_LEN*/ memcpy(&dst_sin6.sin6_addr, dst, sizeof(struct in6_addr)); - dst_sin6.sin6_scope_id = *ifindex; + dst_sin6.sin6_scope_id = ifindex; /* send control msg */ scmsgp->cmsg_level = IPPROTO_IPV6; @@ -223,7 +222,7 @@ int ospf6_sendmsg(struct in6_addr *src, struct in6_addr *dst, retval = sendmsg(ospf6_sock, &smsghdr, 0); if (retval != iov_totallen(message)) - zlog_warn("sendmsg failed: ifindex: %d: %s (%d)", *ifindex, + zlog_warn("sendmsg failed: ifindex: %d: %s (%d)", ifindex, safe_strerror(errno), errno); return retval; |