You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
ipv6: Convert to use flowi6 where applicable.
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@@ -231,28 +231,28 @@ static int addr6_resolve(struct sockaddr_in6 *src_in,
|
||||
struct sockaddr_in6 *dst_in,
|
||||
struct rdma_dev_addr *addr)
|
||||
{
|
||||
struct flowi fl;
|
||||
struct flowi6 fl6;
|
||||
struct neighbour *neigh;
|
||||
struct dst_entry *dst;
|
||||
int ret;
|
||||
|
||||
memset(&fl, 0, sizeof fl);
|
||||
ipv6_addr_copy(&fl.fl6_dst, &dst_in->sin6_addr);
|
||||
ipv6_addr_copy(&fl.fl6_src, &src_in->sin6_addr);
|
||||
fl.flowi_oif = addr->bound_dev_if;
|
||||
memset(&fl6, 0, sizeof fl6);
|
||||
ipv6_addr_copy(&fl6.daddr, &dst_in->sin6_addr);
|
||||
ipv6_addr_copy(&fl6.saddr, &src_in->sin6_addr);
|
||||
fl6.flowi6_oif = addr->bound_dev_if;
|
||||
|
||||
dst = ip6_route_output(&init_net, NULL, &fl);
|
||||
dst = ip6_route_output(&init_net, NULL, &fl6);
|
||||
if ((ret = dst->error))
|
||||
goto put;
|
||||
|
||||
if (ipv6_addr_any(&fl.fl6_src)) {
|
||||
if (ipv6_addr_any(&fl6.saddr)) {
|
||||
ret = ipv6_dev_get_saddr(&init_net, ip6_dst_idev(dst)->dev,
|
||||
&fl.fl6_dst, 0, &fl.fl6_src);
|
||||
&fl6.daddr, 0, &fl6.saddr);
|
||||
if (ret)
|
||||
goto put;
|
||||
|
||||
src_in->sin6_family = AF_INET6;
|
||||
ipv6_addr_copy(&src_in->sin6_addr, &fl.fl6_src);
|
||||
ipv6_addr_copy(&src_in->sin6_addr, &fl6.saddr);
|
||||
}
|
||||
|
||||
if (dst->dev->flags & IFF_LOOPBACK) {
|
||||
|
||||
+6
-6
@@ -3424,14 +3424,14 @@ static int cnic_get_v6_route(struct sockaddr_in6 *dst_addr,
|
||||
struct dst_entry **dst)
|
||||
{
|
||||
#if defined(CONFIG_IPV6) || (defined(CONFIG_IPV6_MODULE) && defined(MODULE))
|
||||
struct flowi fl;
|
||||
struct flowi6 fl6;
|
||||
|
||||
memset(&fl, 0, sizeof(fl));
|
||||
ipv6_addr_copy(&fl.fl6_dst, &dst_addr->sin6_addr);
|
||||
if (ipv6_addr_type(&fl.fl6_dst) & IPV6_ADDR_LINKLOCAL)
|
||||
fl.flowi_oif = dst_addr->sin6_scope_id;
|
||||
memset(&fl6, 0, sizeof(fl6));
|
||||
ipv6_addr_copy(&fl6.daddr, &dst_addr->sin6_addr);
|
||||
if (ipv6_addr_type(&fl6.daddr) & IPV6_ADDR_LINKLOCAL)
|
||||
fl6.flowi6_oif = dst_addr->sin6_scope_id;
|
||||
|
||||
*dst = ip6_route_output(&init_net, NULL, &fl);
|
||||
*dst = ip6_route_output(&init_net, NULL, &fl6);
|
||||
if (*dst)
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
@@ -183,10 +183,10 @@ extern void icmpv6_cleanup(void);
|
||||
extern void icmpv6_param_prob(struct sk_buff *skb,
|
||||
u8 code, int pos);
|
||||
|
||||
struct flowi;
|
||||
struct flowi6;
|
||||
struct in6_addr;
|
||||
extern void icmpv6_flow_init(struct sock *sk,
|
||||
struct flowi *fl,
|
||||
struct flowi6 *fl6,
|
||||
u8 type,
|
||||
const struct in6_addr *saddr,
|
||||
const struct in6_addr *daddr,
|
||||
|
||||
@@ -183,7 +183,7 @@ struct fib6_table {
|
||||
|
||||
typedef struct rt6_info *(*pol_lookup_t)(struct net *,
|
||||
struct fib6_table *,
|
||||
struct flowi *, int);
|
||||
struct flowi6 *, int);
|
||||
|
||||
/*
|
||||
* exported functions
|
||||
@@ -192,7 +192,7 @@ typedef struct rt6_info *(*pol_lookup_t)(struct net *,
|
||||
extern struct fib6_table *fib6_get_table(struct net *net, u32 id);
|
||||
extern struct fib6_table *fib6_new_table(struct net *net, u32 id);
|
||||
extern struct dst_entry *fib6_rule_lookup(struct net *net,
|
||||
struct flowi *fl, int flags,
|
||||
struct flowi6 *fl6, int flags,
|
||||
pol_lookup_t lookup);
|
||||
|
||||
extern struct fib6_node *fib6_lookup(struct fib6_node *root,
|
||||
|
||||
@@ -71,7 +71,7 @@ extern void ip6_route_input(struct sk_buff *skb);
|
||||
|
||||
extern struct dst_entry * ip6_route_output(struct net *net,
|
||||
struct sock *sk,
|
||||
struct flowi *fl);
|
||||
struct flowi6 *fl6);
|
||||
|
||||
extern int ip6_route_init(void);
|
||||
extern void ip6_route_cleanup(void);
|
||||
|
||||
+8
-8
@@ -492,7 +492,7 @@ extern int ip6_rcv_finish(struct sk_buff *skb);
|
||||
*/
|
||||
extern int ip6_xmit(struct sock *sk,
|
||||
struct sk_buff *skb,
|
||||
struct flowi *fl,
|
||||
struct flowi6 *fl6,
|
||||
struct ipv6_txoptions *opt);
|
||||
|
||||
extern int ip6_nd_hdr(struct sock *sk,
|
||||
@@ -512,7 +512,7 @@ extern int ip6_append_data(struct sock *sk,
|
||||
int hlimit,
|
||||
int tclass,
|
||||
struct ipv6_txoptions *opt,
|
||||
struct flowi *fl,
|
||||
struct flowi6 *fl6,
|
||||
struct rt6_info *rt,
|
||||
unsigned int flags,
|
||||
int dontfrag);
|
||||
@@ -523,13 +523,13 @@ extern void ip6_flush_pending_frames(struct sock *sk);
|
||||
|
||||
extern int ip6_dst_lookup(struct sock *sk,
|
||||
struct dst_entry **dst,
|
||||
struct flowi *fl);
|
||||
struct flowi6 *fl6);
|
||||
extern struct dst_entry * ip6_dst_lookup_flow(struct sock *sk,
|
||||
struct flowi *fl,
|
||||
struct flowi6 *fl6,
|
||||
const struct in6_addr *final_dst,
|
||||
bool can_sleep);
|
||||
extern struct dst_entry * ip6_sk_dst_lookup_flow(struct sock *sk,
|
||||
struct flowi *fl,
|
||||
struct flowi6 *fl6,
|
||||
const struct in6_addr *final_dst,
|
||||
bool can_sleep);
|
||||
extern struct dst_entry * ip6_blackhole_route(struct net *net,
|
||||
@@ -566,7 +566,7 @@ extern int ipv6_ext_hdr(u8 nexthdr);
|
||||
|
||||
extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type);
|
||||
|
||||
extern struct in6_addr *fl6_update_dst(struct flowi *fl,
|
||||
extern struct in6_addr *fl6_update_dst(struct flowi6 *fl6,
|
||||
const struct ipv6_txoptions *opt,
|
||||
struct in6_addr *orig);
|
||||
|
||||
@@ -600,8 +600,8 @@ extern int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len);
|
||||
extern int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len);
|
||||
extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port,
|
||||
u32 info, u8 *payload);
|
||||
extern void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info);
|
||||
extern void ipv6_local_rxpmtu(struct sock *sk, struct flowi *fl, u32 mtu);
|
||||
extern void ipv6_local_error(struct sock *sk, int err, struct flowi6 *fl6, u32 info);
|
||||
extern void ipv6_local_rxpmtu(struct sock *sk, struct flowi6 *fl6, u32 mtu);
|
||||
|
||||
extern int inet6_release(struct socket *sock);
|
||||
extern int inet6_bind(struct socket *sock, struct sockaddr *uaddr,
|
||||
|
||||
@@ -14,7 +14,7 @@ extern struct proto udpv6_prot;
|
||||
extern struct proto udplitev6_prot;
|
||||
extern struct proto tcpv6_prot;
|
||||
|
||||
struct flowi;
|
||||
struct flowi6;
|
||||
|
||||
/* extention headers */
|
||||
extern int ipv6_exthdrs_init(void);
|
||||
@@ -42,7 +42,7 @@ extern int datagram_recv_ctl(struct sock *sk,
|
||||
|
||||
extern int datagram_send_ctl(struct net *net,
|
||||
struct msghdr *msg,
|
||||
struct flowi *fl,
|
||||
struct flowi6 *fl6,
|
||||
struct ipv6_txoptions *opt,
|
||||
int *hlimit, int *tclass,
|
||||
int *dontfrag);
|
||||
|
||||
+63
-63
@@ -147,22 +147,22 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
|
||||
dst = __sk_dst_check(sk, np->dst_cookie);
|
||||
if (dst == NULL) {
|
||||
struct inet_sock *inet = inet_sk(sk);
|
||||
struct flowi fl;
|
||||
struct flowi6 fl6;
|
||||
|
||||
/* BUGGG_FUTURE: Again, it is not clear how
|
||||
to handle rthdr case. Ignore this complexity
|
||||
for now.
|
||||
*/
|
||||
memset(&fl, 0, sizeof(fl));
|
||||
fl.flowi_proto = IPPROTO_DCCP;
|
||||
ipv6_addr_copy(&fl.fl6_dst, &np->daddr);
|
||||
ipv6_addr_copy(&fl.fl6_src, &np->saddr);
|
||||
fl.flowi_oif = sk->sk_bound_dev_if;
|
||||
fl.fl6_dport = inet->inet_dport;
|
||||
fl.fl6_sport = inet->inet_sport;
|
||||
security_sk_classify_flow(sk, &fl);
|
||||
memset(&fl6, 0, sizeof(fl6));
|
||||
fl6.flowi6_proto = IPPROTO_DCCP;
|
||||
ipv6_addr_copy(&fl6.daddr, &np->daddr);
|
||||
ipv6_addr_copy(&fl6.saddr, &np->saddr);
|
||||
fl6.flowi6_oif = sk->sk_bound_dev_if;
|
||||
fl6.uli.ports.dport = inet->inet_dport;
|
||||
fl6.uli.ports.sport = inet->inet_sport;
|
||||
security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
|
||||
|
||||
dst = ip6_dst_lookup_flow(sk, &fl, NULL, false);
|
||||
dst = ip6_dst_lookup_flow(sk, &fl6, NULL, false);
|
||||
if (IS_ERR(dst)) {
|
||||
sk->sk_err_soft = -PTR_ERR(dst);
|
||||
goto out;
|
||||
@@ -243,25 +243,25 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req,
|
||||
struct sk_buff *skb;
|
||||
struct ipv6_txoptions *opt = NULL;
|
||||
struct in6_addr *final_p, final;
|
||||
struct flowi fl;
|
||||
struct flowi6 fl6;
|
||||
int err = -1;
|
||||
struct dst_entry *dst;
|
||||
|
||||
memset(&fl, 0, sizeof(fl));
|
||||
fl.flowi_proto = IPPROTO_DCCP;
|
||||
ipv6_addr_copy(&fl.fl6_dst, &ireq6->rmt_addr);
|
||||
ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr);
|
||||
fl.fl6_flowlabel = 0;
|
||||
fl.flowi_oif = ireq6->iif;
|
||||
fl.fl6_dport = inet_rsk(req)->rmt_port;
|
||||
fl.fl6_sport = inet_rsk(req)->loc_port;
|
||||
security_req_classify_flow(req, &fl);
|
||||
memset(&fl6, 0, sizeof(fl6));
|
||||
fl6.flowi6_proto = IPPROTO_DCCP;
|
||||
ipv6_addr_copy(&fl6.daddr, &ireq6->rmt_addr);
|
||||
ipv6_addr_copy(&fl6.saddr, &ireq6->loc_addr);
|
||||
fl6.flowlabel = 0;
|
||||
fl6.flowi6_oif = ireq6->iif;
|
||||
fl6.uli.ports.dport = inet_rsk(req)->rmt_port;
|
||||
fl6.uli.ports.sport = inet_rsk(req)->loc_port;
|
||||
security_req_classify_flow(req, flowi6_to_flowi(&fl6));
|
||||
|
||||
opt = np->opt;
|
||||
|
||||
final_p = fl6_update_dst(&fl, opt, &final);
|
||||
final_p = fl6_update_dst(&fl6, opt, &final);
|
||||
|
||||
dst = ip6_dst_lookup_flow(sk, &fl, final_p, false);
|
||||
dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false);
|
||||
if (IS_ERR(dst)) {
|
||||
err = PTR_ERR(dst);
|
||||
dst = NULL;
|
||||
@@ -275,8 +275,8 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req,
|
||||
dh->dccph_checksum = dccp_v6_csum_finish(skb,
|
||||
&ireq6->loc_addr,
|
||||
&ireq6->rmt_addr);
|
||||
ipv6_addr_copy(&fl.fl6_dst, &ireq6->rmt_addr);
|
||||
err = ip6_xmit(sk, skb, &fl, opt);
|
||||
ipv6_addr_copy(&fl6.daddr, &ireq6->rmt_addr);
|
||||
err = ip6_xmit(sk, skb, &fl6, opt);
|
||||
err = net_xmit_eval(err);
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
|
||||
{
|
||||
struct ipv6hdr *rxip6h;
|
||||
struct sk_buff *skb;
|
||||
struct flowi fl;
|
||||
struct flowi6 fl6;
|
||||
struct net *net = dev_net(skb_dst(rxskb)->dev);
|
||||
struct sock *ctl_sk = net->dccp.v6_ctl_sk;
|
||||
struct dst_entry *dst;
|
||||
@@ -317,21 +317,21 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
|
||||
dccp_hdr(skb)->dccph_checksum = dccp_v6_csum_finish(skb, &rxip6h->saddr,
|
||||
&rxip6h->daddr);
|
||||
|
||||
memset(&fl, 0, sizeof(fl));
|
||||
ipv6_addr_copy(&fl.fl6_dst, &rxip6h->saddr);
|
||||
ipv6_addr_copy(&fl.fl6_src, &rxip6h->daddr);
|
||||
memset(&fl6, 0, sizeof(fl6));
|
||||
ipv6_addr_copy(&fl6.daddr, &rxip6h->saddr);
|
||||
ipv6_addr_copy(&fl6.saddr, &rxip6h->daddr);
|
||||
|
||||
fl.flowi_proto = IPPROTO_DCCP;
|
||||
fl.flowi_oif = inet6_iif(rxskb);
|
||||
fl.fl6_dport = dccp_hdr(skb)->dccph_dport;
|
||||
fl.fl6_sport = dccp_hdr(skb)->dccph_sport;
|
||||
security_skb_classify_flow(rxskb, &fl);
|
||||
fl6.flowi6_proto = IPPROTO_DCCP;
|
||||
fl6.flowi6_oif = inet6_iif(rxskb);
|
||||
fl6.uli.ports.dport = dccp_hdr(skb)->dccph_dport;
|
||||
fl6.uli.ports.sport = dccp_hdr(skb)->dccph_sport;
|
||||
security_skb_classify_flow(rxskb, flowi6_to_flowi(&fl6));
|
||||
|
||||
/* sk = NULL, but it is safe for now. RST socket required. */
|
||||
dst = ip6_dst_lookup_flow(ctl_sk, &fl, NULL, false);
|
||||
dst = ip6_dst_lookup_flow(ctl_sk, &fl6, NULL, false);
|
||||
if (!IS_ERR(dst)) {
|
||||
skb_dst_set(skb, dst);
|
||||
ip6_xmit(ctl_sk, skb, &fl, NULL);
|
||||
ip6_xmit(ctl_sk, skb, &fl6, NULL);
|
||||
DCCP_INC_STATS_BH(DCCP_MIB_OUTSEGS);
|
||||
DCCP_INC_STATS_BH(DCCP_MIB_OUTRSTS);
|
||||
return;
|
||||
@@ -527,19 +527,19 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
|
||||
|
||||
if (dst == NULL) {
|
||||
struct in6_addr *final_p, final;
|
||||
struct flowi fl;
|
||||
struct flowi6 fl6;
|
||||
|
||||
memset(&fl, 0, sizeof(fl));
|
||||
fl.flowi_proto = IPPROTO_DCCP;
|
||||
ipv6_addr_copy(&fl.fl6_dst, &ireq6->rmt_addr);
|
||||
final_p = fl6_update_dst(&fl, opt, &final);
|
||||
ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr);
|
||||
fl.flowi_oif = sk->sk_bound_dev_if;
|
||||
fl.fl6_dport = inet_rsk(req)->rmt_port;
|
||||
fl.fl6_sport = inet_rsk(req)->loc_port;
|
||||
security_sk_classify_flow(sk, &fl);
|
||||
memset(&fl6, 0, sizeof(fl6));
|
||||
fl6.flowi6_proto = IPPROTO_DCCP;
|
||||
ipv6_addr_copy(&fl6.daddr, &ireq6->rmt_addr);
|
||||
final_p = fl6_update_dst(&fl6, opt, &final);
|
||||
ipv6_addr_copy(&fl6.saddr, &ireq6->loc_addr);
|
||||
fl6.flowi6_oif = sk->sk_bound_dev_if;
|
||||
fl6.uli.ports.dport = inet_rsk(req)->rmt_port;
|
||||
fl6.uli.ports.sport = inet_rsk(req)->loc_port;
|
||||
security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
|
||||
|
||||
dst = ip6_dst_lookup_flow(sk, &fl, final_p, false);
|
||||
dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false);
|
||||
if (IS_ERR(dst))
|
||||
goto out;
|
||||
}
|
||||
@@ -859,7 +859,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
|
||||
struct ipv6_pinfo *np = inet6_sk(sk);
|
||||
struct dccp_sock *dp = dccp_sk(sk);
|
||||
struct in6_addr *saddr = NULL, *final_p, final;
|
||||
struct flowi fl;
|
||||
struct flowi6 fl6;
|
||||
struct dst_entry *dst;
|
||||
int addr_type;
|
||||
int err;
|
||||
@@ -872,14 +872,14 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
|
||||
if (usin->sin6_family != AF_INET6)
|
||||
return -EAFNOSUPPORT;
|
||||
|
||||
memset(&fl, 0, sizeof(fl));
|
||||
memset(&fl6, 0, sizeof(fl6));
|
||||
|
||||
if (np->sndflow) {
|
||||
fl.fl6_flowlabel = usin->sin6_flowinfo & IPV6_FLOWINFO_MASK;
|
||||
IP6_ECN_flow_init(fl.fl6_flowlabel);
|
||||
if (fl.fl6_flowlabel & IPV6_FLOWLABEL_MASK) {
|
||||
fl6.flowlabel = usin->sin6_flowinfo & IPV6_FLOWINFO_MASK;
|
||||
IP6_ECN_flow_init(fl6.flowlabel);
|
||||
if (fl6.flowlabel & IPV6_FLOWLABEL_MASK) {
|
||||
struct ip6_flowlabel *flowlabel;
|
||||
flowlabel = fl6_sock_lookup(sk, fl.fl6_flowlabel);
|
||||
flowlabel = fl6_sock_lookup(sk, fl6.flowlabel);
|
||||
if (flowlabel == NULL)
|
||||
return -EINVAL;
|
||||
ipv6_addr_copy(&usin->sin6_addr, &flowlabel->dst);
|
||||
@@ -916,7 +916,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
|
||||
}
|
||||
|
||||
ipv6_addr_copy(&np->daddr, &usin->sin6_addr);
|
||||
np->flow_label = fl.fl6_flowlabel;
|
||||
np->flow_label = fl6.flowlabel;
|
||||
|
||||
/*
|
||||
* DCCP over IPv4
|
||||
@@ -953,24 +953,24 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
|
||||
if (!ipv6_addr_any(&np->rcv_saddr))
|
||||
saddr = &np->rcv_saddr;
|
||||
|
||||
fl.flowi_proto = IPPROTO_DCCP;
|
||||
ipv6_addr_copy(&fl.fl6_dst, &np->daddr);
|
||||
ipv6_addr_copy(&fl.fl6_src, saddr ? saddr : &np->saddr);
|
||||
fl.flowi_oif = sk->sk_bound_dev_if;
|
||||
fl.fl6_dport = usin->sin6_port;
|
||||
fl.fl6_sport = inet->inet_sport;
|
||||
security_sk_classify_flow(sk, &fl);
|
||||
fl6.flowi6_proto = IPPROTO_DCCP;
|
||||
ipv6_addr_copy(&fl6.daddr, &np->daddr);
|
||||
ipv6_addr_copy(&fl6.saddr, saddr ? saddr : &np->saddr);
|
||||
fl6.flowi6_oif = sk->sk_bound_dev_if;
|
||||
fl6.uli.ports.dport = usin->sin6_port;
|
||||
fl6.uli.ports.sport = inet->inet_sport;
|
||||
security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
|
||||
|
||||
final_p = fl6_update_dst(&fl, np->opt, &final);
|
||||
final_p = fl6_update_dst(&fl6, np->opt, &final);
|
||||
|
||||
dst = ip6_dst_lookup_flow(sk, &fl, final_p, true);
|
||||
dst = ip6_dst_lookup_flow(sk, &fl6, final_p, true);
|
||||
if (IS_ERR(dst)) {
|
||||
err = PTR_ERR(dst);
|
||||
goto failure;
|
||||
}
|
||||
|
||||
if (saddr == NULL) {
|
||||
saddr = &fl.fl6_src;
|
||||
saddr = &fl6.saddr;
|
||||
ipv6_addr_copy(&np->rcv_saddr, saddr);
|
||||
}
|
||||
|
||||
|
||||
+13
-13
@@ -652,22 +652,22 @@ int inet6_sk_rebuild_header(struct sock *sk)
|
||||
if (dst == NULL) {
|
||||
struct inet_sock *inet = inet_sk(sk);
|
||||
struct in6_addr *final_p, final;
|
||||
struct flowi fl;
|
||||
struct flowi6 fl6;
|
||||
|
||||
memset(&fl, 0, sizeof(fl));
|
||||
fl.flowi_proto = sk->sk_protocol;
|
||||
ipv6_addr_copy(&fl.fl6_dst, &np->daddr);
|
||||
ipv6_addr_copy(&fl.fl6_src, &np->saddr);
|
||||
fl.fl6_flowlabel = np->flow_label;
|
||||
fl.flowi_oif = sk->sk_bound_dev_if;
|
||||
fl.flowi_mark = sk->sk_mark;
|
||||
fl.fl6_dport = inet->inet_dport;
|
||||
fl.fl6_sport = inet->inet_sport;
|
||||
security_sk_classify_flow(sk, &fl);
|
||||
memset(&fl6, 0, sizeof(fl6));
|
||||
fl6.flowi6_proto = sk->sk_protocol;
|
||||
ipv6_addr_copy(&fl6.daddr, &np->daddr);
|
||||
ipv6_addr_copy(&fl6.saddr, &np->saddr);
|
||||
fl6.flowlabel = np->flow_label;
|
||||
fl6.flowi6_oif = sk->sk_bound_dev_if;
|
||||
fl6.flowi6_mark = sk->sk_mark;
|
||||
fl6.uli.ports.dport = inet->inet_dport;
|
||||
fl6.uli.ports.sport = inet->inet_sport;
|
||||
security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
|
||||
|
||||
final_p = fl6_update_dst(&fl, np->opt, &final);
|
||||
final_p = fl6_update_dst(&fl6, np->opt, &final);
|
||||
|
||||
dst = ip6_dst_lookup_flow(sk, &fl, final_p, false);
|
||||
dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false);
|
||||
if (IS_ERR(dst)) {
|
||||
sk->sk_route_caps = 0;
|
||||
sk->sk_err_soft = -PTR_ERR(dst);
|
||||
|
||||
+38
-37
@@ -40,7 +40,7 @@ int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
|
||||
struct ipv6_pinfo *np = inet6_sk(sk);
|
||||
struct in6_addr *daddr, *final_p, final;
|
||||
struct dst_entry *dst;
|
||||
struct flowi fl;
|
||||
struct flowi6 fl6;
|
||||
struct ip6_flowlabel *flowlabel = NULL;
|
||||
struct ipv6_txoptions *opt;
|
||||
int addr_type;
|
||||
@@ -59,11 +59,11 @@ int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
|
||||
if (usin->sin6_family != AF_INET6)
|
||||
return -EAFNOSUPPORT;
|
||||
|
||||
memset(&fl, 0, sizeof(fl));
|
||||
memset(&fl6, 0, sizeof(fl6));
|
||||
if (np->sndflow) {
|
||||
fl.fl6_flowlabel = usin->sin6_flowinfo&IPV6_FLOWINFO_MASK;
|
||||
if (fl.fl6_flowlabel&IPV6_FLOWLABEL_MASK) {
|
||||
flowlabel = fl6_sock_lookup(sk, fl.fl6_flowlabel);
|
||||
fl6.flowlabel = usin->sin6_flowinfo&IPV6_FLOWINFO_MASK;
|
||||
if (fl6.flowlabel&IPV6_FLOWLABEL_MASK) {
|
||||
flowlabel = fl6_sock_lookup(sk, fl6.flowlabel);
|
||||
if (flowlabel == NULL)
|
||||
return -EINVAL;
|
||||
ipv6_addr_copy(&usin->sin6_addr, &flowlabel->dst);
|
||||
@@ -137,7 +137,7 @@ ipv4_connected:
|
||||
}
|
||||
|
||||
ipv6_addr_copy(&np->daddr, daddr);
|
||||
np->flow_label = fl.fl6_flowlabel;
|
||||
np->flow_label = fl6.flowlabel;
|
||||
|
||||
inet->inet_dport = usin->sin6_port;
|
||||
|
||||
@@ -146,23 +146,23 @@ ipv4_connected:
|
||||
* destination cache for it.
|
||||
*/
|
||||
|
||||
fl.flowi_proto = sk->sk_protocol;
|
||||
ipv6_addr_copy(&fl.fl6_dst, &np->daddr);
|
||||
ipv6_addr_copy(&fl.fl6_src, &np->saddr);
|
||||
fl.flowi_oif = sk->sk_bound_dev_if;
|
||||
fl.flowi_mark = sk->sk_mark;
|
||||
fl.fl6_dport = inet->inet_dport;
|
||||
fl.fl6_sport = inet->inet_sport;
|
||||
fl6.flowi6_proto = sk->sk_protocol;
|
||||
ipv6_addr_copy(&fl6.daddr, &np->daddr);
|
||||
ipv6_addr_copy(&fl6.saddr, &np->saddr);
|
||||
fl6.flowi6_oif = sk->sk_bound_dev_if;
|
||||
fl6.flowi6_mark = sk->sk_mark;
|
||||
fl6.uli.ports.dport = inet->inet_dport;
|
||||
fl6.uli.ports.sport = inet->inet_sport;
|
||||
|
||||
if (!fl.flowi_oif && (addr_type&IPV6_ADDR_MULTICAST))
|
||||
fl.flowi_oif = np->mcast_oif;
|
||||
if (!fl6.flowi6_oif && (addr_type&IPV6_ADDR_MULTICAST))
|
||||
fl6.flowi6_oif = np->mcast_oif;
|
||||
|
||||
security_sk_classify_flow(sk, &fl);
|
||||
security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
|
||||
|
||||
opt = flowlabel ? flowlabel->opt : np->opt;
|
||||
final_p = fl6_update_dst(&fl, opt, &final);
|
||||
final_p = fl6_update_dst(&fl6, opt, &final);
|
||||
|
||||
dst = ip6_dst_lookup_flow(sk, &fl, final_p, true);
|
||||
dst = ip6_dst_lookup_flow(sk, &fl6, final_p, true);
|
||||
err = 0;
|
||||
if (IS_ERR(dst)) {
|
||||
err = PTR_ERR(dst);
|
||||
@@ -172,20 +172,20 @@ ipv4_connected:
|
||||
/* source address lookup done in ip6_dst_lookup */
|
||||
|
||||
if (ipv6_addr_any(&np->saddr))
|
||||
ipv6_addr_copy(&np->saddr, &fl.fl6_src);
|
||||
ipv6_addr_copy(&np->saddr, &fl6.saddr);
|
||||
|
||||
if (ipv6_addr_any(&np->rcv_saddr)) {
|
||||
ipv6_addr_copy(&np->rcv_saddr, &fl.fl6_src);
|
||||
ipv6_addr_copy(&np->rcv_saddr, &fl6.saddr);
|
||||
inet->inet_rcv_saddr = LOOPBACK4_IPV6;
|
||||
if (sk->sk_prot->rehash)
|
||||
sk->sk_prot->rehash(sk);
|
||||
}
|
||||
|
||||
ip6_dst_store(sk, dst,
|
||||
ipv6_addr_equal(&fl.fl6_dst, &np->daddr) ?
|
||||
ipv6_addr_equal(&fl6.daddr, &np->daddr) ?
|
||||
&np->daddr : NULL,
|
||||
#ifdef CONFIG_IPV6_SUBTREES
|
||||
ipv6_addr_equal(&fl.fl6_src, &np->saddr) ?
|
||||
ipv6_addr_equal(&fl6.saddr, &np->saddr) ?
|
||||
&np->saddr :
|
||||
#endif
|
||||
NULL);
|
||||
@@ -231,7 +231,7 @@ void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err,
|
||||
kfree_skb(skb);
|
||||
}
|
||||
|
||||
void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info)
|
||||
void ipv6_local_error(struct sock *sk, int err, struct flowi6 *fl6, u32 info)
|
||||
{
|
||||
struct ipv6_pinfo *np = inet6_sk(sk);
|
||||
struct sock_exterr_skb *serr;
|
||||
@@ -250,7 +250,7 @@ void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info)
|
||||
skb_put(skb, sizeof(struct ipv6hdr));
|
||||
skb_reset_network_header(skb);
|
||||
iph = ipv6_hdr(skb);
|
||||
ipv6_addr_copy(&iph->daddr, &fl->fl6_dst);
|
||||
ipv6_addr_copy(&iph->daddr, &fl6->daddr);
|
||||
|
||||
serr = SKB_EXT_ERR(skb);
|
||||
serr->ee.ee_errno = err;
|
||||
@@ -261,7 +261,7 @@ void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info)
|
||||
serr->ee.ee_info = info;
|
||||
serr->ee.ee_data = 0;
|
||||
serr->addr_offset = (u8 *)&iph->daddr - skb_network_header(skb);
|
||||
serr->port = fl->fl6_dport;
|
||||
serr->port = fl6->uli.ports.dport;
|
||||
|
||||
__skb_pull(skb, skb_tail_pointer(skb) - skb->data);
|
||||
skb_reset_transport_header(skb);
|
||||
@@ -270,7 +270,7 @@ void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info)
|
||||
kfree_skb(skb);
|
||||
}
|
||||
|
||||
void ipv6_local_rxpmtu(struct sock *sk, struct flowi *fl, u32 mtu)
|
||||
void ipv6_local_rxpmtu(struct sock *sk, struct flowi6 *fl6, u32 mtu)
|
||||
{
|
||||
struct ipv6_pinfo *np = inet6_sk(sk);
|
||||
struct ipv6hdr *iph;
|
||||
@@ -287,7 +287,7 @@ void ipv6_local_rxpmtu(struct sock *sk, struct flowi *fl, u32 mtu)
|
||||
skb_put(skb, sizeof(struct ipv6hdr));
|
||||
skb_reset_network_header(skb);
|
||||
iph = ipv6_hdr(skb);
|
||||
ipv6_addr_copy(&iph->daddr, &fl->fl6_dst);
|
||||
ipv6_addr_copy(&iph->daddr, &fl6->daddr);
|
||||
|
||||
mtu_info = IP6CBMTU(skb);
|
||||
if (!mtu_info) {
|
||||
@@ -299,7 +299,7 @@ void ipv6_local_rxpmtu(struct sock *sk, struct flowi *fl, u32 mtu)
|
||||
mtu_info->ip6m_addr.sin6_family = AF_INET6;
|
||||
mtu_info->ip6m_addr.sin6_port = 0;
|
||||
mtu_info->ip6m_addr.sin6_flowinfo = 0;
|
||||
mtu_info->ip6m_addr.sin6_scope_id = fl->flowi_oif;
|
||||
mtu_info->ip6m_addr.sin6_scope_id = fl6->flowi6_oif;
|
||||
ipv6_addr_copy(&mtu_info->ip6m_addr.sin6_addr, &ipv6_hdr(skb)->daddr);
|
||||
|
||||
__skb_pull(skb, skb_tail_pointer(skb) - skb->data);
|
||||
@@ -593,7 +593,7 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb)
|
||||
}
|
||||
|
||||
int datagram_send_ctl(struct net *net,
|
||||
struct msghdr *msg, struct flowi *fl,
|
||||
struct msghdr *msg, struct flowi6 *fl6,
|
||||
struct ipv6_txoptions *opt,
|
||||
int *hlimit, int *tclass, int *dontfrag)
|
||||
{
|
||||
@@ -629,16 +629,17 @@ int datagram_send_ctl(struct net *net,
|
||||
src_info = (struct in6_pktinfo *)CMSG_DATA(cmsg);
|
||||
|
||||
if (src_info->ipi6_ifindex) {
|
||||
if (fl->flowi_oif && src_info->ipi6_ifindex != fl->flowi_oif)
|
||||
if (fl6->flowi6_oif &&
|
||||
src_info->ipi6_ifindex != fl6->flowi6_oif)
|
||||
return -EINVAL;
|
||||
fl->flowi_oif = src_info->ipi6_ifindex;
|
||||
fl6->flowi6_oif = src_info->ipi6_ifindex;
|
||||
}
|
||||
|
||||
addr_type = __ipv6_addr_type(&src_info->ipi6_addr);
|
||||
|
||||
rcu_read_lock();
|
||||
if (fl->flowi_oif) {
|
||||
dev = dev_get_by_index_rcu(net, fl->flowi_oif);
|
||||
if (fl6->flowi6_oif) {
|
||||
dev = dev_get_by_index_rcu(net, fl6->flowi6_oif);
|
||||
if (!dev) {
|
||||
rcu_read_unlock();
|
||||
return -ENODEV;
|
||||
@@ -654,7 +655,7 @@ int datagram_send_ctl(struct net *net,
|
||||
strict ? dev : NULL, 0))
|
||||
err = -EINVAL;
|
||||
else
|
||||
ipv6_addr_copy(&fl->fl6_src, &src_info->ipi6_addr);
|
||||
ipv6_addr_copy(&fl6->saddr, &src_info->ipi6_addr);
|
||||
}
|
||||
|
||||
rcu_read_unlock();
|
||||
@@ -671,13 +672,13 @@ int datagram_send_ctl(struct net *net,
|
||||
goto exit_f;
|
||||
}
|
||||
|
||||
if (fl->fl6_flowlabel&IPV6_FLOWINFO_MASK) {
|
||||
if ((fl->fl6_flowlabel^*(__be32 *)CMSG_DATA(cmsg))&~IPV6_FLOWINFO_MASK) {
|
||||
if (fl6->flowlabel&IPV6_FLOWINFO_MASK) {
|
||||
if ((fl6->flowlabel^*(__be32 *)CMSG_DATA(cmsg))&~IPV6_FLOWINFO_MASK) {
|
||||
err = -EINVAL;
|
||||
goto exit_f;
|
||||
}
|
||||
}
|
||||
fl->fl6_flowlabel = IPV6_FLOWINFO_MASK & *(__be32 *)CMSG_DATA(cmsg);
|
||||
fl6->flowlabel = IPV6_FLOWINFO_MASK & *(__be32 *)CMSG_DATA(cmsg);
|
||||
break;
|
||||
|
||||
case IPV6_2292HOPOPTS:
|
||||
|
||||
+6
-6
@@ -876,22 +876,22 @@ struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
|
||||
* fl6_update_dst - update flowi destination address with info given
|
||||
* by srcrt option, if any.
|
||||
*
|
||||
* @fl: flowi for which fl6_dst is to be updated
|
||||
* @fl6: flowi6 for which daddr is to be updated
|
||||
* @opt: struct ipv6_txoptions in which to look for srcrt opt
|
||||
* @orig: copy of original fl6_dst address if modified
|
||||
* @orig: copy of original daddr address if modified
|
||||
*
|
||||
* Returns NULL if no txoptions or no srcrt, otherwise returns orig
|
||||
* and initial value of fl->fl6_dst set in orig
|
||||
* and initial value of fl6->daddr set in orig
|
||||
*/
|
||||
struct in6_addr *fl6_update_dst(struct flowi *fl,
|
||||
struct in6_addr *fl6_update_dst(struct flowi6 *fl6,
|
||||
const struct ipv6_txoptions *opt,
|
||||
struct in6_addr *orig)
|
||||
{
|
||||
if (!opt || !opt->srcrt)
|
||||
return NULL;
|
||||
|
||||
ipv6_addr_copy(orig, &fl->fl6_dst);
|
||||
ipv6_addr_copy(&fl->fl6_dst, ((struct rt0_hdr *)opt->srcrt)->addr);
|
||||
ipv6_addr_copy(orig, &fl6->daddr);
|
||||
ipv6_addr_copy(&fl6->daddr, ((struct rt0_hdr *)opt->srcrt)->addr);
|
||||
return orig;
|
||||
}
|
||||
|
||||
|
||||
+11
-8
@@ -29,7 +29,7 @@ struct fib6_rule
|
||||
u8 tclass;
|
||||
};
|
||||
|
||||
struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi *fl,
|
||||
struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6,
|
||||
int flags, pol_lookup_t lookup)
|
||||
{
|
||||
struct fib_lookup_arg arg = {
|
||||
@@ -37,7 +37,8 @@ struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi *fl,
|
||||
.flags = FIB_LOOKUP_NOREF,
|
||||
};
|
||||
|
||||
fib_rules_lookup(net->ipv6.fib6_rules_ops, fl, flags, &arg);
|
||||
fib_rules_lookup(net->ipv6.fib6_rules_ops,
|
||||
flowi6_to_flowi(fl6), flags, &arg);
|
||||
|
||||
if (arg.result)
|
||||
return arg.result;
|
||||
@@ -49,6 +50,7 @@ struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi *fl,
|
||||
static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp,
|
||||
int flags, struct fib_lookup_arg *arg)
|
||||
{
|
||||
struct flowi6 *flp6 = &flp->u.ip6;
|
||||
struct rt6_info *rt = NULL;
|
||||
struct fib6_table *table;
|
||||
struct net *net = rule->fr_net;
|
||||
@@ -71,7 +73,7 @@ static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp,
|
||||
|
||||
table = fib6_get_table(net, rule->table);
|
||||
if (table)
|
||||
rt = lookup(net, table, flp, flags);
|
||||
rt = lookup(net, table, flp6, flags);
|
||||
|
||||
if (rt != net->ipv6.ip6_null_entry) {
|
||||
struct fib6_rule *r = (struct fib6_rule *)rule;
|
||||
@@ -86,14 +88,14 @@ static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp,
|
||||
|
||||
if (ipv6_dev_get_saddr(net,
|
||||
ip6_dst_idev(&rt->dst)->dev,
|
||||
&flp->fl6_dst,
|
||||
&flp6->daddr,
|
||||
rt6_flags2srcprefs(flags),
|
||||
&saddr))
|
||||
goto again;
|
||||
if (!ipv6_prefix_equal(&saddr, &r->src.addr,
|
||||
r->src.plen))
|
||||
goto again;
|
||||
ipv6_addr_copy(&flp->fl6_src, &saddr);
|
||||
ipv6_addr_copy(&flp6->saddr, &saddr);
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
@@ -113,9 +115,10 @@ out:
|
||||
static int fib6_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
|
||||
{
|
||||
struct fib6_rule *r = (struct fib6_rule *) rule;
|
||||
struct flowi6 *fl6 = &fl->u.ip6;
|
||||
|
||||
if (r->dst.plen &&
|
||||
!ipv6_prefix_equal(&fl->fl6_dst, &r->dst.addr, r->dst.plen))
|
||||
!ipv6_prefix_equal(&fl6->daddr, &r->dst.addr, r->dst.plen))
|
||||
return 0;
|
||||
|
||||
/*
|
||||
@@ -125,14 +128,14 @@ static int fib6_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
|
||||
*/
|
||||
if (r->src.plen) {
|
||||
if (flags & RT6_LOOKUP_F_HAS_SADDR) {
|
||||
if (!ipv6_prefix_equal(&fl->fl6_src, &r->src.addr,
|
||||
if (!ipv6_prefix_equal(&fl6->saddr, &r->src.addr,
|
||||
r->src.plen))
|
||||
return 0;
|
||||
} else if (!(r->common.flags & FIB_RULE_FIND_SADDR))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (r->tclass && r->tclass != ((ntohl(fl->fl6_flowlabel) >> 20) & 0xff))
|
||||
if (r->tclass && r->tclass != ((ntohl(fl6->flowlabel) >> 20) & 0xff))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
|
||||
+55
-55
@@ -158,7 +158,7 @@ static int is_ineligible(struct sk_buff *skb)
|
||||
* Check the ICMP output rate limit
|
||||
*/
|
||||
static inline bool icmpv6_xrlim_allow(struct sock *sk, u8 type,
|
||||
struct flowi *fl)
|
||||
struct flowi6 *fl6)
|
||||
{
|
||||
struct dst_entry *dst;
|
||||
struct net *net = sock_net(sk);
|
||||
@@ -177,7 +177,7 @@ static inline bool icmpv6_xrlim_allow(struct sock *sk, u8 type,
|
||||
* XXX: perhaps the expire for routing entries cloned by
|
||||
* this lookup should be more aggressive (not longer than timeout).
|
||||
*/
|
||||
dst = ip6_route_output(net, sk, fl);
|
||||
dst = ip6_route_output(net, sk, fl6);
|
||||
if (dst->error) {
|
||||
IP6_INC_STATS(net, ip6_dst_idev(dst),
|
||||
IPSTATS_MIB_OUTNOROUTES);
|
||||
@@ -217,7 +217,7 @@ static __inline__ int opt_unrec(struct sk_buff *skb, __u32 offset)
|
||||
return (*op & 0xC0) == 0x80;
|
||||
}
|
||||
|
||||
static int icmpv6_push_pending_frames(struct sock *sk, struct flowi *fl, struct icmp6hdr *thdr, int len)
|
||||
static int icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6, struct icmp6hdr *thdr, int len)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
struct icmp6hdr *icmp6h;
|
||||
@@ -233,9 +233,9 @@ static int icmpv6_push_pending_frames(struct sock *sk, struct flowi *fl, struct
|
||||
if (skb_queue_len(&sk->sk_write_queue) == 1) {
|
||||
skb->csum = csum_partial(icmp6h,
|
||||
sizeof(struct icmp6hdr), skb->csum);
|
||||
icmp6h->icmp6_cksum = csum_ipv6_magic(&fl->fl6_src,
|
||||
&fl->fl6_dst,
|
||||
len, fl->flowi_proto,
|
||||
icmp6h->icmp6_cksum = csum_ipv6_magic(&fl6->saddr,
|
||||
&fl6->daddr,
|
||||
len, fl6->flowi6_proto,
|
||||
skb->csum);
|
||||
} else {
|
||||
__wsum tmp_csum = 0;
|
||||
@@ -246,9 +246,9 @@ static int icmpv6_push_pending_frames(struct sock *sk, struct flowi *fl, struct
|
||||
|
||||
tmp_csum = csum_partial(icmp6h,
|
||||
sizeof(struct icmp6hdr), tmp_csum);
|
||||
icmp6h->icmp6_cksum = csum_ipv6_magic(&fl->fl6_src,
|
||||
&fl->fl6_dst,
|
||||
len, fl->flowi_proto,
|
||||
icmp6h->icmp6_cksum = csum_ipv6_magic(&fl6->saddr,
|
||||
&fl6->daddr,
|
||||
len, fl6->flowi6_proto,
|
||||
tmp_csum);
|
||||
}
|
||||
ip6_push_pending_frames(sk);
|
||||
@@ -301,13 +301,13 @@ static inline void mip6_addr_swap(struct sk_buff *skb) {}
|
||||
#endif
|
||||
|
||||
static struct dst_entry *icmpv6_route_lookup(struct net *net, struct sk_buff *skb,
|
||||
struct sock *sk, struct flowi *fl)
|
||||
struct sock *sk, struct flowi6 *fl6)
|
||||
{
|
||||
struct dst_entry *dst, *dst2;
|
||||
struct flowi fl2;
|
||||
struct flowi6 fl2;
|
||||
int err;
|
||||
|
||||
err = ip6_dst_lookup(sk, &dst, fl);
|
||||
err = ip6_dst_lookup(sk, &dst, fl6);
|
||||
if (err)
|
||||
return ERR_PTR(err);
|
||||
|
||||
@@ -324,7 +324,7 @@ static struct dst_entry *icmpv6_route_lookup(struct net *net, struct sk_buff *sk
|
||||
/* No need to clone since we're just using its address. */
|
||||
dst2 = dst;
|
||||
|
||||
dst = xfrm_lookup(net, dst, fl, sk, 0);
|
||||
dst = xfrm_lookup(net, dst, flowi6_to_flowi(fl6), sk, 0);
|
||||
if (!IS_ERR(dst)) {
|
||||
if (dst != dst2)
|
||||
return dst;
|
||||
@@ -335,7 +335,7 @@ static struct dst_entry *icmpv6_route_lookup(struct net *net, struct sk_buff *sk
|
||||
return dst;
|
||||
}
|
||||
|
||||
err = xfrm_decode_session_reverse(skb, &fl2, AF_INET6);
|
||||
err = xfrm_decode_session_reverse(skb, flowi6_to_flowi(&fl2), AF_INET6);
|
||||
if (err)
|
||||
goto relookup_failed;
|
||||
|
||||
@@ -343,7 +343,7 @@ static struct dst_entry *icmpv6_route_lookup(struct net *net, struct sk_buff *sk
|
||||
if (err)
|
||||
goto relookup_failed;
|
||||
|
||||
dst2 = xfrm_lookup(net, dst2, &fl2, sk, XFRM_LOOKUP_ICMP);
|
||||
dst2 = xfrm_lookup(net, dst2, flowi6_to_flowi(&fl2), sk, XFRM_LOOKUP_ICMP);
|
||||
if (!IS_ERR(dst2)) {
|
||||
dst_release(dst);
|
||||
dst = dst2;
|
||||
@@ -375,7 +375,7 @@ void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
|
||||
struct in6_addr *saddr = NULL;
|
||||
struct dst_entry *dst;
|
||||
struct icmp6hdr tmp_hdr;
|
||||
struct flowi fl;
|
||||
struct flowi6 fl6;
|
||||
struct icmpv6_msg msg;
|
||||
int iif = 0;
|
||||
int addr_type = 0;
|
||||
@@ -442,22 +442,22 @@ void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
|
||||
|
||||
mip6_addr_swap(skb);
|
||||
|
||||
memset(&fl, 0, sizeof(fl));
|
||||
fl.flowi_proto = IPPROTO_ICMPV6;
|
||||
ipv6_addr_copy(&fl.fl6_dst, &hdr->saddr);
|
||||
memset(&fl6, 0, sizeof(fl6));
|
||||
fl6.flowi6_proto = IPPROTO_ICMPV6;
|
||||
ipv6_addr_copy(&fl6.daddr, &hdr->saddr);
|
||||
if (saddr)
|
||||
ipv6_addr_copy(&fl.fl6_src, saddr);
|
||||
fl.flowi_oif = iif;
|
||||
fl.fl6_icmp_type = type;
|
||||
fl.fl6_icmp_code = code;
|
||||
security_skb_classify_flow(skb, &fl);
|
||||
ipv6_addr_copy(&fl6.saddr, saddr);
|
||||
fl6.flowi6_oif = iif;
|
||||
fl6.uli.icmpt.type = type;
|
||||
fl6.uli.icmpt.code = code;
|
||||
security_skb_classify_flow(skb, flowi6_to_flowi(&fl6));
|
||||
|
||||
sk = icmpv6_xmit_lock(net);
|
||||
if (sk == NULL)
|
||||
return;
|
||||
np = inet6_sk(sk);
|
||||
|
||||
if (!icmpv6_xrlim_allow(sk, type, &fl))
|
||||
if (!icmpv6_xrlim_allow(sk, type, &fl6))
|
||||
goto out;
|
||||
|
||||
tmp_hdr.icmp6_type = type;
|
||||
@@ -465,14 +465,14 @@ void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
|
||||
tmp_hdr.icmp6_cksum = 0;
|
||||
tmp_hdr.icmp6_pointer = htonl(info);
|
||||
|
||||
if (!fl.flowi_oif && ipv6_addr_is_multicast(&fl.fl6_dst))
|
||||
fl.flowi_oif = np->mcast_oif;
|
||||
if (!fl6.flowi6_oif && ipv6_addr_is_multicast(&fl6.daddr))
|
||||
fl6.flowi6_oif = np->mcast_oif;
|
||||
|
||||
dst = icmpv6_route_lookup(net, skb, sk, &fl);
|
||||
dst = icmpv6_route_lookup(net, skb, sk, &fl6);
|
||||
if (IS_ERR(dst))
|
||||
goto out;
|
||||
|
||||
if (ipv6_addr_is_multicast(&fl.fl6_dst))
|
||||
if (ipv6_addr_is_multicast(&fl6.daddr))
|
||||
hlimit = np->mcast_hops;
|
||||
else
|
||||
hlimit = np->hop_limit;
|
||||
@@ -495,14 +495,14 @@ void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
|
||||
err = ip6_append_data(sk, icmpv6_getfrag, &msg,
|
||||
len + sizeof(struct icmp6hdr),
|
||||
sizeof(struct icmp6hdr), hlimit,
|
||||
np->tclass, NULL, &fl, (struct rt6_info*)dst,
|
||||
np->tclass, NULL, &fl6, (struct rt6_info*)dst,
|
||||
MSG_DONTWAIT, np->dontfrag);
|
||||
if (err) {
|
||||
ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTERRORS);
|
||||
ip6_flush_pending_frames(sk);
|
||||
goto out_put;
|
||||
}
|
||||
err = icmpv6_push_pending_frames(sk, &fl, &tmp_hdr, len + sizeof(struct icmp6hdr));
|
||||
err = icmpv6_push_pending_frames(sk, &fl6, &tmp_hdr, len + sizeof(struct icmp6hdr));
|
||||
|
||||
out_put:
|
||||
if (likely(idev != NULL))
|
||||
@@ -524,7 +524,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
|
||||
struct in6_addr *saddr = NULL;
|
||||
struct icmp6hdr *icmph = icmp6_hdr(skb);
|
||||
struct icmp6hdr tmp_hdr;
|
||||
struct flowi fl;
|
||||
struct flowi6 fl6;
|
||||
struct icmpv6_msg msg;
|
||||
struct dst_entry *dst;
|
||||
int err = 0;
|
||||
@@ -538,31 +538,31 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
|
||||
memcpy(&tmp_hdr, icmph, sizeof(tmp_hdr));
|
||||
tmp_hdr.icmp6_type = ICMPV6_ECHO_REPLY;
|
||||
|
||||
memset(&fl, 0, sizeof(fl));
|
||||
fl.flowi_proto = IPPROTO_ICMPV6;
|
||||
ipv6_addr_copy(&fl.fl6_dst, &ipv6_hdr(skb)->saddr);
|
||||
memset(&fl6, 0, sizeof(fl6));
|
||||
fl6.flowi6_proto = IPPROTO_ICMPV6;
|
||||
ipv6_addr_copy(&fl6.daddr, &ipv6_hdr(skb)->saddr);
|
||||
if (saddr)
|
||||
ipv6_addr_copy(&fl.fl6_src, saddr);
|
||||
fl.flowi_oif = skb->dev->ifindex;
|
||||
fl.fl6_icmp_type = ICMPV6_ECHO_REPLY;
|
||||
security_skb_classify_flow(skb, &fl);
|
||||
ipv6_addr_copy(&fl6.saddr, saddr);
|
||||
fl6.flowi6_oif = skb->dev->ifindex;
|
||||
fl6.uli.icmpt.type = ICMPV6_ECHO_REPLY;
|
||||
security_skb_classify_flow(skb, flowi6_to_flowi(&fl6));
|
||||
|
||||
sk = icmpv6_xmit_lock(net);
|
||||
if (sk == NULL)
|
||||
return;
|
||||
np = inet6_sk(sk);
|
||||
|
||||
if (!fl.flowi_oif && ipv6_addr_is_multicast(&fl.fl6_dst))
|
||||
fl.flowi_oif = np->mcast_oif;
|
||||
if (!fl6.flowi6_oif && ipv6_addr_is_multicast(&fl6.daddr))
|
||||
fl6.flowi6_oif = np->mcast_oif;
|
||||
|
||||
err = ip6_dst_lookup(sk, &dst, &fl);
|
||||
err = ip6_dst_lookup(sk, &dst, &fl6);
|
||||
if (err)
|
||||
goto out;
|
||||
dst = xfrm_lookup(net, dst, &fl, sk, 0);
|
||||
dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), sk, 0);
|
||||
if (IS_ERR(dst))
|
||||
goto out;
|
||||
|
||||
if (ipv6_addr_is_multicast(&fl.fl6_dst))
|
||||
if (ipv6_addr_is_multicast(&fl6.daddr))
|
||||
hlimit = np->mcast_hops;
|
||||
else
|
||||
hlimit = np->hop_limit;
|
||||
@@ -576,7 +576,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
|
||||
msg.type = ICMPV6_ECHO_REPLY;
|
||||
|
||||
err = ip6_append_data(sk, icmpv6_getfrag, &msg, skb->len + sizeof(struct icmp6hdr),
|
||||
sizeof(struct icmp6hdr), hlimit, np->tclass, NULL, &fl,
|
||||
sizeof(struct icmp6hdr), hlimit, np->tclass, NULL, &fl6,
|
||||
(struct rt6_info*)dst, MSG_DONTWAIT,
|
||||
np->dontfrag);
|
||||
|
||||
@@ -585,7 +585,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
|
||||
ip6_flush_pending_frames(sk);
|
||||
goto out_put;
|
||||
}
|
||||
err = icmpv6_push_pending_frames(sk, &fl, &tmp_hdr, skb->len + sizeof(struct icmp6hdr));
|
||||
err = icmpv6_push_pending_frames(sk, &fl6, &tmp_hdr, skb->len + sizeof(struct icmp6hdr));
|
||||
|
||||
out_put:
|
||||
if (likely(idev != NULL))
|
||||
@@ -784,20 +784,20 @@ drop_no_count:
|
||||
return 0;
|
||||
}
|
||||
|
||||
void icmpv6_flow_init(struct sock *sk, struct flowi *fl,
|
||||
void icmpv6_flow_init(struct sock *sk, struct flowi6 *fl6,
|
||||
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->flowi_proto = IPPROTO_ICMPV6;
|
||||
fl->fl6_icmp_type = type;
|
||||
fl->fl6_icmp_code = 0;
|
||||
fl->flowi_oif = oif;
|
||||
security_sk_classify_flow(sk, fl);
|
||||
memset(fl6, 0, sizeof(*fl6));
|
||||
ipv6_addr_copy(&fl6->saddr, saddr);
|
||||
ipv6_addr_copy(&fl6->daddr, daddr);
|
||||
fl6->flowi6_proto = IPPROTO_ICMPV6;
|
||||
fl6->uli.icmpt.type = type;
|
||||
fl6->uli.icmpt.code = 0;
|
||||
fl6->flowi6_oif = oif;
|
||||
security_sk_classify_flow(sk, flowi6_to_flowi(fl6));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -61,20 +61,20 @@ struct dst_entry *inet6_csk_route_req(struct sock *sk,
|
||||
struct ipv6_pinfo *np = inet6_sk(sk);
|
||||
struct in6_addr *final_p, final;
|
||||
struct dst_entry *dst;
|
||||
struct flowi fl;
|
||||
struct flowi6 fl6;
|
||||
|
||||
memset(&fl, 0, sizeof(fl));
|
||||
fl.flowi_proto = IPPROTO_TCP;
|
||||
ipv6_addr_copy(&fl.fl6_dst, &treq->rmt_addr);
|
||||
final_p = fl6_update_dst(&fl, np->opt, &final);
|
||||
ipv6_addr_copy(&fl.fl6_src, &treq->loc_addr);
|
||||
fl.flowi_oif = sk->sk_bound_dev_if;
|
||||
fl.flowi_mark = sk->sk_mark;
|
||||
fl.fl6_dport = inet_rsk(req)->rmt_port;
|
||||
fl.fl6_sport = inet_rsk(req)->loc_port;
|
||||
security_req_classify_flow(req, &fl);
|
||||
memset(&fl6, 0, sizeof(fl6));
|
||||
fl6.flowi6_proto = IPPROTO_TCP;
|
||||
ipv6_addr_copy(&fl6.daddr, &treq->rmt_addr);
|
||||
final_p = fl6_update_dst(&fl6, np->opt, &final);
|
||||
ipv6_addr_copy(&fl6.saddr, &treq->loc_addr);
|
||||
fl6.flowi6_oif = sk->sk_bound_dev_if;
|
||||
fl6.flowi6_mark = sk->sk_mark;
|
||||
fl6.uli.ports.dport = inet_rsk(req)->rmt_port;
|
||||
fl6.uli.ports.sport = inet_rsk(req)->loc_port;
|
||||
security_req_classify_flow(req, flowi6_to_flowi(&fl6));
|
||||
|
||||
dst = ip6_dst_lookup_flow(sk, &fl, final_p, false);
|
||||
dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false);
|
||||
if (IS_ERR(dst))
|
||||
return NULL;
|
||||
|
||||
@@ -208,28 +208,28 @@ int inet6_csk_xmit(struct sk_buff *skb)
|
||||
struct sock *sk = skb->sk;
|
||||
struct inet_sock *inet = inet_sk(sk);
|
||||
struct ipv6_pinfo *np = inet6_sk(sk);
|
||||
struct flowi fl;
|
||||
struct flowi6 fl6;
|
||||
struct dst_entry *dst;
|
||||
struct in6_addr *final_p, final;
|
||||
|
||||
memset(&fl, 0, sizeof(fl));
|
||||
fl.flowi_proto = sk->sk_protocol;
|
||||
ipv6_addr_copy(&fl.fl6_dst, &np->daddr);
|
||||
ipv6_addr_copy(&fl.fl6_src, &np->saddr);
|
||||
fl.fl6_flowlabel = np->flow_label;
|
||||
IP6_ECN_flow_xmit(sk, fl.fl6_flowlabel);
|
||||
fl.flowi_oif = sk->sk_bound_dev_if;
|
||||
fl.flowi_mark = sk->sk_mark;
|
||||
fl.fl6_sport = inet->inet_sport;
|
||||
fl.fl6_dport = inet->inet_dport;
|
||||
security_sk_classify_flow(sk, &fl);
|
||||
memset(&fl6, 0, sizeof(fl6));
|
||||
fl6.flowi6_proto = sk->sk_protocol;
|
||||
ipv6_addr_copy(&fl6.daddr, &np->daddr);
|
||||
ipv6_addr_copy(&fl6.saddr, &np->saddr);
|
||||
fl6.flowlabel = np->flow_label;
|
||||
IP6_ECN_flow_xmit(sk, fl6.flowlabel);
|
||||
fl6.flowi6_oif = sk->sk_bound_dev_if;
|
||||
fl6.flowi6_mark = sk->sk_mark;
|
||||
fl6.uli.ports.sport = inet->inet_sport;
|
||||
fl6.uli.ports.dport = inet->inet_dport;
|
||||
security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
|
||||
|
||||
final_p = fl6_update_dst(&fl, np->opt, &final);
|
||||
final_p = fl6_update_dst(&fl6, np->opt, &final);
|
||||
|
||||
dst = __inet6_csk_dst_check(sk, np->dst_cookie);
|
||||
|
||||
if (dst == NULL) {
|
||||
dst = ip6_dst_lookup_flow(sk, &fl, final_p, false);
|
||||
dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false);
|
||||
|
||||
if (IS_ERR(dst)) {
|
||||
sk->sk_err_soft = -PTR_ERR(dst);
|
||||
@@ -244,9 +244,9 @@ int inet6_csk_xmit(struct sk_buff *skb)
|
||||
skb_dst_set(skb, dst_clone(dst));
|
||||
|
||||
/* Restore final destination back after routing done */
|
||||
ipv6_addr_copy(&fl.fl6_dst, &np->daddr);
|
||||
ipv6_addr_copy(&fl6.daddr, &np->daddr);
|
||||
|
||||
return ip6_xmit(sk, skb, &fl, np->opt);
|
||||
return ip6_xmit(sk, skb, &fl6, np->opt);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL_GPL(inet6_csk_xmit);
|
||||
|
||||
+2
-2
@@ -260,10 +260,10 @@ struct fib6_table *fib6_get_table(struct net *net, u32 id)
|
||||
return net->ipv6.fib6_main_tbl;
|
||||
}
|
||||
|
||||
struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi *fl,
|
||||
struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6,
|
||||
int flags, pol_lookup_t lookup)
|
||||
{
|
||||
return (struct dst_entry *) lookup(net, net->ipv6.fib6_main_tbl, fl, flags);
|
||||
return (struct dst_entry *) lookup(net, net->ipv6.fib6_main_tbl, fl6, flags);
|
||||
}
|
||||
|
||||
static void __net_init fib6_tables_init(struct net *net)
|
||||
|
||||
@@ -342,7 +342,7 @@ fl_create(struct net *net, struct in6_flowlabel_req *freq, char __user *optval,
|
||||
|
||||
if (olen > 0) {
|
||||
struct msghdr msg;
|
||||
struct flowi flowi;
|
||||
struct flowi6 flowi6;
|
||||
int junk;
|
||||
|
||||
err = -ENOMEM;
|
||||
@@ -358,9 +358,9 @@ fl_create(struct net *net, struct in6_flowlabel_req *freq, char __user *optval,
|
||||
|
||||
msg.msg_controllen = olen;
|
||||
msg.msg_control = (void*)(fl->opt+1);
|
||||
flowi.flowi_oif = 0;
|
||||
memset(&flowi6, 0, sizeof(flowi6));
|
||||
|
||||
err = datagram_send_ctl(net, &msg, &flowi, fl->opt, &junk,
|
||||
err = datagram_send_ctl(net, &msg, &flowi6, fl->opt, &junk,
|
||||
&junk, &junk);
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
+45
-45
@@ -174,15 +174,15 @@ int ip6_output(struct sk_buff *skb)
|
||||
* xmit an sk_buff (used by TCP, SCTP and DCCP)
|
||||
*/
|
||||
|
||||
int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
|
||||
int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
|
||||
struct ipv6_txoptions *opt)
|
||||
{
|
||||
struct net *net = sock_net(sk);
|
||||
struct ipv6_pinfo *np = inet6_sk(sk);
|
||||
struct in6_addr *first_hop = &fl->fl6_dst;
|
||||
struct in6_addr *first_hop = &fl6->daddr;
|
||||
struct dst_entry *dst = skb_dst(skb);
|
||||
struct ipv6hdr *hdr;
|
||||
u8 proto = fl->flowi_proto;
|
||||
u8 proto = fl6->flowi6_proto;
|
||||
int seg_len = skb->len;
|
||||
int hlimit = -1;
|
||||
int tclass = 0;
|
||||
@@ -230,13 +230,13 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
|
||||
if (hlimit < 0)
|
||||
hlimit = ip6_dst_hoplimit(dst);
|
||||
|
||||
*(__be32 *)hdr = htonl(0x60000000 | (tclass << 20)) | fl->fl6_flowlabel;
|
||||
*(__be32 *)hdr = htonl(0x60000000 | (tclass << 20)) | fl6->flowlabel;
|
||||
|
||||
hdr->payload_len = htons(seg_len);
|
||||
hdr->nexthdr = proto;
|
||||
hdr->hop_limit = hlimit;
|
||||
|
||||
ipv6_addr_copy(&hdr->saddr, &fl->fl6_src);
|
||||
ipv6_addr_copy(&hdr->saddr, &fl6->saddr);
|
||||
ipv6_addr_copy(&hdr->daddr, first_hop);
|
||||
|
||||
skb->priority = sk->sk_priority;
|
||||
@@ -879,7 +879,7 @@ static inline int ip6_rt_check(struct rt6key *rt_key,
|
||||
|
||||
static struct dst_entry *ip6_sk_dst_check(struct sock *sk,
|
||||
struct dst_entry *dst,
|
||||
struct flowi *fl)
|
||||
struct flowi6 *fl6)
|
||||
{
|
||||
struct ipv6_pinfo *np = inet6_sk(sk);
|
||||
struct rt6_info *rt = (struct rt6_info *)dst;
|
||||
@@ -904,11 +904,11 @@ static struct dst_entry *ip6_sk_dst_check(struct sock *sk,
|
||||
* sockets.
|
||||
* 2. oif also should be the same.
|
||||
*/
|
||||
if (ip6_rt_check(&rt->rt6i_dst, &fl->fl6_dst, np->daddr_cache) ||
|
||||
if (ip6_rt_check(&rt->rt6i_dst, &fl6->daddr, np->daddr_cache) ||
|
||||
#ifdef CONFIG_IPV6_SUBTREES
|
||||
ip6_rt_check(&rt->rt6i_src, &fl->fl6_src, np->saddr_cache) ||
|
||||
ip6_rt_check(&rt->rt6i_src, &fl6->saddr, np->saddr_cache) ||
|
||||
#endif
|
||||
(fl->flowi_oif && fl->flowi_oif != dst->dev->ifindex)) {
|
||||
(fl6->flowi6_oif && fl6->flowi6_oif != dst->dev->ifindex)) {
|
||||
dst_release(dst);
|
||||
dst = NULL;
|
||||
}
|
||||
@@ -918,22 +918,22 @@ out:
|
||||
}
|
||||
|
||||
static int ip6_dst_lookup_tail(struct sock *sk,
|
||||
struct dst_entry **dst, struct flowi *fl)
|
||||
struct dst_entry **dst, struct flowi6 *fl6)
|
||||
{
|
||||
int err;
|
||||
struct net *net = sock_net(sk);
|
||||
|
||||
if (*dst == NULL)
|
||||
*dst = ip6_route_output(net, sk, fl);
|
||||
*dst = ip6_route_output(net, sk, fl6);
|
||||
|
||||
if ((err = (*dst)->error))
|
||||
goto out_err_release;
|
||||
|
||||
if (ipv6_addr_any(&fl->fl6_src)) {
|
||||
if (ipv6_addr_any(&fl6->saddr)) {
|
||||
err = ipv6_dev_get_saddr(net, ip6_dst_idev(*dst)->dev,
|
||||
&fl->fl6_dst,
|
||||
&fl6->daddr,
|
||||
sk ? inet6_sk(sk)->srcprefs : 0,
|
||||
&fl->fl6_src);
|
||||
&fl6->saddr);
|
||||
if (err)
|
||||
goto out_err_release;
|
||||
}
|
||||
@@ -949,10 +949,10 @@ static int ip6_dst_lookup_tail(struct sock *sk,
|
||||
*/
|
||||
if ((*dst)->neighbour && !((*dst)->neighbour->nud_state & NUD_VALID)) {
|
||||
struct inet6_ifaddr *ifp;
|
||||
struct flowi fl_gw;
|
||||
struct flowi6 fl_gw6;
|
||||
int redirect;
|
||||
|
||||
ifp = ipv6_get_ifaddr(net, &fl->fl6_src,
|
||||
ifp = ipv6_get_ifaddr(net, &fl6->saddr,
|
||||
(*dst)->dev, 1);
|
||||
|
||||
redirect = (ifp && ifp->flags & IFA_F_OPTIMISTIC);
|
||||
@@ -965,9 +965,9 @@ static int ip6_dst_lookup_tail(struct sock *sk,
|
||||
* default router instead
|
||||
*/
|
||||
dst_release(*dst);
|
||||
memcpy(&fl_gw, fl, sizeof(struct flowi));
|
||||
memset(&fl_gw.fl6_dst, 0, sizeof(struct in6_addr));
|
||||
*dst = ip6_route_output(net, sk, &fl_gw);
|
||||
memcpy(&fl_gw6, fl6, sizeof(struct flowi6));
|
||||
memset(&fl_gw6.daddr, 0, sizeof(struct in6_addr));
|
||||
*dst = ip6_route_output(net, sk, &fl_gw6);
|
||||
if ((err = (*dst)->error))
|
||||
goto out_err_release;
|
||||
}
|
||||
@@ -988,23 +988,23 @@ out_err_release:
|
||||
* ip6_dst_lookup - perform route lookup on flow
|
||||
* @sk: socket which provides route info
|
||||
* @dst: pointer to dst_entry * for result
|
||||
* @fl: flow to lookup
|
||||
* @fl6: flow to lookup
|
||||
*
|
||||
* This function performs a route lookup on the given flow.
|
||||
*
|
||||
* It returns zero on success, or a standard errno code on error.
|
||||
*/
|
||||
int ip6_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi *fl)
|
||||
int ip6_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi6 *fl6)
|
||||
{
|
||||
*dst = NULL;
|
||||
return ip6_dst_lookup_tail(sk, dst, fl);
|
||||
return ip6_dst_lookup_tail(sk, dst, fl6);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(ip6_dst_lookup);
|
||||
|
||||
/**
|
||||
* ip6_dst_lookup_flow - perform route lookup on flow with ipsec
|
||||
* @sk: socket which provides route info
|
||||
* @fl: flow to lookup
|
||||
* @fl6: flow to lookup
|
||||
* @final_dst: final destination address for ipsec lookup
|
||||
* @can_sleep: we are in a sleepable context
|
||||
*
|
||||
@@ -1013,29 +1013,29 @@ EXPORT_SYMBOL_GPL(ip6_dst_lookup);
|
||||
* It returns a valid dst pointer on success, or a pointer encoded
|
||||
* error code.
|
||||
*/
|
||||
struct dst_entry *ip6_dst_lookup_flow(struct sock *sk, struct flowi *fl,
|
||||
struct dst_entry *ip6_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6,
|
||||
const struct in6_addr *final_dst,
|
||||
bool can_sleep)
|
||||
{
|
||||
struct dst_entry *dst = NULL;
|
||||
int err;
|
||||
|
||||
err = ip6_dst_lookup_tail(sk, &dst, fl);
|
||||
err = ip6_dst_lookup_tail(sk, &dst, fl6);
|
||||
if (err)
|
||||
return ERR_PTR(err);
|
||||
if (final_dst)
|
||||
ipv6_addr_copy(&fl->fl6_dst, final_dst);
|
||||
ipv6_addr_copy(&fl6->daddr, final_dst);
|
||||
if (can_sleep)
|
||||
fl->flowi_flags |= FLOWI_FLAG_CAN_SLEEP;
|
||||
fl6->flowi6_flags |= FLOWI_FLAG_CAN_SLEEP;
|
||||
|
||||
return xfrm_lookup(sock_net(sk), dst, fl, sk, 0);
|
||||
return xfrm_lookup(sock_net(sk), dst, flowi6_to_flowi(fl6), sk, 0);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(ip6_dst_lookup_flow);
|
||||
|
||||
/**
|
||||
* ip6_sk_dst_lookup_flow - perform socket cached route lookup on flow
|
||||
* @sk: socket which provides the dst cache and route info
|
||||
* @fl: flow to lookup
|
||||
* @fl6: flow to lookup
|
||||
* @final_dst: final destination address for ipsec lookup
|
||||
* @can_sleep: we are in a sleepable context
|
||||
*
|
||||
@@ -1047,24 +1047,24 @@ EXPORT_SYMBOL_GPL(ip6_dst_lookup_flow);
|
||||
* It returns a valid dst pointer on success, or a pointer encoded
|
||||
* error code.
|
||||
*/
|
||||
struct dst_entry *ip6_sk_dst_lookup_flow(struct sock *sk, struct flowi *fl,
|
||||
struct dst_entry *ip6_sk_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6,
|
||||
const struct in6_addr *final_dst,
|
||||
bool can_sleep)
|
||||
{
|
||||
struct dst_entry *dst = sk_dst_check(sk, inet6_sk(sk)->dst_cookie);
|
||||
int err;
|
||||
|
||||
dst = ip6_sk_dst_check(sk, dst, fl);
|
||||
dst = ip6_sk_dst_check(sk, dst, fl6);
|
||||
|
||||
err = ip6_dst_lookup_tail(sk, &dst, fl);
|
||||
err = ip6_dst_lookup_tail(sk, &dst, fl6);
|
||||
if (err)
|
||||
return ERR_PTR(err);
|
||||
if (final_dst)
|
||||
ipv6_addr_copy(&fl->fl6_dst, final_dst);
|
||||
ipv6_addr_copy(&fl6->daddr, final_dst);
|
||||
if (can_sleep)
|
||||
fl->flowi_flags |= FLOWI_FLAG_CAN_SLEEP;
|
||||
fl6->flowi6_flags |= FLOWI_FLAG_CAN_SLEEP;
|
||||
|
||||
return xfrm_lookup(sock_net(sk), dst, fl, sk, 0);
|
||||
return xfrm_lookup(sock_net(sk), dst, flowi6_to_flowi(fl6), sk, 0);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(ip6_sk_dst_lookup_flow);
|
||||
|
||||
@@ -1145,7 +1145,7 @@ static inline struct ipv6_rt_hdr *ip6_rthdr_dup(struct ipv6_rt_hdr *src,
|
||||
int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
|
||||
int offset, int len, int odd, struct sk_buff *skb),
|
||||
void *from, int length, int transhdrlen,
|
||||
int hlimit, int tclass, struct ipv6_txoptions *opt, struct flowi *fl,
|
||||
int hlimit, int tclass, struct ipv6_txoptions *opt, struct flowi6 *fl6,
|
||||
struct rt6_info *rt, unsigned int flags, int dontfrag)
|
||||
{
|
||||
struct inet_sock *inet = inet_sk(sk);
|
||||
@@ -1203,7 +1203,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
|
||||
}
|
||||
dst_hold(&rt->dst);
|
||||
inet->cork.dst = &rt->dst;
|
||||
inet->cork.fl = *fl;
|
||||
inet->cork.fl.u.ip6 = *fl6;
|
||||
np->cork.hop_limit = hlimit;
|
||||
np->cork.tclass = tclass;
|
||||
mtu = np->pmtudisc == IPV6_PMTUDISC_PROBE ?
|
||||
@@ -1224,7 +1224,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
|
||||
transhdrlen += exthdrlen;
|
||||
} else {
|
||||
rt = (struct rt6_info *)inet->cork.dst;
|
||||
fl = &inet->cork.fl;
|
||||
fl6 = &inet->cork.fl.u.ip6;
|
||||
opt = np->cork.opt;
|
||||
transhdrlen = 0;
|
||||
exthdrlen = 0;
|
||||
@@ -1239,7 +1239,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
|
||||
|
||||
if (mtu <= sizeof(struct ipv6hdr) + IPV6_MAXPLEN) {
|
||||
if (inet->cork.length + length > sizeof(struct ipv6hdr) + IPV6_MAXPLEN - fragheaderlen) {
|
||||
ipv6_local_error(sk, EMSGSIZE, fl, mtu-exthdrlen);
|
||||
ipv6_local_error(sk, EMSGSIZE, fl6, mtu-exthdrlen);
|
||||
return -EMSGSIZE;
|
||||
}
|
||||
}
|
||||
@@ -1271,7 +1271,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
|
||||
if (length > mtu) {
|
||||
int proto = sk->sk_protocol;
|
||||
if (dontfrag && (proto == IPPROTO_UDP || proto == IPPROTO_RAW)){
|
||||
ipv6_local_rxpmtu(sk, fl, mtu-exthdrlen);
|
||||
ipv6_local_rxpmtu(sk, fl6, mtu-exthdrlen);
|
||||
return -EMSGSIZE;
|
||||
}
|
||||
|
||||
@@ -1516,8 +1516,8 @@ int ip6_push_pending_frames(struct sock *sk)
|
||||
struct ipv6hdr *hdr;
|
||||
struct ipv6_txoptions *opt = np->cork.opt;
|
||||
struct rt6_info *rt = (struct rt6_info *)inet->cork.dst;
|
||||
struct flowi *fl = &inet->cork.fl;
|
||||
unsigned char proto = fl->flowi_proto;
|
||||
struct flowi6 *fl6 = &inet->cork.fl.u.ip6;
|
||||
unsigned char proto = fl6->flowi6_proto;
|
||||
int err = 0;
|
||||
|
||||
if ((skb = __skb_dequeue(&sk->sk_write_queue)) == NULL)
|
||||
@@ -1542,7 +1542,7 @@ int ip6_push_pending_frames(struct sock *sk)
|
||||
if (np->pmtudisc < IPV6_PMTUDISC_DO)
|
||||
skb->local_df = 1;
|
||||
|
||||
ipv6_addr_copy(final_dst, &fl->fl6_dst);
|
||||
ipv6_addr_copy(final_dst, &fl6->daddr);
|
||||
__skb_pull(skb, skb_network_header_len(skb));
|
||||
if (opt && opt->opt_flen)
|
||||
ipv6_push_frag_opts(skb, opt, &proto);
|
||||
@@ -1553,12 +1553,12 @@ int ip6_push_pending_frames(struct sock *sk)
|
||||
skb_reset_network_header(skb);
|
||||
hdr = ipv6_hdr(skb);
|
||||
|
||||
*(__be32*)hdr = fl->fl6_flowlabel |
|
||||
*(__be32*)hdr = fl6->flowlabel |
|
||||
htonl(0x60000000 | ((int)np->cork.tclass << 20));
|
||||
|
||||
hdr->hop_limit = np->cork.hop_limit;
|
||||
hdr->nexthdr = proto;
|
||||
ipv6_addr_copy(&hdr->saddr, &fl->fl6_src);
|
||||
ipv6_addr_copy(&hdr->saddr, &fl6->saddr);
|
||||
ipv6_addr_copy(&hdr->daddr, final_dst);
|
||||
|
||||
skb->priority = sk->sk_priority;
|
||||
|
||||
+25
-25
@@ -884,7 +884,7 @@ static inline int ip6_tnl_xmit_ctl(struct ip6_tnl *t)
|
||||
static int ip6_tnl_xmit2(struct sk_buff *skb,
|
||||
struct net_device *dev,
|
||||
__u8 dsfield,
|
||||
struct flowi *fl,
|
||||
struct flowi6 *fl6,
|
||||
int encap_limit,
|
||||
__u32 *pmtu)
|
||||
{
|
||||
@@ -904,11 +904,11 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
|
||||
if ((dst = ip6_tnl_dst_check(t)) != NULL)
|
||||
dst_hold(dst);
|
||||
else {
|
||||
dst = ip6_route_output(net, NULL, fl);
|
||||
dst = ip6_route_output(net, NULL, fl6);
|
||||
|
||||
if (dst->error)
|
||||
goto tx_err_link_failure;
|
||||
dst = xfrm_lookup(net, dst, fl, NULL, 0);
|
||||
dst = xfrm_lookup(net, dst, flowi6_to_flowi(fl6), NULL, 0);
|
||||
if (IS_ERR(dst)) {
|
||||
err = PTR_ERR(dst);
|
||||
dst = NULL;
|
||||
@@ -963,7 +963,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
|
||||
|
||||
skb->transport_header = skb->network_header;
|
||||
|
||||
proto = fl->flowi_proto;
|
||||
proto = fl6->flowi6_proto;
|
||||
if (encap_limit >= 0) {
|
||||
init_tel_txopt(&opt, encap_limit);
|
||||
ipv6_push_nfrag_opts(skb, &opt.ops, &proto, NULL);
|
||||
@@ -971,13 +971,13 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
|
||||
skb_push(skb, sizeof(struct ipv6hdr));
|
||||
skb_reset_network_header(skb);
|
||||
ipv6h = ipv6_hdr(skb);
|
||||
*(__be32*)ipv6h = fl->fl6_flowlabel | htonl(0x60000000);
|
||||
*(__be32*)ipv6h = fl6->flowlabel | htonl(0x60000000);
|
||||
dsfield = INET_ECN_encapsulate(0, dsfield);
|
||||
ipv6_change_dsfield(ipv6h, ~INET_ECN_MASK, dsfield);
|
||||
ipv6h->hop_limit = t->parms.hop_limit;
|
||||
ipv6h->nexthdr = proto;
|
||||
ipv6_addr_copy(&ipv6h->saddr, &fl->fl6_src);
|
||||
ipv6_addr_copy(&ipv6h->daddr, &fl->fl6_dst);
|
||||
ipv6_addr_copy(&ipv6h->saddr, &fl6->saddr);
|
||||
ipv6_addr_copy(&ipv6h->daddr, &fl6->daddr);
|
||||
nf_reset(skb);
|
||||
pkt_len = skb->len;
|
||||
err = ip6_local_out(skb);
|
||||
@@ -1007,7 +1007,7 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
struct ip6_tnl *t = netdev_priv(dev);
|
||||
struct iphdr *iph = ip_hdr(skb);
|
||||
int encap_limit = -1;
|
||||
struct flowi fl;
|
||||
struct flowi6 fl6;
|
||||
__u8 dsfield;
|
||||
__u32 mtu;
|
||||
int err;
|
||||
@@ -1019,16 +1019,16 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT))
|
||||
encap_limit = t->parms.encap_limit;
|
||||
|
||||
memcpy(&fl, &t->fl, sizeof (fl));
|
||||
fl.flowi_proto = IPPROTO_IPIP;
|
||||
memcpy(&fl6, &t->fl.u.ip6, sizeof (fl6));
|
||||
fl6.flowi6_proto = IPPROTO_IPIP;
|
||||
|
||||
dsfield = ipv4_get_dsfield(iph);
|
||||
|
||||
if ((t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS))
|
||||
fl.fl6_flowlabel |= htonl((__u32)iph->tos << IPV6_TCLASS_SHIFT)
|
||||
fl6.flowlabel |= htonl((__u32)iph->tos << IPV6_TCLASS_SHIFT)
|
||||
& IPV6_TCLASS_MASK;
|
||||
|
||||
err = ip6_tnl_xmit2(skb, dev, dsfield, &fl, encap_limit, &mtu);
|
||||
err = ip6_tnl_xmit2(skb, dev, dsfield, &fl6, encap_limit, &mtu);
|
||||
if (err != 0) {
|
||||
/* XXX: send ICMP error even if DF is not set. */
|
||||
if (err == -EMSGSIZE)
|
||||
@@ -1047,7 +1047,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
struct ipv6hdr *ipv6h = ipv6_hdr(skb);
|
||||
int encap_limit = -1;
|
||||
__u16 offset;
|
||||
struct flowi fl;
|
||||
struct flowi6 fl6;
|
||||
__u8 dsfield;
|
||||
__u32 mtu;
|
||||
int err;
|
||||
@@ -1069,16 +1069,16 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
} else if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT))
|
||||
encap_limit = t->parms.encap_limit;
|
||||
|
||||
memcpy(&fl, &t->fl, sizeof (fl));
|
||||
fl.flowi_proto = IPPROTO_IPV6;
|
||||
memcpy(&fl6, &t->fl.u.ip6, sizeof (fl6));
|
||||
fl6.flowi6_proto = IPPROTO_IPV6;
|
||||
|
||||
dsfield = ipv6_get_dsfield(ipv6h);
|
||||
if ((t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS))
|
||||
fl.fl6_flowlabel |= (*(__be32 *) ipv6h & IPV6_TCLASS_MASK);
|
||||
fl6.flowlabel |= (*(__be32 *) ipv6h & IPV6_TCLASS_MASK);
|
||||
if ((t->parms.flags & IP6_TNL_F_USE_ORIG_FLOWLABEL))
|
||||
fl.fl6_flowlabel |= (*(__be32 *) ipv6h & IPV6_FLOWLABEL_MASK);
|
||||
fl6.flowlabel |= (*(__be32 *) ipv6h & IPV6_FLOWLABEL_MASK);
|
||||
|
||||
err = ip6_tnl_xmit2(skb, dev, dsfield, &fl, encap_limit, &mtu);
|
||||
err = ip6_tnl_xmit2(skb, dev, dsfield, &fl6, encap_limit, &mtu);
|
||||
if (err != 0) {
|
||||
if (err == -EMSGSIZE)
|
||||
icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
|
||||
@@ -1141,21 +1141,21 @@ static void ip6_tnl_link_config(struct ip6_tnl *t)
|
||||
{
|
||||
struct net_device *dev = t->dev;
|
||||
struct ip6_tnl_parm *p = &t->parms;
|
||||
struct flowi *fl = &t->fl;
|
||||
struct flowi6 *fl6 = &t->fl.u.ip6;
|
||||
|
||||
memcpy(dev->dev_addr, &p->laddr, sizeof(struct in6_addr));
|
||||
memcpy(dev->broadcast, &p->raddr, sizeof(struct in6_addr));
|
||||
|
||||
/* Set up flowi template */
|
||||
ipv6_addr_copy(&fl->fl6_src, &p->laddr);
|
||||
ipv6_addr_copy(&fl->fl6_dst, &p->raddr);
|
||||
fl->flowi_oif = p->link;
|
||||
fl->fl6_flowlabel = 0;
|
||||
ipv6_addr_copy(&fl6->saddr, &p->laddr);
|
||||
ipv6_addr_copy(&fl6->daddr, &p->raddr);
|
||||
fl6->flowi6_oif = p->link;
|
||||
fl6->flowlabel = 0;
|
||||
|
||||
if (!(p->flags&IP6_TNL_F_USE_ORIG_TCLASS))
|
||||
fl->fl6_flowlabel |= IPV6_TCLASS_MASK & p->flowinfo;
|
||||
fl6->flowlabel |= IPV6_TCLASS_MASK & p->flowinfo;
|
||||
if (!(p->flags&IP6_TNL_F_USE_ORIG_FLOWLABEL))
|
||||
fl->fl6_flowlabel |= IPV6_FLOWLABEL_MASK & p->flowinfo;
|
||||
fl6->flowlabel |= IPV6_FLOWLABEL_MASK & p->flowinfo;
|
||||
|
||||
ip6_tnl_set_cap(t);
|
||||
|
||||
|
||||
+27
-26
@@ -135,14 +135,15 @@ static struct mr6_table *ip6mr_get_table(struct net *net, u32 id)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int ip6mr_fib_lookup(struct net *net, struct flowi *flp,
|
||||
static int ip6mr_fib_lookup(struct net *net, struct flowi6 *flp6,
|
||||
struct mr6_table **mrt)
|
||||
{
|
||||
struct ip6mr_result res;
|
||||
struct fib_lookup_arg arg = { .result = &res, };
|
||||
int err;
|
||||
|
||||
err = fib_rules_lookup(net->ipv6.mr6_rules_ops, flp, 0, &arg);
|
||||
err = fib_rules_lookup(net->ipv6.mr6_rules_ops,
|
||||
flowi6_to_flowi(flp6), 0, &arg);
|
||||
if (err < 0)
|
||||
return err;
|
||||
*mrt = res.mrt;
|
||||
@@ -270,7 +271,7 @@ static struct mr6_table *ip6mr_get_table(struct net *net, u32 id)
|
||||
return net->ipv6.mrt6;
|
||||
}
|
||||
|
||||
static int ip6mr_fib_lookup(struct net *net, struct flowi *flp,
|
||||
static int ip6mr_fib_lookup(struct net *net, struct flowi6 *flp6,
|
||||
struct mr6_table **mrt)
|
||||
{
|
||||
*mrt = net->ipv6.mrt6;
|
||||
@@ -617,9 +618,9 @@ static int pim6_rcv(struct sk_buff *skb)
|
||||
struct net_device *reg_dev = NULL;
|
||||
struct net *net = dev_net(skb->dev);
|
||||
struct mr6_table *mrt;
|
||||
struct flowi fl = {
|
||||
.flowi_iif = skb->dev->ifindex,
|
||||
.flowi_mark = skb->mark,
|
||||
struct flowi6 fl6 = {
|
||||
.flowi6_iif = skb->dev->ifindex,
|
||||
.flowi6_mark = skb->mark,
|
||||
};
|
||||
int reg_vif_num;
|
||||
|
||||
@@ -644,7 +645,7 @@ static int pim6_rcv(struct sk_buff *skb)
|
||||
ntohs(encap->payload_len) + sizeof(*pim) > skb->len)
|
||||
goto drop;
|
||||
|
||||
if (ip6mr_fib_lookup(net, &fl, &mrt) < 0)
|
||||
if (ip6mr_fib_lookup(net, &fl6, &mrt) < 0)
|
||||
goto drop;
|
||||
reg_vif_num = mrt->mroute_reg_vif_num;
|
||||
|
||||
@@ -687,14 +688,14 @@ static netdev_tx_t reg_vif_xmit(struct sk_buff *skb,
|
||||
{
|
||||
struct net *net = dev_net(dev);
|
||||
struct mr6_table *mrt;
|
||||
struct flowi fl = {
|
||||
.flowi_oif = dev->ifindex,
|
||||
.flowi_iif = skb->skb_iif,
|
||||
.flowi_mark = skb->mark,
|
||||
struct flowi6 fl6 = {
|
||||
.flowi6_oif = dev->ifindex,
|
||||
.flowi6_iif = skb->skb_iif,
|
||||
.flowi6_mark = skb->mark,
|
||||
};
|
||||
int err;
|
||||
|
||||
err = ip6mr_fib_lookup(net, &fl, &mrt);
|
||||
err = ip6mr_fib_lookup(net, &fl6, &mrt);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
@@ -1547,13 +1548,13 @@ int ip6mr_sk_done(struct sock *sk)
|
||||
struct sock *mroute6_socket(struct net *net, struct sk_buff *skb)
|
||||
{
|
||||
struct mr6_table *mrt;
|
||||
struct flowi fl = {
|
||||
.flowi_iif = skb->skb_iif,
|
||||
.flowi_oif = skb->dev->ifindex,
|
||||
.flowi_mark= skb->mark,
|
||||
struct flowi6 fl6 = {
|
||||
.flowi6_iif = skb->skb_iif,
|
||||
.flowi6_oif = skb->dev->ifindex,
|
||||
.flowi6_mark = skb->mark,
|
||||
};
|
||||
|
||||
if (ip6mr_fib_lookup(net, &fl, &mrt) < 0)
|
||||
if (ip6mr_fib_lookup(net, &fl6, &mrt) < 0)
|
||||
return NULL;
|
||||
|
||||
return mrt->mroute6_sk;
|
||||
@@ -1897,7 +1898,7 @@ static int ip6mr_forward2(struct net *net, struct mr6_table *mrt,
|
||||
struct mif_device *vif = &mrt->vif6_table[vifi];
|
||||
struct net_device *dev;
|
||||
struct dst_entry *dst;
|
||||
struct flowi fl;
|
||||
struct flowi6 fl6;
|
||||
|
||||
if (vif->dev == NULL)
|
||||
goto out_free;
|
||||
@@ -1915,12 +1916,12 @@ static int ip6mr_forward2(struct net *net, struct mr6_table *mrt,
|
||||
|
||||
ipv6h = ipv6_hdr(skb);
|
||||
|
||||
fl = (struct flowi) {
|
||||
.flowi_oif = vif->link,
|
||||
.fl6_dst = ipv6h->daddr,
|
||||
fl6 = (struct flowi6) {
|
||||
.flowi6_oif = vif->link,
|
||||
.daddr = ipv6h->daddr,
|
||||
};
|
||||
|
||||
dst = ip6_route_output(net, NULL, &fl);
|
||||
dst = ip6_route_output(net, NULL, &fl6);
|
||||
if (!dst)
|
||||
goto out_free;
|
||||
|
||||
@@ -2043,13 +2044,13 @@ int ip6_mr_input(struct sk_buff *skb)
|
||||
struct mfc6_cache *cache;
|
||||
struct net *net = dev_net(skb->dev);
|
||||
struct mr6_table *mrt;
|
||||
struct flowi fl = {
|
||||
.flowi_iif = skb->dev->ifindex,
|
||||
.flowi_mark= skb->mark,
|
||||
struct flowi6 fl6 = {
|
||||
.flowi6_iif = skb->dev->ifindex,
|
||||
.flowi6_mark = skb->mark,
|
||||
};
|
||||
int err;
|
||||
|
||||
err = ip6mr_fib_lookup(net, &fl, &mrt);
|
||||
err = ip6mr_fib_lookup(net, &fl6, &mrt);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
||||
@@ -444,12 +444,12 @@ sticky_done:
|
||||
{
|
||||
struct ipv6_txoptions *opt = NULL;
|
||||
struct msghdr msg;
|
||||
struct flowi fl;
|
||||
struct flowi6 fl6;
|
||||
int junk;
|
||||
|
||||
fl.fl6_flowlabel = 0;
|
||||
fl.flowi_oif = sk->sk_bound_dev_if;
|
||||
fl.flowi_mark = sk->sk_mark;
|
||||
memset(&fl6, 0, sizeof(fl6));
|
||||
fl6.flowi6_oif = sk->sk_bound_dev_if;
|
||||
fl6.flowi6_mark = sk->sk_mark;
|
||||
|
||||
if (optlen == 0)
|
||||
goto update;
|
||||
@@ -475,7 +475,7 @@ sticky_done:
|
||||
msg.msg_controllen = optlen;
|
||||
msg.msg_control = (void*)(opt+1);
|
||||
|
||||
retv = datagram_send_ctl(net, &msg, &fl, opt, &junk, &junk,
|
||||
retv = datagram_send_ctl(net, &msg, &fl6, opt, &junk, &junk,
|
||||
&junk);
|
||||
if (retv)
|
||||
goto done;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user