Commit 46e5f401 authored by Florent Fourcot's avatar Florent Fourcot Committed by David S. Miller

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: default avatarFlorent Fourcot <florent.fourcot@enst-bretagne.fr>
Acked-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent df3687ff
...@@ -253,7 +253,8 @@ struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions *opt_space, ...@@ -253,7 +253,8 @@ struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions *opt_space,
struct ipv6_txoptions *fopt); struct ipv6_txoptions *fopt);
void fl6_free_socklist(struct sock *sk); void fl6_free_socklist(struct sock *sk);
int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen); int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen);
int ipv6_flowlabel_opt_get(struct sock *sk, struct in6_flowlabel_req *freq); int ipv6_flowlabel_opt_get(struct sock *sk, struct in6_flowlabel_req *freq,
int flags);
int ip6_flowlabel_init(void); int ip6_flowlabel_init(void);
void ip6_flowlabel_cleanup(void); void ip6_flowlabel_cleanup(void);
......
...@@ -86,6 +86,7 @@ struct in6_flowlabel_req { ...@@ -86,6 +86,7 @@ struct in6_flowlabel_req {
#define IPV6_FL_F_CREATE 1 #define IPV6_FL_F_CREATE 1
#define IPV6_FL_F_EXCL 2 #define IPV6_FL_F_EXCL 2
#define IPV6_FL_F_REFLECT 4 #define IPV6_FL_F_REFLECT 4
#define IPV6_FL_F_REMOTE 8
#define IPV6_FL_S_NONE 0 #define IPV6_FL_S_NONE 0
#define IPV6_FL_S_EXCL 1 #define IPV6_FL_S_EXCL 1
......
...@@ -481,11 +481,17 @@ static inline void fl_link(struct ipv6_pinfo *np, struct ipv6_fl_socklist *sfl, ...@@ -481,11 +481,17 @@ static inline void fl_link(struct ipv6_pinfo *np, struct ipv6_fl_socklist *sfl,
spin_unlock_bh(&ip6_sk_fl_lock); spin_unlock_bh(&ip6_sk_fl_lock);
} }
int ipv6_flowlabel_opt_get(struct sock *sk, struct in6_flowlabel_req *freq) int ipv6_flowlabel_opt_get(struct sock *sk, struct in6_flowlabel_req *freq,
int flags)
{ {
struct ipv6_pinfo *np = inet6_sk(sk); struct ipv6_pinfo *np = inet6_sk(sk);
struct ipv6_fl_socklist *sfl; struct ipv6_fl_socklist *sfl;
if (flags & IPV6_FL_F_REMOTE) {
freq->flr_label = np->rcv_flowinfo & IPV6_FLOWLABEL_MASK;
return 0;
}
if (np->repflow) { if (np->repflow) {
freq->flr_label = np->flow_label; freq->flr_label = np->flow_label;
return 0; return 0;
......
...@@ -1221,6 +1221,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname, ...@@ -1221,6 +1221,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
case IPV6_FLOWLABEL_MGR: case IPV6_FLOWLABEL_MGR:
{ {
struct in6_flowlabel_req freq; struct in6_flowlabel_req freq;
int flags;
if (len < sizeof(freq)) if (len < sizeof(freq))
return -EINVAL; return -EINVAL;
...@@ -1232,9 +1233,11 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname, ...@@ -1232,9 +1233,11 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
return -EINVAL; return -EINVAL;
len = sizeof(freq); len = sizeof(freq);
flags = freq.flr_flags;
memset(&freq, 0, sizeof(freq)); memset(&freq, 0, sizeof(freq));
val = ipv6_flowlabel_opt_get(sk, &freq); val = ipv6_flowlabel_opt_get(sk, &freq, flags);
if (val < 0) if (val < 0)
return val; return val;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment