diff options
-rw-r--r-- | include/linux/sockios.h | 4 | ||||
-rw-r--r-- | net/ipv4/tcp.c | 9 |
2 files changed, 12 insertions, 1 deletions
diff --git a/include/linux/sockios.h b/include/linux/sockios.h index 241f179347d9..7997a506ad41 100644 --- a/include/linux/sockios.h +++ b/include/linux/sockios.h | |||
@@ -22,7 +22,7 @@ | |||
22 | 22 | ||
23 | /* Linux-specific socket ioctls */ | 23 | /* Linux-specific socket ioctls */ |
24 | #define SIOCINQ FIONREAD | 24 | #define SIOCINQ FIONREAD |
25 | #define SIOCOUTQ TIOCOUTQ | 25 | #define SIOCOUTQ TIOCOUTQ /* output queue size (not sent + not acked) */ |
26 | 26 | ||
27 | /* Routing table calls. */ | 27 | /* Routing table calls. */ |
28 | #define SIOCADDRT 0x890B /* add routing table entry */ | 28 | #define SIOCADDRT 0x890B /* add routing table entry */ |
@@ -83,6 +83,8 @@ | |||
83 | 83 | ||
84 | #define SIOCWANDEV 0x894A /* get/set netdev parameters */ | 84 | #define SIOCWANDEV 0x894A /* get/set netdev parameters */ |
85 | 85 | ||
86 | #define SIOCOUTQNSD 0x894B /* output queue size (not sent only) */ | ||
87 | |||
86 | /* ARP cache control calls. */ | 88 | /* ARP cache control calls. */ |
87 | /* 0x8950 - 0x8952 * obsolete calls, don't re-use */ | 89 | /* 0x8950 - 0x8952 * obsolete calls, don't re-use */ |
88 | #define SIOCDARP 0x8953 /* delete ARP table entry */ | 90 | #define SIOCDARP 0x8953 /* delete ARP table entry */ |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index a17a5a72b98d..b22d45010545 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -505,6 +505,15 @@ int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg) | |||
505 | else | 505 | else |
506 | answ = tp->write_seq - tp->snd_una; | 506 | answ = tp->write_seq - tp->snd_una; |
507 | break; | 507 | break; |
508 | case SIOCOUTQNSD: | ||
509 | if (sk->sk_state == TCP_LISTEN) | ||
510 | return -EINVAL; | ||
511 | |||
512 | if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) | ||
513 | answ = 0; | ||
514 | else | ||
515 | answ = tp->write_seq - tp->snd_nxt; | ||
516 | break; | ||
508 | default: | 517 | default: |
509 | return -ENOIOCTLCMD; | 518 | return -ENOIOCTLCMD; |
510 | } | 519 | } |