提交 95e41e93 编写于 作者: Y YOSHIFUJI Hideaki

[IPV6]: Make ndisc_flow_init() common for later use.

For later use, this patch is renaming ndisc_flow_init() to
icmpv6_flow_init() and putting it in common place.
Signed-off-by: NYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
上级 5e5f3f0f
...@@ -182,6 +182,14 @@ extern int icmpv6_err_convert(int type, int code, ...@@ -182,6 +182,14 @@ extern int icmpv6_err_convert(int type, int code,
extern void icmpv6_cleanup(void); extern void icmpv6_cleanup(void);
extern void icmpv6_param_prob(struct sk_buff *skb, extern void icmpv6_param_prob(struct sk_buff *skb,
int code, int pos); int code, int pos);
struct flowi;
extern void icmpv6_flow_init(struct sock *sk,
struct flowi *fl,
u8 type,
const struct in6_addr *saddr,
const struct in6_addr *daddr,
int oif);
#endif #endif
#endif #endif
...@@ -777,6 +777,22 @@ static int icmpv6_rcv(struct sk_buff *skb) ...@@ -777,6 +777,22 @@ static int icmpv6_rcv(struct sk_buff *skb)
return 0; return 0;
} }
void icmpv6_flow_init(struct sock *sk, struct flowi *fl,
u8 type,
const struct in6_addr *saddr,
const struct in6_addr *daddr,
int oif)
{
memset(fl, 0, sizeof(*fl));
ipv6_addr_copy(&fl->fl6_src, saddr);
ipv6_addr_copy(&fl->fl6_dst, daddr);
fl->proto = IPPROTO_ICMPV6;
fl->fl_icmp_type = type;
fl->fl_icmp_code = 0;
fl->oif = oif;
security_sk_classify_flow(sk, fl);
}
/* /*
* Special lock-class for __icmpv6_sk: * Special lock-class for __icmpv6_sk:
*/ */
......
...@@ -441,21 +441,6 @@ static void pndisc_destructor(struct pneigh_entry *n) ...@@ -441,21 +441,6 @@ static void pndisc_destructor(struct pneigh_entry *n)
/* /*
* Send a Neighbour Advertisement * Send a Neighbour Advertisement
*/ */
static inline void ndisc_flow_init(struct flowi *fl, u8 type,
struct in6_addr *saddr, struct in6_addr *daddr,
int oif)
{
memset(fl, 0, sizeof(*fl));
ipv6_addr_copy(&fl->fl6_src, saddr);
ipv6_addr_copy(&fl->fl6_dst, daddr);
fl->proto = IPPROTO_ICMPV6;
fl->fl_icmp_type = type;
fl->fl_icmp_code = 0;
fl->oif = oif;
security_sk_classify_flow(ndisc_socket->sk, fl);
}
static void __ndisc_send(struct net_device *dev, static void __ndisc_send(struct net_device *dev,
struct neighbour *neigh, struct neighbour *neigh,
struct in6_addr *daddr, struct in6_addr *saddr, struct in6_addr *daddr, struct in6_addr *saddr,
...@@ -474,8 +459,8 @@ static void __ndisc_send(struct net_device *dev, ...@@ -474,8 +459,8 @@ static void __ndisc_send(struct net_device *dev,
type = icmp6h->icmp6_type; type = icmp6h->icmp6_type;
ndisc_flow_init(&fl, type, saddr, daddr, icmpv6_flow_init(ndisc_socket->sk, &fl, type,
dev->ifindex); saddr, daddr, dev->ifindex);
dst = ndisc_dst_alloc(dev, neigh, daddr, ip6_output); dst = ndisc_dst_alloc(dev, neigh, daddr, ip6_output);
if (!dst) if (!dst)
...@@ -1439,8 +1424,8 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, ...@@ -1439,8 +1424,8 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
return; return;
} }
ndisc_flow_init(&fl, NDISC_REDIRECT, &saddr_buf, &ipv6_hdr(skb)->saddr, icmpv6_flow_init(ndisc_socket->sk, &fl, NDISC_REDIRECT,
dev->ifindex); &saddr_buf, &ipv6_hdr(skb)->saddr, dev->ifindex);
dst = ip6_route_output(NULL, &fl); dst = ip6_route_output(NULL, &fl);
if (dst == NULL) if (dst == NULL)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册