diff options
author | Florent Fourcot <florent.fourcot@enst-bretagne.fr> | 2014-01-17 11:15:04 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-19 20:12:31 -0500 |
commit | 46e5f401762c639e38eea350d335c0f54ec2442f (patch) | |
tree | 76f12d6f2425d05a13f09e27cd66c981b29312f4 /net/ipv6 | |
parent | df3687ffc6653e4d32168338b4dee20c164ed7c9 (diff) |
ipv6: add a flag to get the flow label used remotly
This information is already available via IPV6_FLOWINFO
of IPV6_2292PKTOPTIONS, and them a filtering to get the flow label
information. But it is probably logical and easier for users to add this
here, and to control both sent/received flow label values with the
IPV6_FLOWLABEL_MGR option.
Signed-off-by: Florent Fourcot <florent.fourcot@enst-bretagne.fr>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/ip6_flowlabel.c | 8 | ||||
-rw-r--r-- | net/ipv6/ipv6_sockglue.c | 5 |
2 files changed, 11 insertions, 2 deletions
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c index 55823f187446..01bf2524c72a 100644 --- a/net/ipv6/ip6_flowlabel.c +++ b/net/ipv6/ip6_flowlabel.c | |||
@@ -481,11 +481,17 @@ static inline void fl_link(struct ipv6_pinfo *np, struct ipv6_fl_socklist *sfl, | |||
481 | spin_unlock_bh(&ip6_sk_fl_lock); | 481 | spin_unlock_bh(&ip6_sk_fl_lock); |
482 | } | 482 | } |
483 | 483 | ||
484 | int ipv6_flowlabel_opt_get(struct sock *sk, struct in6_flowlabel_req *freq) | 484 | int ipv6_flowlabel_opt_get(struct sock *sk, struct in6_flowlabel_req *freq, |
485 | int flags) | ||
485 | { | 486 | { |
486 | struct ipv6_pinfo *np = inet6_sk(sk); | 487 | struct ipv6_pinfo *np = inet6_sk(sk); |
487 | struct ipv6_fl_socklist *sfl; | 488 | struct ipv6_fl_socklist *sfl; |
488 | 489 | ||
490 | if (flags & IPV6_FL_F_REMOTE) { | ||
491 | freq->flr_label = np->rcv_flowinfo & IPV6_FLOWLABEL_MASK; | ||
492 | return 0; | ||
493 | } | ||
494 | |||
489 | if (np->repflow) { | 495 | if (np->repflow) { |
490 | freq->flr_label = np->flow_label; | 496 | freq->flr_label = np->flow_label; |
491 | return 0; | 497 | return 0; |
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index 2855b00ed49d..7024a874e901 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c | |||
@@ -1221,6 +1221,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname, | |||
1221 | case IPV6_FLOWLABEL_MGR: | 1221 | case IPV6_FLOWLABEL_MGR: |
1222 | { | 1222 | { |
1223 | struct in6_flowlabel_req freq; | 1223 | struct in6_flowlabel_req freq; |
1224 | int flags; | ||
1224 | 1225 | ||
1225 | if (len < sizeof(freq)) | 1226 | if (len < sizeof(freq)) |
1226 | return -EINVAL; | 1227 | return -EINVAL; |
@@ -1232,9 +1233,11 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname, | |||
1232 | return -EINVAL; | 1233 | return -EINVAL; |
1233 | 1234 | ||
1234 | len = sizeof(freq); | 1235 | len = sizeof(freq); |
1236 | flags = freq.flr_flags; | ||
1237 | |||
1235 | memset(&freq, 0, sizeof(freq)); | 1238 | memset(&freq, 0, sizeof(freq)); |
1236 | 1239 | ||
1237 | val = ipv6_flowlabel_opt_get(sk, &freq); | 1240 | val = ipv6_flowlabel_opt_get(sk, &freq, flags); |
1238 | if (val < 0) | 1241 | if (val < 0) |
1239 | return val; | 1242 | return val; |
1240 | 1243 | ||