Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 51953d5b authored by Brian Haley's avatar Brian Haley Committed by David S. Miller
Browse files

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: default avatarBrian Haley <brian.haley@hp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d73d3a8c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -654,6 +654,7 @@ int inet6_sk_rebuild_header(struct sock *sk)
		ipv6_addr_copy(&fl.fl6_src, &np->saddr);
		fl.fl6_flowlabel = np->flow_label;
		fl.oif = sk->sk_bound_dev_if;
		fl.mark = sk->sk_mark;
		fl.fl_ip_dport = inet->dport;
		fl.fl_ip_sport = inet->sport;
		security_sk_classify_flow(sk, &fl);
+1 −0
Original line number Diff line number Diff line
@@ -147,6 +147,7 @@ int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
	ipv6_addr_copy(&fl.fl6_dst, &np->daddr);
	ipv6_addr_copy(&fl.fl6_src, &np->saddr);
	fl.oif = sk->sk_bound_dev_if;
	fl.mark = sk->sk_mark;
	fl.fl_ip_dport = inet->dport;
	fl.fl_ip_sport = inet->sport;

+1 −0
Original line number Diff line number Diff line
@@ -194,6 +194,7 @@ int inet6_csk_xmit(struct sk_buff *skb, int ipfragok)
	fl.fl6_flowlabel = np->flow_label;
	IP6_ECN_flow_xmit(sk, fl.fl6_flowlabel);
	fl.oif = sk->sk_bound_dev_if;
	fl.mark = sk->sk_mark;
	fl.fl_ip_sport = inet->sport;
	fl.fl_ip_dport = inet->dport;
	security_sk_classify_flow(sk, &fl);
+1 −0
Original line number Diff line number Diff line
@@ -424,6 +424,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,

		fl.fl6_flowlabel = 0;
		fl.oif = sk->sk_bound_dev_if;
		fl.mark = sk->sk_mark;

		if (optlen == 0)
			goto update;
+1 −0
Original line number Diff line number Diff line
@@ -252,6 +252,7 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
		}
		ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr);
		fl.oif = sk->sk_bound_dev_if;
		fl.mark = sk->sk_mark;
		fl.fl_ip_dport = inet_rsk(req)->rmt_port;
		fl.fl_ip_sport = inet_sk(sk)->sport;
		security_req_classify_flow(req, &fl);
Loading