diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/ax25/af_ax25.c | 46 | ||||
-rw-r--r-- | net/ax25/ax25_ip.c | 6 | ||||
-rw-r--r-- | net/core/pktgen.c | 13 | ||||
-rw-r--r-- | net/dccp/ccids/ccid3.c | 8 | ||||
-rw-r--r-- | net/ipv4/ipconfig.c | 6 | ||||
-rw-r--r-- | net/ipv4/netfilter/ip_conntrack_ftp.c | 6 | ||||
-rw-r--r-- | net/ipv4/netfilter/ip_conntrack_irc.c | 6 | ||||
-rw-r--r-- | net/ipv4/netfilter/ip_conntrack_netbios_ns.c | 19 | ||||
-rw-r--r-- | net/ipv4/netfilter/ip_conntrack_tftp.c | 6 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_MASQUERADE.c | 6 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_REDIRECT.c | 16 | ||||
-rw-r--r-- | net/irda/ircomm/ircomm_tty.c | 9 | ||||
-rw-r--r-- | net/netrom/af_netrom.c | 28 | ||||
-rw-r--r-- | net/netrom/nr_dev.c | 54 | ||||
-rw-r--r-- | net/netrom/nr_in.c | 15 | ||||
-rw-r--r-- | net/netrom/nr_subr.c | 7 | ||||
-rw-r--r-- | net/netrom/sysctl_net_netrom.c | 12 | ||||
-rw-r--r-- | net/rose/af_rose.c | 8 | ||||
-rw-r--r-- | net/rose/rose_dev.c | 2 | ||||
-rw-r--r-- | net/sunrpc/svcsock.c | 86 |
20 files changed, 181 insertions, 178 deletions
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index ed705ddad56b..8e37e71e34ff 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c | |||
@@ -1695,16 +1695,12 @@ static int ax25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
1695 | /* These two are safe on a single CPU system as only user tasks fiddle here */ | 1695 | /* These two are safe on a single CPU system as only user tasks fiddle here */ |
1696 | if ((skb = skb_peek(&sk->sk_receive_queue)) != NULL) | 1696 | if ((skb = skb_peek(&sk->sk_receive_queue)) != NULL) |
1697 | amount = skb->len; | 1697 | amount = skb->len; |
1698 | res = put_user(amount, (int __user *)argp); | 1698 | res = put_user(amount, (int __user *) argp); |
1699 | break; | 1699 | break; |
1700 | } | 1700 | } |
1701 | 1701 | ||
1702 | case SIOCGSTAMP: | 1702 | case SIOCGSTAMP: |
1703 | if (sk != NULL) { | 1703 | res = sock_get_timestamp(sk, argp); |
1704 | res = sock_get_timestamp(sk, argp); | ||
1705 | break; | ||
1706 | } | ||
1707 | res = -EINVAL; | ||
1708 | break; | 1704 | break; |
1709 | 1705 | ||
1710 | case SIOCAX25ADDUID: /* Add a uid to the uid/call map table */ | 1706 | case SIOCAX25ADDUID: /* Add a uid to the uid/call map table */ |
@@ -1951,24 +1947,24 @@ static struct net_proto_family ax25_family_ops = { | |||
1951 | }; | 1947 | }; |
1952 | 1948 | ||
1953 | static struct proto_ops ax25_proto_ops = { | 1949 | static struct proto_ops ax25_proto_ops = { |
1954 | .family = PF_AX25, | 1950 | .family = PF_AX25, |
1955 | .owner = THIS_MODULE, | 1951 | .owner = THIS_MODULE, |
1956 | .release = ax25_release, | 1952 | .release = ax25_release, |
1957 | .bind = ax25_bind, | 1953 | .bind = ax25_bind, |
1958 | .connect = ax25_connect, | 1954 | .connect = ax25_connect, |
1959 | .socketpair = sock_no_socketpair, | 1955 | .socketpair = sock_no_socketpair, |
1960 | .accept = ax25_accept, | 1956 | .accept = ax25_accept, |
1961 | .getname = ax25_getname, | 1957 | .getname = ax25_getname, |
1962 | .poll = datagram_poll, | 1958 | .poll = datagram_poll, |
1963 | .ioctl = ax25_ioctl, | 1959 | .ioctl = ax25_ioctl, |
1964 | .listen = ax25_listen, | 1960 | .listen = ax25_listen, |
1965 | .shutdown = ax25_shutdown, | 1961 | .shutdown = ax25_shutdown, |
1966 | .setsockopt = ax25_setsockopt, | 1962 | .setsockopt = ax25_setsockopt, |
1967 | .getsockopt = ax25_getsockopt, | 1963 | .getsockopt = ax25_getsockopt, |
1968 | .sendmsg = ax25_sendmsg, | 1964 | .sendmsg = ax25_sendmsg, |
1969 | .recvmsg = ax25_recvmsg, | 1965 | .recvmsg = ax25_recvmsg, |
1970 | .mmap = sock_no_mmap, | 1966 | .mmap = sock_no_mmap, |
1971 | .sendpage = sock_no_sendpage, | 1967 | .sendpage = sock_no_sendpage, |
1972 | }; | 1968 | }; |
1973 | 1969 | ||
1974 | /* | 1970 | /* |
@@ -1984,7 +1980,7 @@ static struct notifier_block ax25_dev_notifier = { | |||
1984 | .notifier_call =ax25_device_event, | 1980 | .notifier_call =ax25_device_event, |
1985 | }; | 1981 | }; |
1986 | 1982 | ||
1987 | EXPORT_SYMBOL(ax25_encapsulate); | 1983 | EXPORT_SYMBOL(ax25_hard_header); |
1988 | EXPORT_SYMBOL(ax25_rebuild_header); | 1984 | EXPORT_SYMBOL(ax25_rebuild_header); |
1989 | EXPORT_SYMBOL(ax25_findbyuid); | 1985 | EXPORT_SYMBOL(ax25_findbyuid); |
1990 | EXPORT_SYMBOL(ax25_find_cb); | 1986 | EXPORT_SYMBOL(ax25_find_cb); |
diff --git a/net/ax25/ax25_ip.c b/net/ax25/ax25_ip.c index bba0173e2d65..d643dac3eccc 100644 --- a/net/ax25/ax25_ip.c +++ b/net/ax25/ax25_ip.c | |||
@@ -47,7 +47,7 @@ | |||
47 | 47 | ||
48 | #ifdef CONFIG_INET | 48 | #ifdef CONFIG_INET |
49 | 49 | ||
50 | int ax25_encapsulate(struct sk_buff *skb, struct net_device *dev, unsigned short type, void *daddr, void *saddr, unsigned len) | 50 | int ax25_hard_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, void *daddr, void *saddr, unsigned len) |
51 | { | 51 | { |
52 | unsigned char *buff; | 52 | unsigned char *buff; |
53 | 53 | ||
@@ -88,7 +88,7 @@ int ax25_encapsulate(struct sk_buff *skb, struct net_device *dev, unsigned short | |||
88 | *buff++ = AX25_P_ARP; | 88 | *buff++ = AX25_P_ARP; |
89 | break; | 89 | break; |
90 | default: | 90 | default: |
91 | printk(KERN_ERR "AX.25: ax25_encapsulate - wrong protocol type 0x%2.2x\n", type); | 91 | printk(KERN_ERR "AX.25: ax25_hard_header - wrong protocol type 0x%2.2x\n", type); |
92 | *buff++ = 0; | 92 | *buff++ = 0; |
93 | break; | 93 | break; |
94 | } | 94 | } |
@@ -209,7 +209,7 @@ put: | |||
209 | 209 | ||
210 | #else /* INET */ | 210 | #else /* INET */ |
211 | 211 | ||
212 | int ax25_encapsulate(struct sk_buff *skb, struct net_device *dev, unsigned short type, void *daddr, void *saddr, unsigned len) | 212 | int ax25_hard_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, void *daddr, void *saddr, unsigned len) |
213 | { | 213 | { |
214 | return -AX25_HEADER_LEN; | 214 | return -AX25_HEADER_LEN; |
215 | } | 215 | } |
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index b3ad49fa7d78..ef430b1e8e42 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -1452,8 +1452,7 @@ static int proc_thread_write(struct file *file, const char __user *user_buffer, | |||
1452 | thread_lock(); | 1452 | thread_lock(); |
1453 | t->control |= T_REMDEV; | 1453 | t->control |= T_REMDEV; |
1454 | thread_unlock(); | 1454 | thread_unlock(); |
1455 | current->state = TASK_INTERRUPTIBLE; | 1455 | schedule_timeout_interruptible(msecs_to_jiffies(125)); /* Propagate thread->control */ |
1456 | schedule_timeout(HZ/8); /* Propagate thread->control */ | ||
1457 | ret = count; | 1456 | ret = count; |
1458 | sprintf(pg_result, "OK: rem_device_all"); | 1457 | sprintf(pg_result, "OK: rem_device_all"); |
1459 | goto out; | 1458 | goto out; |
@@ -1716,10 +1715,9 @@ static void spin(struct pktgen_dev *pkt_dev, __u64 spin_until_us) | |||
1716 | printk(KERN_INFO "sleeping for %d\n", (int)(spin_until_us - now)); | 1715 | printk(KERN_INFO "sleeping for %d\n", (int)(spin_until_us - now)); |
1717 | while (now < spin_until_us) { | 1716 | while (now < spin_until_us) { |
1718 | /* TODO: optimise sleeping behavior */ | 1717 | /* TODO: optimise sleeping behavior */ |
1719 | if (spin_until_us - now > (1000000/HZ)+1) { | 1718 | if (spin_until_us - now > jiffies_to_usecs(1)+1) |
1720 | current->state = TASK_INTERRUPTIBLE; | 1719 | schedule_timeout_interruptible(1); |
1721 | schedule_timeout(1); | 1720 | else if (spin_until_us - now > 100) { |
1722 | } else if (spin_until_us - now > 100) { | ||
1723 | do_softirq(); | 1721 | do_softirq(); |
1724 | if (!pkt_dev->running) | 1722 | if (!pkt_dev->running) |
1725 | return; | 1723 | return; |
@@ -2449,8 +2447,7 @@ static void pktgen_run_all_threads(void) | |||
2449 | } | 2447 | } |
2450 | thread_unlock(); | 2448 | thread_unlock(); |
2451 | 2449 | ||
2452 | current->state = TASK_INTERRUPTIBLE; | 2450 | schedule_timeout_interruptible(msecs_to_jiffies(125)); /* Propagate thread->control */ |
2453 | schedule_timeout(HZ/8); /* Propagate thread->control */ | ||
2454 | 2451 | ||
2455 | pktgen_wait_all_threads_run(); | 2452 | pktgen_wait_all_threads_run(); |
2456 | } | 2453 | } |
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c index e05f4f955eee..38aa84986118 100644 --- a/net/dccp/ccids/ccid3.c +++ b/net/dccp/ccids/ccid3.c | |||
@@ -1095,6 +1095,10 @@ static void ccid3_hc_rx_get_info(struct sock *sk, struct tcp_info *info) | |||
1095 | { | 1095 | { |
1096 | const struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk); | 1096 | const struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk); |
1097 | 1097 | ||
1098 | /* Listen socks doesn't have a private CCID block */ | ||
1099 | if (sk->sk_state == DCCP_LISTEN) | ||
1100 | return; | ||
1101 | |||
1098 | BUG_ON(hcrx == NULL); | 1102 | BUG_ON(hcrx == NULL); |
1099 | 1103 | ||
1100 | info->tcpi_ca_state = hcrx->ccid3hcrx_state; | 1104 | info->tcpi_ca_state = hcrx->ccid3hcrx_state; |
@@ -1106,6 +1110,10 @@ static void ccid3_hc_tx_get_info(struct sock *sk, struct tcp_info *info) | |||
1106 | { | 1110 | { |
1107 | const struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); | 1111 | const struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); |
1108 | 1112 | ||
1113 | /* Listen socks doesn't have a private CCID block */ | ||
1114 | if (sk->sk_state == DCCP_LISTEN) | ||
1115 | return; | ||
1116 | |||
1109 | BUG_ON(hctx == NULL); | 1117 | BUG_ON(hctx == NULL); |
1110 | 1118 | ||
1111 | info->tcpi_rto = hctx->ccid3hctx_t_rto; | 1119 | info->tcpi_rto = hctx->ccid3hctx_t_rto; |
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index 953129d392d2..e8674baaa8d9 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c | |||
@@ -1103,10 +1103,8 @@ static int __init ic_dynamic(void) | |||
1103 | #endif | 1103 | #endif |
1104 | 1104 | ||
1105 | jiff = jiffies + (d->next ? CONF_INTER_TIMEOUT : timeout); | 1105 | jiff = jiffies + (d->next ? CONF_INTER_TIMEOUT : timeout); |
1106 | while (time_before(jiffies, jiff) && !ic_got_reply) { | 1106 | while (time_before(jiffies, jiff) && !ic_got_reply) |
1107 | set_current_state(TASK_UNINTERRUPTIBLE); | 1107 | schedule_timeout_uninterruptible(1); |
1108 | schedule_timeout(1); | ||
1109 | } | ||
1110 | #ifdef IPCONFIG_DHCP | 1108 | #ifdef IPCONFIG_DHCP |
1111 | /* DHCP isn't done until we get a DHCPACK. */ | 1109 | /* DHCP isn't done until we get a DHCPACK. */ |
1112 | if ((ic_got_reply & IC_BOOTP) | 1110 | if ((ic_got_reply & IC_BOOTP) |
diff --git a/net/ipv4/netfilter/ip_conntrack_ftp.c b/net/ipv4/netfilter/ip_conntrack_ftp.c index 1b79ec36085f..d77d6b3f5f80 100644 --- a/net/ipv4/netfilter/ip_conntrack_ftp.c +++ b/net/ipv4/netfilter/ip_conntrack_ftp.c | |||
@@ -29,9 +29,9 @@ static char *ftp_buffer; | |||
29 | static DEFINE_SPINLOCK(ip_ftp_lock); | 29 | static DEFINE_SPINLOCK(ip_ftp_lock); |
30 | 30 | ||
31 | #define MAX_PORTS 8 | 31 | #define MAX_PORTS 8 |
32 | static int ports[MAX_PORTS]; | 32 | static short ports[MAX_PORTS]; |
33 | static int ports_c; | 33 | static int ports_c; |
34 | module_param_array(ports, int, &ports_c, 0400); | 34 | module_param_array(ports, short, &ports_c, 0400); |
35 | 35 | ||
36 | static int loose; | 36 | static int loose; |
37 | module_param(loose, int, 0600); | 37 | module_param(loose, int, 0600); |
@@ -450,7 +450,7 @@ out_update_nl: | |||
450 | } | 450 | } |
451 | 451 | ||
452 | static struct ip_conntrack_helper ftp[MAX_PORTS]; | 452 | static struct ip_conntrack_helper ftp[MAX_PORTS]; |
453 | static char ftp_names[MAX_PORTS][10]; | 453 | static char ftp_names[MAX_PORTS][sizeof("ftp-65535")]; |
454 | 454 | ||
455 | /* Not __exit: called from init() */ | 455 | /* Not __exit: called from init() */ |
456 | static void fini(void) | 456 | static void fini(void) |
diff --git a/net/ipv4/netfilter/ip_conntrack_irc.c b/net/ipv4/netfilter/ip_conntrack_irc.c index d7a8a98c05e1..15457415a4f3 100644 --- a/net/ipv4/netfilter/ip_conntrack_irc.c +++ b/net/ipv4/netfilter/ip_conntrack_irc.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include <linux/moduleparam.h> | 34 | #include <linux/moduleparam.h> |
35 | 35 | ||
36 | #define MAX_PORTS 8 | 36 | #define MAX_PORTS 8 |
37 | static int ports[MAX_PORTS]; | 37 | static short ports[MAX_PORTS]; |
38 | static int ports_c; | 38 | static int ports_c; |
39 | static int max_dcc_channels = 8; | 39 | static int max_dcc_channels = 8; |
40 | static unsigned int dcc_timeout = 300; | 40 | static unsigned int dcc_timeout = 300; |
@@ -52,7 +52,7 @@ EXPORT_SYMBOL_GPL(ip_nat_irc_hook); | |||
52 | MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>"); | 52 | MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>"); |
53 | MODULE_DESCRIPTION("IRC (DCC) connection tracking helper"); | 53 | MODULE_DESCRIPTION("IRC (DCC) connection tracking helper"); |
54 | MODULE_LICENSE("GPL"); | 54 | MODULE_LICENSE("GPL"); |
55 | module_param_array(ports, int, &ports_c, 0400); | 55 | module_param_array(ports, short, &ports_c, 0400); |
56 | MODULE_PARM_DESC(ports, "port numbers of IRC servers"); | 56 | MODULE_PARM_DESC(ports, "port numbers of IRC servers"); |
57 | module_param(max_dcc_channels, int, 0400); | 57 | module_param(max_dcc_channels, int, 0400); |
58 | MODULE_PARM_DESC(max_dcc_channels, "max number of expected DCC channels per IRC session"); | 58 | MODULE_PARM_DESC(max_dcc_channels, "max number of expected DCC channels per IRC session"); |
@@ -240,7 +240,7 @@ static int help(struct sk_buff **pskb, | |||
240 | } | 240 | } |
241 | 241 | ||
242 | static struct ip_conntrack_helper irc_helpers[MAX_PORTS]; | 242 | static struct ip_conntrack_helper irc_helpers[MAX_PORTS]; |
243 | static char irc_names[MAX_PORTS][10]; | 243 | static char irc_names[MAX_PORTS][sizeof("irc-65535")]; |
244 | 244 | ||
245 | static void fini(void); | 245 | static void fini(void); |
246 | 246 | ||
diff --git a/net/ipv4/netfilter/ip_conntrack_netbios_ns.c b/net/ipv4/netfilter/ip_conntrack_netbios_ns.c index bb7246683b74..71ef19d126d0 100644 --- a/net/ipv4/netfilter/ip_conntrack_netbios_ns.c +++ b/net/ipv4/netfilter/ip_conntrack_netbios_ns.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/inetdevice.h> | 23 | #include <linux/inetdevice.h> |
24 | #include <linux/in.h> | 24 | #include <linux/in.h> |
25 | #include <linux/ip.h> | 25 | #include <linux/ip.h> |
26 | #include <linux/udp.h> | ||
27 | #include <net/route.h> | 26 | #include <net/route.h> |
28 | 27 | ||
29 | #include <linux/netfilter.h> | 28 | #include <linux/netfilter.h> |
@@ -31,6 +30,8 @@ | |||
31 | #include <linux/netfilter_ipv4/ip_conntrack.h> | 30 | #include <linux/netfilter_ipv4/ip_conntrack.h> |
32 | #include <linux/netfilter_ipv4/ip_conntrack_helper.h> | 31 | #include <linux/netfilter_ipv4/ip_conntrack_helper.h> |
33 | 32 | ||
33 | #define NMBD_PORT 137 | ||
34 | |||
34 | MODULE_AUTHOR("Patrick McHardy <kaber@trash.net>"); | 35 | MODULE_AUTHOR("Patrick McHardy <kaber@trash.net>"); |
35 | MODULE_DESCRIPTION("NetBIOS name service broadcast connection tracking helper"); | 36 | MODULE_DESCRIPTION("NetBIOS name service broadcast connection tracking helper"); |
36 | MODULE_LICENSE("GPL"); | 37 | MODULE_LICENSE("GPL"); |
@@ -44,7 +45,6 @@ static int help(struct sk_buff **pskb, | |||
44 | { | 45 | { |
45 | struct ip_conntrack_expect *exp; | 46 | struct ip_conntrack_expect *exp; |
46 | struct iphdr *iph = (*pskb)->nh.iph; | 47 | struct iphdr *iph = (*pskb)->nh.iph; |
47 | struct udphdr _uh, *uh; | ||
48 | struct rtable *rt = (struct rtable *)(*pskb)->dst; | 48 | struct rtable *rt = (struct rtable *)(*pskb)->dst; |
49 | struct in_device *in_dev; | 49 | struct in_device *in_dev; |
50 | u_int32_t mask = 0; | 50 | u_int32_t mask = 0; |
@@ -72,20 +72,15 @@ static int help(struct sk_buff **pskb, | |||
72 | if (mask == 0) | 72 | if (mask == 0) |
73 | goto out; | 73 | goto out; |
74 | 74 | ||
75 | uh = skb_header_pointer(*pskb, iph->ihl * 4, sizeof(_uh), &_uh); | ||
76 | BUG_ON(uh == NULL); | ||
77 | |||
78 | exp = ip_conntrack_expect_alloc(ct); | 75 | exp = ip_conntrack_expect_alloc(ct); |
79 | if (exp == NULL) | 76 | if (exp == NULL) |
80 | goto out; | 77 | goto out; |
81 | memset(&exp->tuple, 0, sizeof(exp->tuple)); | ||
82 | exp->tuple.src.ip = iph->daddr & mask; | ||
83 | exp->tuple.dst.ip = iph->saddr; | ||
84 | exp->tuple.dst.u.udp.port = uh->source; | ||
85 | exp->tuple.dst.protonum = IPPROTO_UDP; | ||
86 | 78 | ||
87 | memset(&exp->mask, 0, sizeof(exp->mask)); | 79 | exp->tuple = ct->tuplehash[IP_CT_DIR_REPLY].tuple; |
80 | exp->tuple.src.u.udp.port = ntohs(NMBD_PORT); | ||
81 | |||
88 | exp->mask.src.ip = mask; | 82 | exp->mask.src.ip = mask; |
83 | exp->mask.src.u.udp.port = 0xFFFF; | ||
89 | exp->mask.dst.ip = 0xFFFFFFFF; | 84 | exp->mask.dst.ip = 0xFFFFFFFF; |
90 | exp->mask.dst.u.udp.port = 0xFFFF; | 85 | exp->mask.dst.u.udp.port = 0xFFFF; |
91 | exp->mask.dst.protonum = 0xFF; | 86 | exp->mask.dst.protonum = 0xFF; |
@@ -107,7 +102,7 @@ static struct ip_conntrack_helper helper = { | |||
107 | .src = { | 102 | .src = { |
108 | .u = { | 103 | .u = { |
109 | .udp = { | 104 | .udp = { |
110 | .port = __constant_htons(137), | 105 | .port = __constant_htons(NMBD_PORT), |
111 | } | 106 | } |
112 | } | 107 | } |
113 | }, | 108 | }, |
diff --git a/net/ipv4/netfilter/ip_conntrack_tftp.c b/net/ipv4/netfilter/ip_conntrack_tftp.c index d2b590533452..a78736b8525d 100644 --- a/net/ipv4/netfilter/ip_conntrack_tftp.c +++ b/net/ipv4/netfilter/ip_conntrack_tftp.c | |||
@@ -26,9 +26,9 @@ MODULE_DESCRIPTION("tftp connection tracking helper"); | |||
26 | MODULE_LICENSE("GPL"); | 26 | MODULE_LICENSE("GPL"); |
27 | 27 | ||
28 | #define MAX_PORTS 8 | 28 | #define MAX_PORTS 8 |
29 | static int ports[MAX_PORTS]; | 29 | static short ports[MAX_PORTS]; |
30 | static int ports_c; | 30 | static int ports_c; |
31 | module_param_array(ports, int, &ports_c, 0400); | 31 | module_param_array(ports, short, &ports_c, 0400); |
32 | MODULE_PARM_DESC(ports, "port numbers of tftp servers"); | 32 | MODULE_PARM_DESC(ports, "port numbers of tftp servers"); |
33 | 33 | ||
34 | #if 0 | 34 | #if 0 |
@@ -100,7 +100,7 @@ static int tftp_help(struct sk_buff **pskb, | |||
100 | } | 100 | } |
101 | 101 | ||
102 | static struct ip_conntrack_helper tftp[MAX_PORTS]; | 102 | static struct ip_conntrack_helper tftp[MAX_PORTS]; |
103 | static char tftp_names[MAX_PORTS][10]; | 103 | static char tftp_names[MAX_PORTS][sizeof("tftp-65535")]; |
104 | 104 | ||
105 | static void fini(void) | 105 | static void fini(void) |
106 | { | 106 | { |
diff --git a/net/ipv4/netfilter/ipt_MASQUERADE.c b/net/ipv4/netfilter/ipt_MASQUERADE.c index 2f3e181c8e97..275a174c6fe6 100644 --- a/net/ipv4/netfilter/ipt_MASQUERADE.c +++ b/net/ipv4/netfilter/ipt_MASQUERADE.c | |||
@@ -90,6 +90,12 @@ masquerade_target(struct sk_buff **pskb, | |||
90 | IP_NF_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED | 90 | IP_NF_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED |
91 | || ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY)); | 91 | || ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY)); |
92 | 92 | ||
93 | /* Source address is 0.0.0.0 - locally generated packet that is | ||
94 | * probably not supposed to be masqueraded. | ||
95 | */ | ||
96 | if (ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.ip == 0) | ||
97 | return NF_ACCEPT; | ||
98 | |||
93 | mr = targinfo; | 99 | mr = targinfo; |
94 | rt = (struct rtable *)(*pskb)->dst; | 100 | rt = (struct rtable *)(*pskb)->dst; |
95 | newsrc = inet_select_addr(out, rt->rt_gateway, RT_SCOPE_UNIVERSE); | 101 | newsrc = inet_select_addr(out, rt->rt_gateway, RT_SCOPE_UNIVERSE); |
diff --git a/net/ipv4/netfilter/ipt_REDIRECT.c b/net/ipv4/netfilter/ipt_REDIRECT.c index d2e13447678e..715cb613405c 100644 --- a/net/ipv4/netfilter/ipt_REDIRECT.c +++ b/net/ipv4/netfilter/ipt_REDIRECT.c | |||
@@ -88,14 +88,18 @@ redirect_target(struct sk_buff **pskb, | |||
88 | newdst = htonl(0x7F000001); | 88 | newdst = htonl(0x7F000001); |
89 | else { | 89 | else { |
90 | struct in_device *indev; | 90 | struct in_device *indev; |
91 | struct in_ifaddr *ifa; | ||
91 | 92 | ||
92 | /* Device might not have an associated in_device. */ | 93 | newdst = 0; |
93 | indev = (struct in_device *)(*pskb)->dev->ip_ptr; | 94 | |
94 | if (indev == NULL || indev->ifa_list == NULL) | 95 | rcu_read_lock(); |
95 | return NF_DROP; | 96 | indev = __in_dev_get((*pskb)->dev); |
97 | if (indev && (ifa = indev->ifa_list)) | ||
98 | newdst = ifa->ifa_local; | ||
99 | rcu_read_unlock(); | ||
96 | 100 | ||
97 | /* Grab first address on interface. */ | 101 | if (!newdst) |
98 | newdst = indev->ifa_list->ifa_local; | 102 | return NF_DROP; |
99 | } | 103 | } |
100 | 104 | ||
101 | /* Transfer from original range. */ | 105 | /* Transfer from original range. */ |
diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c index 5d1e61168eb7..6f20b4206e08 100644 --- a/net/irda/ircomm/ircomm_tty.c +++ b/net/irda/ircomm/ircomm_tty.c | |||
@@ -567,10 +567,8 @@ static void ircomm_tty_close(struct tty_struct *tty, struct file *filp) | |||
567 | self->tty = NULL; | 567 | self->tty = NULL; |
568 | 568 | ||
569 | if (self->blocked_open) { | 569 | if (self->blocked_open) { |
570 | if (self->close_delay) { | 570 | if (self->close_delay) |
571 | current->state = TASK_INTERRUPTIBLE; | 571 | schedule_timeout_interruptible(self->close_delay); |
572 | schedule_timeout(self->close_delay); | ||
573 | } | ||
574 | wake_up_interruptible(&self->open_wait); | 572 | wake_up_interruptible(&self->open_wait); |
575 | } | 573 | } |
576 | 574 | ||
@@ -863,8 +861,7 @@ static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout) | |||
863 | spin_lock_irqsave(&self->spinlock, flags); | 861 | spin_lock_irqsave(&self->spinlock, flags); |
864 | while (self->tx_skb && self->tx_skb->len) { | 862 | while (self->tx_skb && self->tx_skb->len) { |
865 | spin_unlock_irqrestore(&self->spinlock, flags); | 863 | spin_unlock_irqrestore(&self->spinlock, flags); |
866 | current->state = TASK_INTERRUPTIBLE; | 864 | schedule_timeout_interruptible(poll_time); |
867 | schedule_timeout(poll_time); | ||
868 | spin_lock_irqsave(&self->spinlock, flags); | 865 | spin_lock_irqsave(&self->spinlock, flags); |
869 | if (signal_pending(current)) | 866 | if (signal_pending(current)) |
870 | break; | 867 | break; |
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index f4578c759ffc..e5d82d711cae 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c | |||
@@ -56,6 +56,7 @@ int sysctl_netrom_transport_requested_window_size = NR_DEFAULT_WINDOW; | |||
56 | int sysctl_netrom_transport_no_activity_timeout = NR_DEFAULT_IDLE; | 56 | int sysctl_netrom_transport_no_activity_timeout = NR_DEFAULT_IDLE; |
57 | int sysctl_netrom_routing_control = NR_DEFAULT_ROUTING; | 57 | int sysctl_netrom_routing_control = NR_DEFAULT_ROUTING; |
58 | int sysctl_netrom_link_fails_count = NR_DEFAULT_FAILS; | 58 | int sysctl_netrom_link_fails_count = NR_DEFAULT_FAILS; |
59 | int sysctl_netrom_reset_circuit = NR_DEFAULT_RESET; | ||
59 | 60 | ||
60 | static unsigned short circuit = 0x101; | 61 | static unsigned short circuit = 0x101; |
61 | 62 | ||
@@ -908,17 +909,17 @@ int nr_rx_frame(struct sk_buff *skb, struct net_device *dev) | |||
908 | if (frametype != NR_CONNREQ) { | 909 | if (frametype != NR_CONNREQ) { |
909 | /* | 910 | /* |
910 | * Here it would be nice to be able to send a reset but | 911 | * Here it would be nice to be able to send a reset but |
911 | * NET/ROM doesn't have one. The following hack would | 912 | * NET/ROM doesn't have one. We've tried to extend the protocol |
912 | * have been a way to extend the protocol but apparently | 913 | * by sending NR_CONNACK | NR_CHOKE_FLAGS replies but that |
913 | * it kills BPQ boxes... :-( | 914 | * apparently kills BPQ boxes... :-( |
915 | * So now we try to follow the established behaviour of | ||
916 | * G8PZT's Xrouter which is sending packets with command type 7 | ||
917 | * as an extension of the protocol. | ||
914 | */ | 918 | */ |
915 | #if 0 | 919 | if (sysctl_netrom_reset_circuit && |
916 | /* | 920 | (frametype != NR_RESET || flags != 0)) |
917 | * Never reply to a CONNACK/CHOKE. | 921 | nr_transmit_reset(skb, 1); |
918 | */ | 922 | |
919 | if (frametype != NR_CONNACK || flags != NR_CHOKE_FLAG) | ||
920 | nr_transmit_refusal(skb, 1); | ||
921 | #endif | ||
922 | return 0; | 923 | return 0; |
923 | } | 924 | } |
924 | 925 | ||
@@ -1187,9 +1188,7 @@ static int nr_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
1187 | } | 1188 | } |
1188 | 1189 | ||
1189 | case SIOCGSTAMP: | 1190 | case SIOCGSTAMP: |
1190 | ret = -EINVAL; | 1191 | ret = sock_get_timestamp(sk, argp); |
1191 | if (sk != NULL) | ||
1192 | ret = sock_get_timestamp(sk, argp); | ||
1193 | release_sock(sk); | 1192 | release_sock(sk); |
1194 | return ret; | 1193 | return ret; |
1195 | 1194 | ||
@@ -1393,8 +1392,7 @@ static int __init nr_proto_init(void) | |||
1393 | struct net_device *dev; | 1392 | struct net_device *dev; |
1394 | 1393 | ||
1395 | sprintf(name, "nr%d", i); | 1394 | sprintf(name, "nr%d", i); |
1396 | dev = alloc_netdev(sizeof(struct net_device_stats), name, | 1395 | dev = alloc_netdev(sizeof(struct nr_private), name, nr_setup); |
1397 | nr_setup); | ||
1398 | if (!dev) { | 1396 | if (!dev) { |
1399 | printk(KERN_ERR "NET/ROM: nr_proto_init - unable to allocate device structure\n"); | 1397 | printk(KERN_ERR "NET/ROM: nr_proto_init - unable to allocate device structure\n"); |
1400 | goto fail; | 1398 | goto fail; |
diff --git a/net/netrom/nr_dev.c b/net/netrom/nr_dev.c index 263da4c26494..4e66eef9a034 100644 --- a/net/netrom/nr_dev.c +++ b/net/netrom/nr_dev.c | |||
@@ -47,7 +47,7 @@ int nr_rx_ip(struct sk_buff *skb, struct net_device *dev) | |||
47 | struct net_device_stats *stats = netdev_priv(dev); | 47 | struct net_device_stats *stats = netdev_priv(dev); |
48 | 48 | ||
49 | if (!netif_running(dev)) { | 49 | if (!netif_running(dev)) { |
50 | stats->rx_errors++; | 50 | stats->rx_dropped++; |
51 | return 0; | 51 | return 0; |
52 | } | 52 | } |
53 | 53 | ||
@@ -71,15 +71,10 @@ int nr_rx_ip(struct sk_buff *skb, struct net_device *dev) | |||
71 | 71 | ||
72 | static int nr_rebuild_header(struct sk_buff *skb) | 72 | static int nr_rebuild_header(struct sk_buff *skb) |
73 | { | 73 | { |
74 | struct net_device *dev = skb->dev; | ||
75 | struct net_device_stats *stats = netdev_priv(dev); | ||
76 | struct sk_buff *skbn; | ||
77 | unsigned char *bp = skb->data; | 74 | unsigned char *bp = skb->data; |
78 | int len; | ||
79 | 75 | ||
80 | if (arp_find(bp + 7, skb)) { | 76 | if (arp_find(bp + 7, skb)) |
81 | return 1; | 77 | return 1; |
82 | } | ||
83 | 78 | ||
84 | bp[6] &= ~AX25_CBIT; | 79 | bp[6] &= ~AX25_CBIT; |
85 | bp[6] &= ~AX25_EBIT; | 80 | bp[6] &= ~AX25_EBIT; |
@@ -90,27 +85,7 @@ static int nr_rebuild_header(struct sk_buff *skb) | |||
90 | bp[6] |= AX25_EBIT; | 85 | bp[6] |= AX25_EBIT; |
91 | bp[6] |= AX25_SSSID_SPARE; | 86 | bp[6] |= AX25_SSSID_SPARE; |
92 | 87 | ||
93 | if ((skbn = skb_clone(skb, GFP_ATOMIC)) == NULL) { | 88 | return 0; |
94 | kfree_skb(skb); | ||
95 | return 1; | ||
96 | } | ||
97 | |||
98 | if (skb->sk != NULL) | ||
99 | skb_set_owner_w(skbn, skb->sk); | ||
100 | |||
101 | kfree_skb(skb); | ||
102 | |||
103 | len = skbn->len; | ||
104 | |||
105 | if (!nr_route_frame(skbn, NULL)) { | ||
106 | kfree_skb(skbn); | ||
107 | stats->tx_errors++; | ||
108 | } | ||
109 | |||
110 | stats->tx_packets++; | ||
111 | stats->tx_bytes += len; | ||
112 | |||
113 | return 1; | ||
114 | } | 89 | } |
115 | 90 | ||
116 | #else | 91 | #else |
@@ -185,15 +160,27 @@ static int nr_close(struct net_device *dev) | |||
185 | 160 | ||
186 | static int nr_xmit(struct sk_buff *skb, struct net_device *dev) | 161 | static int nr_xmit(struct sk_buff *skb, struct net_device *dev) |
187 | { | 162 | { |
188 | struct net_device_stats *stats = netdev_priv(dev); | 163 | struct nr_private *nr = netdev_priv(dev); |
189 | dev_kfree_skb(skb); | 164 | struct net_device_stats *stats = &nr->stats; |
190 | stats->tx_errors++; | 165 | unsigned int len = skb->len; |
166 | |||
167 | if (!nr_route_frame(skb, NULL)) { | ||
168 | kfree_skb(skb); | ||
169 | stats->tx_errors++; | ||
170 | return 0; | ||
171 | } | ||
172 | |||
173 | stats->tx_packets++; | ||
174 | stats->tx_bytes += len; | ||
175 | |||
191 | return 0; | 176 | return 0; |
192 | } | 177 | } |
193 | 178 | ||
194 | static struct net_device_stats *nr_get_stats(struct net_device *dev) | 179 | static struct net_device_stats *nr_get_stats(struct net_device *dev) |
195 | { | 180 | { |
196 | return netdev_priv(dev); | 181 | struct nr_private *nr = netdev_priv(dev); |
182 | |||
183 | return &nr->stats; | ||
197 | } | 184 | } |
198 | 185 | ||
199 | void nr_setup(struct net_device *dev) | 186 | void nr_setup(struct net_device *dev) |
@@ -208,12 +195,11 @@ void nr_setup(struct net_device *dev) | |||
208 | dev->hard_header_len = NR_NETWORK_LEN + NR_TRANSPORT_LEN; | 195 | dev->hard_header_len = NR_NETWORK_LEN + NR_TRANSPORT_LEN; |
209 | dev->addr_len = AX25_ADDR_LEN; | 196 | dev->addr_len = AX25_ADDR_LEN; |
210 | dev->type = ARPHRD_NETROM; | 197 | dev->type = ARPHRD_NETROM; |
211 | dev->tx_queue_len = 40; | ||
212 | dev->rebuild_header = nr_rebuild_header; | 198 | dev->rebuild_header = nr_rebuild_header; |
213 | dev->set_mac_address = nr_set_mac_address; | 199 | dev->set_mac_address = nr_set_mac_address; |
214 | 200 | ||
215 | /* New-style flags. */ | 201 | /* New-style flags. */ |
216 | dev->flags = 0; | 202 | dev->flags = IFF_NOARP; |
217 | 203 | ||
218 | dev->get_stats = nr_get_stats; | 204 | dev->get_stats = nr_get_stats; |
219 | } | 205 | } |
diff --git a/net/netrom/nr_in.c b/net/netrom/nr_in.c index 64b81a796907..004e8599b8fe 100644 --- a/net/netrom/nr_in.c +++ b/net/netrom/nr_in.c | |||
@@ -98,6 +98,11 @@ static int nr_state1_machine(struct sock *sk, struct sk_buff *skb, | |||
98 | nr_disconnect(sk, ECONNREFUSED); | 98 | nr_disconnect(sk, ECONNREFUSED); |
99 | break; | 99 | break; |
100 | 100 | ||
101 | case NR_RESET: | ||
102 | if (sysctl_netrom_reset_circuit); | ||
103 | nr_disconnect(sk, ECONNRESET); | ||
104 | break; | ||
105 | |||
101 | default: | 106 | default: |
102 | break; | 107 | break; |
103 | } | 108 | } |
@@ -124,6 +129,11 @@ static int nr_state2_machine(struct sock *sk, struct sk_buff *skb, | |||
124 | nr_disconnect(sk, 0); | 129 | nr_disconnect(sk, 0); |
125 | break; | 130 | break; |
126 | 131 | ||
132 | case NR_RESET: | ||
133 | if (sysctl_netrom_reset_circuit); | ||
134 | nr_disconnect(sk, ECONNRESET); | ||
135 | break; | ||
136 | |||
127 | default: | 137 | default: |
128 | break; | 138 | break; |
129 | } | 139 | } |
@@ -254,6 +264,11 @@ static int nr_state3_machine(struct sock *sk, struct sk_buff *skb, int frametype | |||
254 | } | 264 | } |
255 | break; | 265 | break; |
256 | 266 | ||
267 | case NR_RESET: | ||
268 | if (sysctl_netrom_reset_circuit); | ||
269 | nr_disconnect(sk, ECONNRESET); | ||
270 | break; | ||
271 | |||
257 | default: | 272 | default: |
258 | break; | 273 | break; |
259 | } | 274 | } |
diff --git a/net/netrom/nr_subr.c b/net/netrom/nr_subr.c index 587bed2674bf..bcb9946b4f56 100644 --- a/net/netrom/nr_subr.c +++ b/net/netrom/nr_subr.c | |||
@@ -210,10 +210,9 @@ void nr_write_internal(struct sock *sk, int frametype) | |||
210 | } | 210 | } |
211 | 211 | ||
212 | /* | 212 | /* |
213 | * This routine is called when a Connect Acknowledge with the Choke Flag | 213 | * This routine is called to send an error reply. |
214 | * set is needed to refuse a connection. | ||
215 | */ | 214 | */ |
216 | void nr_transmit_refusal(struct sk_buff *skb, int mine) | 215 | void __nr_transmit_reply(struct sk_buff *skb, int mine, unsigned char cmdflags) |
217 | { | 216 | { |
218 | struct sk_buff *skbn; | 217 | struct sk_buff *skbn; |
219 | unsigned char *dptr; | 218 | unsigned char *dptr; |
@@ -254,7 +253,7 @@ void nr_transmit_refusal(struct sk_buff *skb, int mine) | |||
254 | *dptr++ = 0; | 253 | *dptr++ = 0; |
255 | } | 254 | } |
256 | 255 | ||
257 | *dptr++ = NR_CONNACK | NR_CHOKE_FLAG; | 256 | *dptr++ = cmdflags; |
258 | *dptr++ = 0; | 257 | *dptr++ = 0; |
259 | 258 | ||
260 | if (!nr_route_frame(skbn, NULL)) | 259 | if (!nr_route_frame(skbn, NULL)) |
diff --git a/net/netrom/sysctl_net_netrom.c b/net/netrom/sysctl_net_netrom.c index c9ed50382ea7..6bb8dda849dc 100644 --- a/net/netrom/sysctl_net_netrom.c +++ b/net/netrom/sysctl_net_netrom.c | |||
@@ -30,6 +30,7 @@ static int min_idle[] = {0 * HZ}; | |||
30 | static int max_idle[] = {65535 * HZ}; | 30 | static int max_idle[] = {65535 * HZ}; |
31 | static int min_route[] = {0}, max_route[] = {1}; | 31 | static int min_route[] = {0}, max_route[] = {1}; |
32 | static int min_fails[] = {1}, max_fails[] = {10}; | 32 | static int min_fails[] = {1}, max_fails[] = {10}; |
33 | static int min_reset[] = {0}, max_reset[] = {1}; | ||
33 | 34 | ||
34 | static struct ctl_table_header *nr_table_header; | 35 | static struct ctl_table_header *nr_table_header; |
35 | 36 | ||
@@ -155,6 +156,17 @@ static ctl_table nr_table[] = { | |||
155 | .extra1 = &min_fails, | 156 | .extra1 = &min_fails, |
156 | .extra2 = &max_fails | 157 | .extra2 = &max_fails |
157 | }, | 158 | }, |
159 | { | ||
160 | .ctl_name = NET_NETROM_RESET, | ||
161 | .procname = "reset", | ||
162 | .data = &sysctl_netrom_reset_circuit, | ||
163 | .maxlen = sizeof(int), | ||
164 | .mode = 0644, | ||
165 | .proc_handler = &proc_dointvec_minmax, | ||
166 | .strategy = &sysctl_intvec, | ||
167 | .extra1 = &min_reset, | ||
168 | .extra2 = &max_reset | ||
169 | }, | ||
158 | { .ctl_name = 0 } | 170 | { .ctl_name = 0 } |
159 | }; | 171 | }; |
160 | 172 | ||
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index 3077878ed4f0..5acb1680524a 100644 --- a/net/rose/af_rose.c +++ b/net/rose/af_rose.c | |||
@@ -1243,7 +1243,7 @@ static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
1243 | amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc); | 1243 | amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc); |
1244 | if (amount < 0) | 1244 | if (amount < 0) |
1245 | amount = 0; | 1245 | amount = 0; |
1246 | return put_user(amount, (unsigned int __user *)argp); | 1246 | return put_user(amount, (unsigned int __user *) argp); |
1247 | } | 1247 | } |
1248 | 1248 | ||
1249 | case TIOCINQ: { | 1249 | case TIOCINQ: { |
@@ -1252,13 +1252,11 @@ static int rose_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
1252 | /* These two are safe on a single CPU system as only user tasks fiddle here */ | 1252 | /* These two are safe on a single CPU system as only user tasks fiddle here */ |
1253 | if ((skb = skb_peek(&sk->sk_receive_queue)) != NULL) | 1253 | if ((skb = skb_peek(&sk->sk_receive_queue)) != NULL) |
1254 | amount = skb->len; | 1254 | amount = skb->len; |
1255 | return put_user(amount, (unsigned int __user *)argp); | 1255 | return put_user(amount, (unsigned int __user *) argp); |
1256 | } | 1256 | } |
1257 | 1257 | ||
1258 | case SIOCGSTAMP: | 1258 | case SIOCGSTAMP: |
1259 | if (sk != NULL) | 1259 | return sock_get_timestamp(sk, (struct timeval __user *) argp); |
1260 | return sock_get_timestamp(sk, (struct timeval __user *)argp); | ||
1261 | return -EINVAL; | ||
1262 | 1260 | ||
1263 | case SIOCGIFADDR: | 1261 | case SIOCGIFADDR: |
1264 | case SIOCSIFADDR: | 1262 | case SIOCSIFADDR: |
diff --git a/net/rose/rose_dev.c b/net/rose/rose_dev.c index a8ed9a1d09f9..d297af737d10 100644 --- a/net/rose/rose_dev.c +++ b/net/rose/rose_dev.c | |||
@@ -149,6 +149,6 @@ void rose_setup(struct net_device *dev) | |||
149 | dev->set_mac_address = rose_set_mac_address; | 149 | dev->set_mac_address = rose_set_mac_address; |
150 | 150 | ||
151 | /* New-style flags. */ | 151 | /* New-style flags. */ |
152 | dev->flags = 0; | 152 | dev->flags = IFF_NOARP; |
153 | dev->get_stats = rose_get_stats; | 153 | dev->get_stats = rose_get_stats; |
154 | } | 154 | } |
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 05fe2e735538..30ec3efc48a6 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
@@ -512,15 +512,14 @@ svc_sock_setbufsize(struct socket *sock, unsigned int snd, unsigned int rcv) | |||
512 | static void | 512 | static void |
513 | svc_udp_data_ready(struct sock *sk, int count) | 513 | svc_udp_data_ready(struct sock *sk, int count) |
514 | { | 514 | { |
515 | struct svc_sock *svsk = (struct svc_sock *)(sk->sk_user_data); | 515 | struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data; |
516 | 516 | ||
517 | if (!svsk) | 517 | if (svsk) { |
518 | goto out; | 518 | dprintk("svc: socket %p(inet %p), count=%d, busy=%d\n", |
519 | dprintk("svc: socket %p(inet %p), count=%d, busy=%d\n", | 519 | svsk, sk, count, test_bit(SK_BUSY, &svsk->sk_flags)); |
520 | svsk, sk, count, test_bit(SK_BUSY, &svsk->sk_flags)); | 520 | set_bit(SK_DATA, &svsk->sk_flags); |
521 | set_bit(SK_DATA, &svsk->sk_flags); | 521 | svc_sock_enqueue(svsk); |
522 | svc_sock_enqueue(svsk); | 522 | } |
523 | out: | ||
524 | if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) | 523 | if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) |
525 | wake_up_interruptible(sk->sk_sleep); | 524 | wake_up_interruptible(sk->sk_sleep); |
526 | } | 525 | } |
@@ -540,7 +539,7 @@ svc_write_space(struct sock *sk) | |||
540 | } | 539 | } |
541 | 540 | ||
542 | if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) { | 541 | if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) { |
543 | printk(KERN_WARNING "RPC svc_write_space: some sleeping on %p\n", | 542 | dprintk("RPC svc_write_space: someone sleeping on %p\n", |
544 | svsk); | 543 | svsk); |
545 | wake_up_interruptible(sk->sk_sleep); | 544 | wake_up_interruptible(sk->sk_sleep); |
546 | } | 545 | } |
@@ -692,31 +691,29 @@ svc_udp_init(struct svc_sock *svsk) | |||
692 | static void | 691 | static void |
693 | svc_tcp_listen_data_ready(struct sock *sk, int count_unused) | 692 | svc_tcp_listen_data_ready(struct sock *sk, int count_unused) |
694 | { | 693 | { |
695 | struct svc_sock *svsk; | 694 | struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data; |
696 | 695 | ||
697 | dprintk("svc: socket %p TCP (listen) state change %d\n", | 696 | dprintk("svc: socket %p TCP (listen) state change %d\n", |
698 | sk, sk->sk_state); | 697 | sk, sk->sk_state); |
699 | 698 | ||
700 | if (sk->sk_state != TCP_LISTEN) { | 699 | /* |
701 | /* | 700 | * This callback may called twice when a new connection |
702 | * This callback may called twice when a new connection | 701 | * is established as a child socket inherits everything |
703 | * is established as a child socket inherits everything | 702 | * from a parent LISTEN socket. |
704 | * from a parent LISTEN socket. | 703 | * 1) data_ready method of the parent socket will be called |
705 | * 1) data_ready method of the parent socket will be called | 704 | * when one of child sockets become ESTABLISHED. |
706 | * when one of child sockets become ESTABLISHED. | 705 | * 2) data_ready method of the child socket may be called |
707 | * 2) data_ready method of the child socket may be called | 706 | * when it receives data before the socket is accepted. |
708 | * when it receives data before the socket is accepted. | 707 | * In case of 2, we should ignore it silently. |
709 | * In case of 2, we should ignore it silently. | 708 | */ |
710 | */ | 709 | if (sk->sk_state == TCP_LISTEN) { |
711 | goto out; | 710 | if (svsk) { |
712 | } | 711 | set_bit(SK_CONN, &svsk->sk_flags); |
713 | if (!(svsk = (struct svc_sock *) sk->sk_user_data)) { | 712 | svc_sock_enqueue(svsk); |
714 | printk("svc: socket %p: no user data\n", sk); | 713 | } else |
715 | goto out; | 714 | printk("svc: socket %p: no user data\n", sk); |
716 | } | 715 | } |
717 | set_bit(SK_CONN, &svsk->sk_flags); | 716 | |
718 | svc_sock_enqueue(svsk); | ||
719 | out: | ||
720 | if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) | 717 | if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) |
721 | wake_up_interruptible_all(sk->sk_sleep); | 718 | wake_up_interruptible_all(sk->sk_sleep); |
722 | } | 719 | } |
@@ -727,18 +724,17 @@ svc_tcp_listen_data_ready(struct sock *sk, int count_unused) | |||
727 | static void | 724 | static void |
728 | svc_tcp_state_change(struct sock *sk) | 725 | svc_tcp_state_change(struct sock *sk) |
729 | { | 726 | { |
730 | struct svc_sock *svsk; | 727 | struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data; |
731 | 728 | ||
732 | dprintk("svc: socket %p TCP (connected) state change %d (svsk %p)\n", | 729 | dprintk("svc: socket %p TCP (connected) state change %d (svsk %p)\n", |
733 | sk, sk->sk_state, sk->sk_user_data); | 730 | sk, sk->sk_state, sk->sk_user_data); |
734 | 731 | ||
735 | if (!(svsk = (struct svc_sock *) sk->sk_user_data)) { | 732 | if (!svsk) |
736 | printk("svc: socket %p: no user data\n", sk); | 733 | printk("svc: socket %p: no user data\n", sk); |
737 | goto out; | 734 | else { |
735 | set_bit(SK_CLOSE, &svsk->sk_flags); | ||
736 | svc_sock_enqueue(svsk); | ||
738 | } | 737 | } |
739 | set_bit(SK_CLOSE, &svsk->sk_flags); | ||
740 | svc_sock_enqueue(svsk); | ||
741 | out: | ||
742 | if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) | 738 | if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) |
743 | wake_up_interruptible_all(sk->sk_sleep); | 739 | wake_up_interruptible_all(sk->sk_sleep); |
744 | } | 740 | } |
@@ -746,15 +742,14 @@ svc_tcp_state_change(struct sock *sk) | |||
746 | static void | 742 | static void |
747 | svc_tcp_data_ready(struct sock *sk, int count) | 743 | svc_tcp_data_ready(struct sock *sk, int count) |
748 | { | 744 | { |
749 | struct svc_sock * svsk; | 745 | struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data; |
750 | 746 | ||
751 | dprintk("svc: socket %p TCP data ready (svsk %p)\n", | 747 | dprintk("svc: socket %p TCP data ready (svsk %p)\n", |
752 | sk, sk->sk_user_data); | 748 | sk, sk->sk_user_data); |
753 | if (!(svsk = (struct svc_sock *)(sk->sk_user_data))) | 749 | if (svsk) { |
754 | goto out; | 750 | set_bit(SK_DATA, &svsk->sk_flags); |
755 | set_bit(SK_DATA, &svsk->sk_flags); | 751 | svc_sock_enqueue(svsk); |
756 | svc_sock_enqueue(svsk); | 752 | } |
757 | out: | ||
758 | if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) | 753 | if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) |
759 | wake_up_interruptible(sk->sk_sleep); | 754 | wake_up_interruptible(sk->sk_sleep); |
760 | } | 755 | } |
@@ -1170,8 +1165,7 @@ svc_recv(struct svc_serv *serv, struct svc_rqst *rqstp, long timeout) | |||
1170 | while (rqstp->rq_arghi < pages) { | 1165 | while (rqstp->rq_arghi < pages) { |
1171 | struct page *p = alloc_page(GFP_KERNEL); | 1166 | struct page *p = alloc_page(GFP_KERNEL); |
1172 | if (!p) { | 1167 | if (!p) { |
1173 | set_current_state(TASK_UNINTERRUPTIBLE); | 1168 | schedule_timeout_uninterruptible(msecs_to_jiffies(500)); |
1174 | schedule_timeout(HZ/2); | ||
1175 | continue; | 1169 | continue; |
1176 | } | 1170 | } |
1177 | rqstp->rq_argpages[rqstp->rq_arghi++] = p; | 1171 | rqstp->rq_argpages[rqstp->rq_arghi++] = p; |