aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/ndisc.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/ndisc.h')
-rw-r--r--include/net/ndisc.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index ec48f42db5ed..745bf741e029 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -127,13 +127,19 @@ static int ndisc_addr_option_pad(unsigned short type)
127 } 127 }
128} 128}
129 129
130static inline int ndisc_opt_addr_space(struct net_device *dev)
131{
132 return NDISC_OPT_SPACE(dev->addr_len +
133 ndisc_addr_option_pad(dev->type));
134}
135
130static inline u8 *ndisc_opt_addr_data(struct nd_opt_hdr *p, 136static inline u8 *ndisc_opt_addr_data(struct nd_opt_hdr *p,
131 struct net_device *dev) 137 struct net_device *dev)
132{ 138{
133 u8 *lladdr = (u8 *)(p + 1); 139 u8 *lladdr = (u8 *)(p + 1);
134 int lladdrlen = p->nd_opt_len << 3; 140 int lladdrlen = p->nd_opt_len << 3;
135 int prepad = ndisc_addr_option_pad(dev->type); 141 int prepad = ndisc_addr_option_pad(dev->type);
136 if (lladdrlen != NDISC_OPT_SPACE(dev->addr_len + prepad)) 142 if (lladdrlen != ndisc_opt_addr_space(dev))
137 return NULL; 143 return NULL;
138 return lladdr + prepad; 144 return lladdr + prepad;
139} 145}