提交 4f36ce84 编写于 作者: A Alexander Aring 提交者: David S. Miller

ndisc: add __ndisc_opt_addr_data function

This patch adds __ndisc_opt_addr_data as low-level function for
ndisc_opt_addr_data which doesn't depend on net_device parameter.

Cc: David S. Miller <davem@davemloft.net>
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Cc: James Morris <jmorris@namei.org>
Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Cc: Patrick McHardy <kaber@trash.net>
Acked-by: NYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Reviewed-by: NStefan Schmidt <stefan@osg.samsung.com>
Signed-off-by: NAlexander Aring <aar@pengutronix.de>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 1e82f961
...@@ -138,17 +138,23 @@ static inline int ndisc_opt_addr_space(struct net_device *dev) ...@@ -138,17 +138,23 @@ static inline int ndisc_opt_addr_space(struct net_device *dev)
ndisc_addr_option_pad(dev->type)); ndisc_addr_option_pad(dev->type));
} }
static inline u8 *ndisc_opt_addr_data(struct nd_opt_hdr *p, static inline u8 *__ndisc_opt_addr_data(struct nd_opt_hdr *p,
struct net_device *dev) unsigned char addr_len, int prepad)
{ {
u8 *lladdr = (u8 *)(p + 1); u8 *lladdr = (u8 *)(p + 1);
int lladdrlen = p->nd_opt_len << 3; int lladdrlen = p->nd_opt_len << 3;
int prepad = ndisc_addr_option_pad(dev->type); if (lladdrlen != __ndisc_opt_addr_space(addr_len, prepad))
if (lladdrlen != ndisc_opt_addr_space(dev))
return NULL; return NULL;
return lladdr + prepad; return lladdr + prepad;
} }
static inline u8 *ndisc_opt_addr_data(struct nd_opt_hdr *p,
struct net_device *dev)
{
return __ndisc_opt_addr_data(p, dev->addr_len,
ndisc_addr_option_pad(dev->type));
}
static inline u32 ndisc_hashfn(const void *pkey, const struct net_device *dev, __u32 *hash_rnd) static inline u32 ndisc_hashfn(const void *pkey, const struct net_device *dev, __u32 *hash_rnd)
{ {
const u32 *p32 = pkey; const u32 *p32 = pkey;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册