aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/ndisc.h
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org>2013-01-21 01:47:56 -0500
committerDavid S. Miller <davem@davemloft.net>2013-01-21 13:33:14 -0500
commitc558e9fca876d6d0463a7c337d2291774b9c6f96 (patch)
tree1ecd7e3bd777851a7e3ba4640111098a2a974a35 /include/net/ndisc.h
parent315ff09dbaebc6061948102d7ed8781d4ee46f36 (diff)
ndisc: Move ndisc_opt_addr_space() to include/net/ndisc.h.
This also makes ndisc_opt_addr_data() and ndisc_fill_addr_option() use ndisc_opt_addr_space(). Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
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}