diff options
| author | paco <paco@voltanet.io> | 2018-06-20 17:15:37 +0200 | 
|---|---|---|
| committer | paco <paco@voltanet.io> | 2018-06-20 22:25:28 +0200 | 
| commit | a2b6e694b17303f3faf2db29254b5ea4a4ae14b1 (patch) | |
| tree | ce3de528becaedc5611f3b17235e915a3f5fef64 /lib/sockopt.c | |
| parent | 6e87c6e8e2481cf102c32374a6a7139031426831 (diff) | |
bgpd isisd ldpd lib ospfd pimd: redundancy (infer)
Signed-off-by: F. Aragon <paco@voltanet.io>
Diffstat (limited to 'lib/sockopt.c')
| -rw-r--r-- | lib/sockopt.c | 9 | 
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/sockopt.c b/lib/sockopt.c index 1d8d9990df..815be86c2e 100644 --- a/lib/sockopt.c +++ b/lib/sockopt.c @@ -457,8 +457,7 @@ int setsockopt_ifindex(int af, int sock, ifindex_t val)   */  static ifindex_t getsockopt_ipv4_ifindex(struct msghdr *msgh)  { -	/* XXX: initialize to zero?  (Always overwritten, so just cosmetic.) */ -	ifindex_t ifindex = -1; +	ifindex_t ifindex;  #if defined(IP_PKTINFO)  	/* Linux pktinfo based ifindex retrieval */ @@ -466,7 +465,11 @@ static ifindex_t getsockopt_ipv4_ifindex(struct msghdr *msgh)  	pktinfo = (struct in_pktinfo *)getsockopt_cmsg_data(msgh, IPPROTO_IP,  							    IP_PKTINFO); -	/* XXX Can pktinfo be NULL?  Clean up post 0.98. */ + +	/* getsockopt_ifindex() will forward this, being 0 "not found" */ +	if (pktinfo == NULL) +		return 0; +  	ifindex = pktinfo->ipi_ifindex;  #elif defined(IP_RECVIF)  | 
