diff options
author | Pavel Emelyanov <xemul@parallels.com> | 2012-10-18 23:55:56 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-10-21 20:42:18 -0400 |
commit | f7b86bfe8d9f10e5a9fcacf52dddf29d0d58a33b (patch) | |
tree | e7f64147632f3636367ba6f020eb217e2ed762d2 /net/core/sock.c | |
parent | 0da5f7c6d2a2653e3c8867df5f226e62377a141f (diff) | |
download | linux-f7b86bfe8d9f10e5a9fcacf52dddf29d0d58a33b.tar.bz2 |
sockopt: Make SO_BINDTODEVICE readable
The SO_BINDTODEVICE option is the only SOL_SOCKET one that can be set, but
cannot be get via sockopt API. The only way we can find the device id a
socket is bound to is via sock-diag interface. But the diag works only on
hashed sockets, while the opt in question can be set for yet unhashed one.
That said, in order to know what device a socket is bound to (we do want
to know this in checkpoint-restore project) I propose to make this option
getsockopt-able and report the respective device index.
Another solution to the problem might be to teach the sock-diag reporting
info on unhashed sockets. Should I go this way instead?
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/sock.c')
-rw-r--r-- | net/core/sock.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/core/sock.c b/net/core/sock.c index 8a146cfcc366..c49412cdd12c 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1074,6 +1074,9 @@ int sock_getsockopt(struct socket *sock, int level, int optname, case SO_NOFCS: v.val = sock_flag(sk, SOCK_NOFCS); break; + case SO_BINDTODEVICE: + v.val = sk->sk_bound_dev_if; + break; default: return -ENOPROTOOPT; } |