Revert "net: socket ioctl to reset connections matching local address"
author黄涛 <huangtao@rock-chips.com>
Sat, 30 Jul 2011 14:57:37 +0000 (22:57 +0800)
committer黄涛 <huangtao@rock-chips.com>
Sat, 30 Jul 2011 14:57:37 +0000 (22:57 +0800)
This reverts commit e97bf10949b28a6815f149fb06167409bd86a297.

include/linux/sockios.h
include/net/tcp.h
net/ipv4/af_inet.c
net/ipv4/devinet.c
net/ipv4/tcp_ipv4.c

index f4fa1a164c74174d7bde557ac2e827831167381a..241f179347d94c7fbbbfb558096f09752bf9a62c 100644 (file)
@@ -65,7 +65,6 @@
 #define SIOCDIFADDR    0x8936          /* delete PA address            */
 #define        SIOCSIFHWBROADCAST      0x8937  /* set hardware broadcast addr  */
 #define SIOCGIFCOUNT   0x8938          /* get number of devices */
-#define SIOCKILLADDR   0x8939          /* kill sockets with this local addr */
 
 #define SIOCGIFBR      0x8940          /* Bridging support             */
 #define SIOCSIFBR      0x8941          /* Set bridging options         */
index 5b0761e2b565bbf9feaf2b2bbf35f9cfd6b5a754..03a49c7033774c9769921e69cd233d55882ad667 100644 (file)
@@ -1443,8 +1443,6 @@ extern struct sk_buff **tcp4_gro_receive(struct sk_buff **head,
 extern int tcp_gro_complete(struct sk_buff *skb);
 extern int tcp4_gro_complete(struct sk_buff *skb);
 
-extern void tcp_v4_nuke_addr(__u32 saddr);
-
 #ifdef CONFIG_PROC_FS
 extern int  tcp4_proc_init(void);
 extern void tcp4_proc_exit(void);
index 941d9752a3c1523f59d7df88eb82f9972d60e754..b395f7d34bd3cf8f28b5d60e138b908fc1f2e191 100644 (file)
@@ -865,7 +865,6 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
        case SIOCSIFPFLAGS:
        case SIOCGIFPFLAGS:
        case SIOCSIFFLAGS:
-       case SIOCKILLADDR:
                err = devinet_ioctl(net, cmd, (void __user *)arg);
                break;
        default:
index d32da9ad500d516c65a38f80824ea0e803e8d49a..5df2f6a0b0f01da83bead89554bb7e7492298646 100644 (file)
@@ -57,7 +57,6 @@
 
 #include <net/arp.h>
 #include <net/ip.h>
-#include <net/tcp.h>
 #include <net/route.h>
 #include <net/ip_fib.h>
 #include <net/rtnetlink.h>
@@ -632,7 +631,6 @@ int devinet_ioctl(struct net *net, unsigned int cmd, void __user *arg)
        case SIOCSIFBRDADDR:    /* Set the broadcast address */
        case SIOCSIFDSTADDR:    /* Set the destination address */
        case SIOCSIFNETMASK:    /* Set the netmask for the interface */
-       case SIOCKILLADDR:      /* Nuke all sockets on this address */
                ret = -EACCES;
                if (!capable(CAP_NET_ADMIN))
                        goto out;
@@ -682,8 +680,7 @@ int devinet_ioctl(struct net *net, unsigned int cmd, void __user *arg)
        }
 
        ret = -EADDRNOTAVAIL;
-       if (!ifa && cmd != SIOCSIFADDR && cmd != SIOCSIFFLAGS
-           && cmd != SIOCKILLADDR)
+       if (!ifa && cmd != SIOCSIFADDR && cmd != SIOCSIFFLAGS)
                goto done;
 
        switch (cmd) {
@@ -807,10 +804,6 @@ int devinet_ioctl(struct net *net, unsigned int cmd, void __user *arg)
                        inet_insert_ifa(ifa);
                }
                break;
-       case SIOCKILLADDR:      /* Nuke all connections on this address */
-               ret = 0;
-               tcp_v4_nuke_addr(sin->sin_addr.s_addr);
-               break;
        }
 done:
        rtnl_unlock();
index 315805d1cedc541b1dcbf55cff0607f88cf4e5b4..7cda24b53f610482dbee6de501334991aba030cb 100644 (file)
@@ -1884,49 +1884,6 @@ void tcp_v4_destroy_sock(struct sock *sk)
 
 EXPORT_SYMBOL(tcp_v4_destroy_sock);
 
-/*
- * tcp_v4_nuke_addr - destroy all sockets on the given local address
- */
-void tcp_v4_nuke_addr(__u32 saddr)
-{
-       unsigned int bucket;
-
-       for (bucket = 0; bucket < tcp_hashinfo.ehash_size; bucket++) {
-               struct hlist_nulls_node *node;
-               struct sock *sk;
-               spinlock_t *lock = inet_ehash_lockp(&tcp_hashinfo, bucket);
-
-restart:
-               spin_lock_bh(lock);
-               sk_nulls_for_each(sk, node, &tcp_hashinfo.ehash[bucket].chain) {
-                       struct inet_sock *inet = inet_sk(sk);
-
-                       if (inet->rcv_saddr != saddr)
-                               continue;
-                       if (sysctl_ip_dynaddr && sk->sk_state == TCP_SYN_SENT)
-                               continue;
-                       if (sock_flag(sk, SOCK_DEAD))
-                               continue;
-
-                       sock_hold(sk);
-                       spin_unlock_bh(lock);
-
-                       local_bh_disable();
-                       bh_lock_sock(sk);
-                       sk->sk_err = ETIMEDOUT;
-                       sk->sk_error_report(sk);
-
-                       tcp_done(sk);
-                       bh_unlock_sock(sk);
-                       local_bh_enable();
-                       sock_put(sk);
-
-                       goto restart;
-               }
-               spin_unlock_bh(lock);
-       }
-}
-
 #ifdef CONFIG_PROC_FS
 /* Proc filesystem TCP sock list dumping. */
 
@@ -2536,3 +2493,4 @@ EXPORT_SYMBOL(tcp_proc_register);
 EXPORT_SYMBOL(tcp_proc_unregister);
 #endif
 EXPORT_SYMBOL(sysctl_tcp_low_latency);
+