Skip to contentSkip to conversation

Add ifindex field in ND user option messages

PATCH In review Pierre Ynard 2 participants 2 messages Nov 13, 2007

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add ifindex field in ND user option messages

Userland neighbor discovery options are typically heavily involved with the interface on which thay are received: add a missing ifindex field to the original struct. Thanks to Rémi Denis-Courmont.

include/linux/rtnetlink.h +2 -0
index 5bf6182..4e81836 100644
@@ -491,9 +491,11 @@ struct nduseroptmsg
 	unsigned char	nduseropt_family;
 	unsigned char	nduseropt_pad1;
 	unsigned short	nduseropt_opts_len;	/* Total length of options */
+	int		nduseropt_ifindex;
 	__u8		nduseropt_icmp_type;
 	__u8		nduseropt_icmp_code;
 	unsigned short	nduseropt_pad2;
+	unsigned int	nduseropt_pad3;
 	/* Followed by one or more ND options */
 };
 
net/ipv6/ndisc.c +1 -0
index 36f7dbf..67997a7 100644
@@ -1037,6 +1037,7 @@ static void ndisc_ra_useropt(struct sk_buff *ra, struct nd_opt_hdr *opt)
 
 	ndmsg = nlmsg_data(nlh);
 	ndmsg->nduseropt_family = AF_INET6;
+	ndmsg->nduseropt_ifindex = ra->dev->ifindex;
 	ndmsg->nduseropt_icmp_type = icmp6h->icmp6_type;
 	ndmsg->nduseropt_icmp_code = icmp6h->icmp6_code;
 	ndmsg->nduseropt_opts_len = opt->nd_opt_len << 3;
Signature · 3 lines
Pierre Ynard
For hire in Quebec City, Canada, during Fall 2007
"Une âme dans un corps, c'est comme un dessin sur une feuille de papier."
maintainer
#1 lore raw

From: Pierre Ynard <[email protected]>
Date: Tue, 13 Nov 2007 01:54:13 +0100

Quoted 5 lines

Userland neighbor discovery options are typically heavily involved with the interface on which thay are received: add a missing ifindex field to the original struct. Thanks to Rémi Denis-Courmont.

Unfortunately you cannot change the layout of a structure already exported to userspace, it is part of the ABI.

You'll need to create a new netlink attribute or similar in order to provide this information.