diff options
author | Brian Haley <brian.haley@hp.com> | 2009-10-05 04:24:16 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-07 04:10:45 -0400 |
commit | 51953d5bc43e468f24cc573a45cde1d32af129b8 (patch) | |
tree | e275eb5019dc07bdea3ac61b6198c5c410c49e41 /net | |
parent | d73d3a8cb4723e161589864741d8528d70b350eb (diff) |
Use sk_mark for IPv6 routing lookups
Atis Elsts wrote:
> Not sure if there is need to fill the mark from skb in tunnel xmit functions. In any case, it's not done for GRE or IPIP tunnels at the moment.
Ok, I'll just drop that part, I'm not sure what should be done in this case.
> Also, in this patch you are doing that for SIT (v6-in-v4) tunnels only, and not doing it for v4-in-v6 or v6-in-v6 tunnels. Any reason for that?
I just sent that patch out too quickly, here's a better one with the updates.
Add support for IPv6 route lookups using sk_mark.
Signed-off-by: Brian Haley <brian.haley@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv6/af_inet6.c | 1 | ||||
-rw-r--r-- | net/ipv6/datagram.c | 1 | ||||
-rw-r--r-- | net/ipv6/inet6_connection_sock.c | 1 | ||||
-rw-r--r-- | net/ipv6/ipv6_sockglue.c | 1 | ||||
-rw-r--r-- | net/ipv6/syncookies.c | 1 | ||||
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 4 | ||||
-rw-r--r-- | net/ipv6/udp.c | 2 |
7 files changed, 11 insertions, 0 deletions
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index e127a32f9540..da36497ae647 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -654,6 +654,7 @@ int inet6_sk_rebuild_header(struct sock *sk) | |||
654 | ipv6_addr_copy(&fl.fl6_src, &np->saddr); | 654 | ipv6_addr_copy(&fl.fl6_src, &np->saddr); |
655 | fl.fl6_flowlabel = np->flow_label; | 655 | fl.fl6_flowlabel = np->flow_label; |
656 | fl.oif = sk->sk_bound_dev_if; | 656 | fl.oif = sk->sk_bound_dev_if; |
657 | fl.mark = sk->sk_mark; | ||
657 | fl.fl_ip_dport = inet->dport; | 658 | fl.fl_ip_dport = inet->dport; |
658 | fl.fl_ip_sport = inet->sport; | 659 | fl.fl_ip_sport = inet->sport; |
659 | security_sk_classify_flow(sk, &fl); | 660 | security_sk_classify_flow(sk, &fl); |
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index e2bdc6d83a43..a615b4dea6c4 100644 --- a/net/ipv6/datagram.c +++ b/net/ipv6/datagram.c | |||
@@ -147,6 +147,7 @@ ipv4_connected: | |||
147 | ipv6_addr_copy(&fl.fl6_dst, &np->daddr); | 147 | ipv6_addr_copy(&fl.fl6_dst, &np->daddr); |
148 | ipv6_addr_copy(&fl.fl6_src, &np->saddr); | 148 | ipv6_addr_copy(&fl.fl6_src, &np->saddr); |
149 | fl.oif = sk->sk_bound_dev_if; | 149 | fl.oif = sk->sk_bound_dev_if; |
150 | fl.mark = sk->sk_mark; | ||
150 | fl.fl_ip_dport = inet->dport; | 151 | fl.fl_ip_dport = inet->dport; |
151 | fl.fl_ip_sport = inet->sport; | 152 | fl.fl_ip_sport = inet->sport; |
152 | 153 | ||
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c index cc4797dd8325..a9f4a21b31ea 100644 --- a/net/ipv6/inet6_connection_sock.c +++ b/net/ipv6/inet6_connection_sock.c | |||
@@ -194,6 +194,7 @@ int inet6_csk_xmit(struct sk_buff *skb, int ipfragok) | |||
194 | fl.fl6_flowlabel = np->flow_label; | 194 | fl.fl6_flowlabel = np->flow_label; |
195 | IP6_ECN_flow_xmit(sk, fl.fl6_flowlabel); | 195 | IP6_ECN_flow_xmit(sk, fl.fl6_flowlabel); |
196 | fl.oif = sk->sk_bound_dev_if; | 196 | fl.oif = sk->sk_bound_dev_if; |
197 | fl.mark = sk->sk_mark; | ||
197 | fl.fl_ip_sport = inet->sport; | 198 | fl.fl_ip_sport = inet->sport; |
198 | fl.fl_ip_dport = inet->dport; | 199 | fl.fl_ip_dport = inet->dport; |
199 | security_sk_classify_flow(sk, &fl); | 200 | security_sk_classify_flow(sk, &fl); |
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index 14f54eb5a7fc..dc0f7366073d 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c | |||
@@ -424,6 +424,7 @@ sticky_done: | |||
424 | 424 | ||
425 | fl.fl6_flowlabel = 0; | 425 | fl.fl6_flowlabel = 0; |
426 | fl.oif = sk->sk_bound_dev_if; | 426 | fl.oif = sk->sk_bound_dev_if; |
427 | fl.mark = sk->sk_mark; | ||
427 | 428 | ||
428 | if (optlen == 0) | 429 | if (optlen == 0) |
429 | goto update; | 430 | goto update; |
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c index 6b6ae913b5d4..cbe55e5d9f96 100644 --- a/net/ipv6/syncookies.c +++ b/net/ipv6/syncookies.c | |||
@@ -252,6 +252,7 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb) | |||
252 | } | 252 | } |
253 | ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr); | 253 | ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr); |
254 | fl.oif = sk->sk_bound_dev_if; | 254 | fl.oif = sk->sk_bound_dev_if; |
255 | fl.mark = sk->sk_mark; | ||
255 | fl.fl_ip_dport = inet_rsk(req)->rmt_port; | 256 | fl.fl_ip_dport = inet_rsk(req)->rmt_port; |
256 | fl.fl_ip_sport = inet_sk(sk)->sport; | 257 | fl.fl_ip_sport = inet_sk(sk)->sport; |
257 | security_req_classify_flow(req, &fl); | 258 | security_req_classify_flow(req, &fl); |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 21d100b68b19..321aafd40dcb 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -243,6 +243,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
243 | ipv6_addr_copy(&fl.fl6_src, | 243 | ipv6_addr_copy(&fl.fl6_src, |
244 | (saddr ? saddr : &np->saddr)); | 244 | (saddr ? saddr : &np->saddr)); |
245 | fl.oif = sk->sk_bound_dev_if; | 245 | fl.oif = sk->sk_bound_dev_if; |
246 | fl.mark = sk->sk_mark; | ||
246 | fl.fl_ip_dport = usin->sin6_port; | 247 | fl.fl_ip_dport = usin->sin6_port; |
247 | fl.fl_ip_sport = inet->sport; | 248 | fl.fl_ip_sport = inet->sport; |
248 | 249 | ||
@@ -383,6 +384,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
383 | ipv6_addr_copy(&fl.fl6_dst, &np->daddr); | 384 | ipv6_addr_copy(&fl.fl6_dst, &np->daddr); |
384 | ipv6_addr_copy(&fl.fl6_src, &np->saddr); | 385 | ipv6_addr_copy(&fl.fl6_src, &np->saddr); |
385 | fl.oif = sk->sk_bound_dev_if; | 386 | fl.oif = sk->sk_bound_dev_if; |
387 | fl.mark = sk->sk_mark; | ||
386 | fl.fl_ip_dport = inet->dport; | 388 | fl.fl_ip_dport = inet->dport; |
387 | fl.fl_ip_sport = inet->sport; | 389 | fl.fl_ip_sport = inet->sport; |
388 | security_skb_classify_flow(skb, &fl); | 390 | security_skb_classify_flow(skb, &fl); |
@@ -477,6 +479,7 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req) | |||
477 | ipv6_addr_copy(&fl.fl6_src, &treq->loc_addr); | 479 | ipv6_addr_copy(&fl.fl6_src, &treq->loc_addr); |
478 | fl.fl6_flowlabel = 0; | 480 | fl.fl6_flowlabel = 0; |
479 | fl.oif = treq->iif; | 481 | fl.oif = treq->iif; |
482 | fl.mark = sk->sk_mark; | ||
480 | fl.fl_ip_dport = inet_rsk(req)->rmt_port; | 483 | fl.fl_ip_dport = inet_rsk(req)->rmt_port; |
481 | fl.fl_ip_sport = inet_rsk(req)->loc_port; | 484 | fl.fl_ip_sport = inet_rsk(req)->loc_port; |
482 | security_req_classify_flow(req, &fl); | 485 | security_req_classify_flow(req, &fl); |
@@ -1345,6 +1348,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1345 | } | 1348 | } |
1346 | ipv6_addr_copy(&fl.fl6_src, &treq->loc_addr); | 1349 | ipv6_addr_copy(&fl.fl6_src, &treq->loc_addr); |
1347 | fl.oif = sk->sk_bound_dev_if; | 1350 | fl.oif = sk->sk_bound_dev_if; |
1351 | fl.mark = sk->sk_mark; | ||
1348 | fl.fl_ip_dport = inet_rsk(req)->rmt_port; | 1352 | fl.fl_ip_dport = inet_rsk(req)->rmt_port; |
1349 | fl.fl_ip_sport = inet_rsk(req)->loc_port; | 1353 | fl.fl_ip_sport = inet_rsk(req)->loc_port; |
1350 | security_req_classify_flow(req, &fl); | 1354 | security_req_classify_flow(req, &fl); |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 3a60f12b34ed..3842c557d6fa 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -879,6 +879,8 @@ do_udp_sendmsg: | |||
879 | if (!fl.oif) | 879 | if (!fl.oif) |
880 | fl.oif = np->sticky_pktinfo.ipi6_ifindex; | 880 | fl.oif = np->sticky_pktinfo.ipi6_ifindex; |
881 | 881 | ||
882 | fl.mark = sk->sk_mark; | ||
883 | |||
882 | if (msg->msg_controllen) { | 884 | if (msg->msg_controllen) { |
883 | opt = &opt_space; | 885 | opt = &opt_space; |
884 | memset(opt, 0, sizeof(struct ipv6_txoptions)); | 886 | memset(opt, 0, sizeof(struct ipv6_txoptions)); |