]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ipv6: add source address argument for ipv6_push_nfrag_opts
authorDavid Lebrun <david.lebrun@uclouvain.be>
Tue, 8 Nov 2016 13:59:20 +0000 (14:59 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 10 Nov 2016 01:40:06 +0000 (20:40 -0500)
This patch prepares for insertion of SRH through setsockopt().
The new source address argument is used when an HMAC field is
present in the SRH, which must be filled. The HMAC signature
process requires the source address as input text.

Signed-off-by: David Lebrun <david.lebrun@uclouvain.be>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/ipv6.h
net/ipv6/exthdrs.c
net/ipv6/ip6_output.c
net/ipv6/ip6_tunnel.c

index 8fed1cd78658a6e088b63f7703290cb02c1969b6..0a3622bf086f3447dc4a079f5082388326681481 100644 (file)
@@ -932,7 +932,8 @@ int ip6_local_out(struct net *net, struct sock *sk, struct sk_buff *skb);
  */
 
 void ipv6_push_nfrag_opts(struct sk_buff *skb, struct ipv6_txoptions *opt,
-                         u8 *proto, struct in6_addr **daddr_p);
+                         u8 *proto, struct in6_addr **daddr_p,
+                         struct in6_addr *saddr);
 void ipv6_push_frag_opts(struct sk_buff *skb, struct ipv6_txoptions *opt,
                         u8 *proto);
 
index 541cfa6345e5b763a2e6c57943925cdd024d8d34..72aadce18b5fcdbce3424223ebbbea1f8bea7477 100644 (file)
@@ -866,7 +866,7 @@ int ipv6_parse_hopopts(struct sk_buff *skb)
 
 static void ipv6_push_rthdr(struct sk_buff *skb, u8 *proto,
                            struct ipv6_rt_hdr *opt,
-                           struct in6_addr **addr_p)
+                           struct in6_addr **addr_p, struct in6_addr *saddr)
 {
        struct rt0_hdr *phdr, *ihdr;
        int hops;
@@ -900,10 +900,10 @@ static void ipv6_push_exthdr(struct sk_buff *skb, u8 *proto, u8 type, struct ipv
 
 void ipv6_push_nfrag_opts(struct sk_buff *skb, struct ipv6_txoptions *opt,
                          u8 *proto,
-                         struct in6_addr **daddr)
+                         struct in6_addr **daddr, struct in6_addr *saddr)
 {
        if (opt->srcrt) {
-               ipv6_push_rthdr(skb, proto, opt->srcrt, daddr);
+               ipv6_push_rthdr(skb, proto, opt->srcrt, daddr, saddr);
                /*
                 * IPV6_RTHDRDSTOPTS is ignored
                 * unless IPV6_RTHDR is set (RFC3542).
index 6001e781164eb6d49cf604e7d8067a42ebc7dc3d..ddc878d2cc6d36db01ec4230ef055146a7d6419b 100644 (file)
@@ -203,7 +203,8 @@ int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
                if (opt->opt_flen)
                        ipv6_push_frag_opts(skb, opt, &proto);
                if (opt->opt_nflen)
-                       ipv6_push_nfrag_opts(skb, opt, &proto, &first_hop);
+                       ipv6_push_nfrag_opts(skb, opt, &proto, &first_hop,
+                                            &fl6->saddr);
        }
 
        skb_push(skb, sizeof(struct ipv6hdr));
@@ -1672,7 +1673,7 @@ struct sk_buff *__ip6_make_skb(struct sock *sk,
        if (opt && opt->opt_flen)
                ipv6_push_frag_opts(skb, opt, &proto);
        if (opt && opt->opt_nflen)
-               ipv6_push_nfrag_opts(skb, opt, &proto, &final_dst);
+               ipv6_push_nfrag_opts(skb, opt, &proto, &final_dst, &fl6->saddr);
 
        skb_push(skb, sizeof(struct ipv6hdr));
        skb_reset_network_header(skb);
index bfa889c2a87b80546665cc86637c246561790b64..259e8507d2cd0367916bb46cffd51824ff9fa3cd 100644 (file)
@@ -1157,7 +1157,7 @@ route_lookup:
 
        if (encap_limit >= 0) {
                init_tel_txopt(&opt, encap_limit);
-               ipv6_push_nfrag_opts(skb, &opt.ops, &proto, NULL);
+               ipv6_push_nfrag_opts(skb, &opt.ops, &proto, NULL, NULL);
        }
 
        /* Calculate max headroom for all the headers and adjust