diff options
author | David Woodhouse <dwmw2@shinybook.infradead.org> | 2005-06-18 03:36:46 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@shinybook.infradead.org> | 2005-06-18 03:36:46 -0400 |
commit | 0107b3cf3225aed6ddde4fa8dbcd4ed643b34f4d (patch) | |
tree | 9b9337ae627fc56a0eda43c60860765f25efaa0b /net | |
parent | 1c3f45ab2f7f879ea482501c83899505c31f7539 (diff) | |
parent | 9ee1c939d1cb936b1f98e8d81aeffab57bae46ab (diff) |
Merge with master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Diffstat (limited to 'net')
-rw-r--r-- | net/core/dev.c | 1 | ||||
-rw-r--r-- | net/core/ethtool.c | 2 | ||||
-rw-r--r-- | net/core/net-sysfs.c | 17 | ||||
-rw-r--r-- | net/ipv4/af_inet.c | 1 | ||||
-rw-r--r-- | net/ipv4/icmp.c | 9 | ||||
-rw-r--r-- | net/ipv4/ipvs/Makefile | 2 | ||||
-rw-r--r-- | net/ipv4/ipvs/ip_vs_proto.c | 3 | ||||
-rw-r--r-- | net/ipv4/ipvs/ip_vs_proto_icmp.c | 182 | ||||
-rw-r--r-- | net/ipv4/multipath_drr.c | 2 | ||||
-rw-r--r-- | net/ipv4/multipath_random.c | 2 | ||||
-rw-r--r-- | net/ipv4/multipath_rr.c | 2 | ||||
-rw-r--r-- | net/ipv4/multipath_wrandom.c | 2 | ||||
-rw-r--r-- | net/ipv4/netfilter/ip_conntrack_standalone.c | 1 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_recent.c | 10 | ||||
-rw-r--r-- | net/ipv4/sysctl_net_ipv4.c | 9 | ||||
-rw-r--r-- | net/ipv4/tcp.c | 2 | ||||
-rw-r--r-- | net/ipv6/addrconf.c | 1 | ||||
-rw-r--r-- | net/ipv6/icmp.c | 14 | ||||
-rw-r--r-- | net/ipv6/ip6_tunnel.c | 1 | ||||
-rw-r--r-- | net/ipv6/ipv6_syms.c | 1 | ||||
-rw-r--r-- | net/sched/Kconfig | 2 | ||||
-rw-r--r-- | net/sched/act_api.c | 2 | ||||
-rw-r--r-- | net/sched/cls_basic.c | 3 | ||||
-rw-r--r-- | net/sched/em_meta.c | 295 | ||||
-rw-r--r-- | net/sctp/input.c | 49 | ||||
-rw-r--r-- | net/sctp/ipv6.c | 36 | ||||
-rw-r--r-- | net/sctp/proc.c | 194 | ||||
-rw-r--r-- | net/sctp/protocol.c | 7 | ||||
-rw-r--r-- | net/sctp/socket.c | 12 |
29 files changed, 555 insertions, 309 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index f15a3ffff635..ab935778ce81 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1744,6 +1744,7 @@ static int process_backlog(struct net_device *backlog_dev, int *budget) | |||
1744 | struct softnet_data *queue = &__get_cpu_var(softnet_data); | 1744 | struct softnet_data *queue = &__get_cpu_var(softnet_data); |
1745 | unsigned long start_time = jiffies; | 1745 | unsigned long start_time = jiffies; |
1746 | 1746 | ||
1747 | backlog_dev->weight = weight_p; | ||
1747 | for (;;) { | 1748 | for (;;) { |
1748 | struct sk_buff *skb; | 1749 | struct sk_buff *skb; |
1749 | struct net_device *dev; | 1750 | struct net_device *dev; |
diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 8ec484894d68..a3eeb88e1c81 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c | |||
@@ -356,7 +356,7 @@ static int ethtool_set_coalesce(struct net_device *dev, void __user *useraddr) | |||
356 | { | 356 | { |
357 | struct ethtool_coalesce coalesce; | 357 | struct ethtool_coalesce coalesce; |
358 | 358 | ||
359 | if (!dev->ethtool_ops->get_coalesce) | 359 | if (!dev->ethtool_ops->set_coalesce) |
360 | return -EOPNOTSUPP; | 360 | return -EOPNOTSUPP; |
361 | 361 | ||
362 | if (copy_from_user(&coalesce, useraddr, sizeof(coalesce))) | 362 | if (copy_from_user(&coalesce, useraddr, sizeof(coalesce))) |
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 910eb4c05a47..e2137f3e489d 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c | |||
@@ -185,6 +185,22 @@ static ssize_t store_tx_queue_len(struct class_device *dev, const char *buf, siz | |||
185 | static CLASS_DEVICE_ATTR(tx_queue_len, S_IRUGO | S_IWUSR, show_tx_queue_len, | 185 | static CLASS_DEVICE_ATTR(tx_queue_len, S_IRUGO | S_IWUSR, show_tx_queue_len, |
186 | store_tx_queue_len); | 186 | store_tx_queue_len); |
187 | 187 | ||
188 | NETDEVICE_SHOW(weight, fmt_dec); | ||
189 | |||
190 | static int change_weight(struct net_device *net, unsigned long new_weight) | ||
191 | { | ||
192 | net->weight = new_weight; | ||
193 | return 0; | ||
194 | } | ||
195 | |||
196 | static ssize_t store_weight(struct class_device *dev, const char *buf, size_t len) | ||
197 | { | ||
198 | return netdev_store(dev, buf, len, change_weight); | ||
199 | } | ||
200 | |||
201 | static CLASS_DEVICE_ATTR(weight, S_IRUGO | S_IWUSR, show_weight, | ||
202 | store_weight); | ||
203 | |||
188 | 204 | ||
189 | static struct class_device_attribute *net_class_attributes[] = { | 205 | static struct class_device_attribute *net_class_attributes[] = { |
190 | &class_device_attr_ifindex, | 206 | &class_device_attr_ifindex, |
@@ -194,6 +210,7 @@ static struct class_device_attribute *net_class_attributes[] = { | |||
194 | &class_device_attr_features, | 210 | &class_device_attr_features, |
195 | &class_device_attr_mtu, | 211 | &class_device_attr_mtu, |
196 | &class_device_attr_flags, | 212 | &class_device_attr_flags, |
213 | &class_device_attr_weight, | ||
197 | &class_device_attr_type, | 214 | &class_device_attr_type, |
198 | &class_device_attr_address, | 215 | &class_device_attr_address, |
199 | &class_device_attr_broadcast, | 216 | &class_device_attr_broadcast, |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index b3cb49ce5fad..03942f133944 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -1181,6 +1181,7 @@ EXPORT_SYMBOL(inet_stream_connect); | |||
1181 | EXPORT_SYMBOL(inet_stream_ops); | 1181 | EXPORT_SYMBOL(inet_stream_ops); |
1182 | EXPORT_SYMBOL(inet_unregister_protosw); | 1182 | EXPORT_SYMBOL(inet_unregister_protosw); |
1183 | EXPORT_SYMBOL(net_statistics); | 1183 | EXPORT_SYMBOL(net_statistics); |
1184 | EXPORT_SYMBOL(sysctl_ip_nonlocal_bind); | ||
1184 | 1185 | ||
1185 | #ifdef INET_REFCNT_DEBUG | 1186 | #ifdef INET_REFCNT_DEBUG |
1186 | EXPORT_SYMBOL(inet_sock_nr); | 1187 | EXPORT_SYMBOL(inet_sock_nr); |
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 85bf0d3e294b..cb759484979d 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c | |||
@@ -207,6 +207,7 @@ int sysctl_icmp_ignore_bogus_error_responses; | |||
207 | 207 | ||
208 | int sysctl_icmp_ratelimit = 1 * HZ; | 208 | int sysctl_icmp_ratelimit = 1 * HZ; |
209 | int sysctl_icmp_ratemask = 0x1818; | 209 | int sysctl_icmp_ratemask = 0x1818; |
210 | int sysctl_icmp_errors_use_inbound_ifaddr; | ||
210 | 211 | ||
211 | /* | 212 | /* |
212 | * ICMP control array. This specifies what to do with each ICMP. | 213 | * ICMP control array. This specifies what to do with each ICMP. |
@@ -511,8 +512,12 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, u32 info) | |||
511 | */ | 512 | */ |
512 | 513 | ||
513 | saddr = iph->daddr; | 514 | saddr = iph->daddr; |
514 | if (!(rt->rt_flags & RTCF_LOCAL)) | 515 | if (!(rt->rt_flags & RTCF_LOCAL)) { |
515 | saddr = 0; | 516 | if (sysctl_icmp_errors_use_inbound_ifaddr) |
517 | saddr = inet_select_addr(skb_in->dev, 0, RT_SCOPE_LINK); | ||
518 | else | ||
519 | saddr = 0; | ||
520 | } | ||
516 | 521 | ||
517 | tos = icmp_pointers[type].error ? ((iph->tos & IPTOS_TOS_MASK) | | 522 | tos = icmp_pointers[type].error ? ((iph->tos & IPTOS_TOS_MASK) | |
518 | IPTOS_PREC_INTERNETCONTROL) : | 523 | IPTOS_PREC_INTERNETCONTROL) : |
diff --git a/net/ipv4/ipvs/Makefile b/net/ipv4/ipvs/Makefile index a788461a40c9..30e85de9ffff 100644 --- a/net/ipv4/ipvs/Makefile +++ b/net/ipv4/ipvs/Makefile | |||
@@ -11,7 +11,7 @@ ip_vs_proto-objs-$(CONFIG_IP_VS_PROTO_AH) += ip_vs_proto_ah.o | |||
11 | 11 | ||
12 | ip_vs-objs := ip_vs_conn.o ip_vs_core.o ip_vs_ctl.o ip_vs_sched.o \ | 12 | ip_vs-objs := ip_vs_conn.o ip_vs_core.o ip_vs_ctl.o ip_vs_sched.o \ |
13 | ip_vs_xmit.o ip_vs_app.o ip_vs_sync.o \ | 13 | ip_vs_xmit.o ip_vs_app.o ip_vs_sync.o \ |
14 | ip_vs_est.o ip_vs_proto.o ip_vs_proto_icmp.o \ | 14 | ip_vs_est.o ip_vs_proto.o \ |
15 | $(ip_vs_proto-objs-y) | 15 | $(ip_vs_proto-objs-y) |
16 | 16 | ||
17 | 17 | ||
diff --git a/net/ipv4/ipvs/ip_vs_proto.c b/net/ipv4/ipvs/ip_vs_proto.c index 253c46252bd5..867d4e9c6594 100644 --- a/net/ipv4/ipvs/ip_vs_proto.c +++ b/net/ipv4/ipvs/ip_vs_proto.c | |||
@@ -216,9 +216,6 @@ int ip_vs_protocol_init(void) | |||
216 | #ifdef CONFIG_IP_VS_PROTO_UDP | 216 | #ifdef CONFIG_IP_VS_PROTO_UDP |
217 | REGISTER_PROTOCOL(&ip_vs_protocol_udp); | 217 | REGISTER_PROTOCOL(&ip_vs_protocol_udp); |
218 | #endif | 218 | #endif |
219 | #ifdef CONFIG_IP_VS_PROTO_ICMP | ||
220 | REGISTER_PROTOCOL(&ip_vs_protocol_icmp); | ||
221 | #endif | ||
222 | #ifdef CONFIG_IP_VS_PROTO_AH | 219 | #ifdef CONFIG_IP_VS_PROTO_AH |
223 | REGISTER_PROTOCOL(&ip_vs_protocol_ah); | 220 | REGISTER_PROTOCOL(&ip_vs_protocol_ah); |
224 | #endif | 221 | #endif |
diff --git a/net/ipv4/ipvs/ip_vs_proto_icmp.c b/net/ipv4/ipvs/ip_vs_proto_icmp.c deleted file mode 100644 index 191e94aa1c1f..000000000000 --- a/net/ipv4/ipvs/ip_vs_proto_icmp.c +++ /dev/null | |||
@@ -1,182 +0,0 @@ | |||
1 | /* | ||
2 | * ip_vs_proto_icmp.c: ICMP load balancing support for IP Virtual Server | ||
3 | * | ||
4 | * Authors: Julian Anastasov <ja@ssi.bg>, March 2002 | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * version 2 as published by the Free Software Foundation; | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/icmp.h> | ||
15 | #include <linux/netfilter.h> | ||
16 | #include <linux/netfilter_ipv4.h> | ||
17 | |||
18 | #include <net/ip_vs.h> | ||
19 | |||
20 | |||
21 | static int icmp_timeouts[1] = { 1*60*HZ }; | ||
22 | |||
23 | static char * icmp_state_name_table[1] = { "ICMP" }; | ||
24 | |||
25 | static struct ip_vs_conn * | ||
26 | icmp_conn_in_get(const struct sk_buff *skb, | ||
27 | struct ip_vs_protocol *pp, | ||
28 | const struct iphdr *iph, | ||
29 | unsigned int proto_off, | ||
30 | int inverse) | ||
31 | { | ||
32 | #if 0 | ||
33 | struct ip_vs_conn *cp; | ||
34 | |||
35 | if (likely(!inverse)) { | ||
36 | cp = ip_vs_conn_in_get(iph->protocol, | ||
37 | iph->saddr, 0, | ||
38 | iph->daddr, 0); | ||
39 | } else { | ||
40 | cp = ip_vs_conn_in_get(iph->protocol, | ||
41 | iph->daddr, 0, | ||
42 | iph->saddr, 0); | ||
43 | } | ||
44 | |||
45 | return cp; | ||
46 | |||
47 | #else | ||
48 | return NULL; | ||
49 | #endif | ||
50 | } | ||
51 | |||
52 | static struct ip_vs_conn * | ||
53 | icmp_conn_out_get(const struct sk_buff *skb, | ||
54 | struct ip_vs_protocol *pp, | ||
55 | const struct iphdr *iph, | ||
56 | unsigned int proto_off, | ||
57 | int inverse) | ||
58 | { | ||
59 | #if 0 | ||
60 | struct ip_vs_conn *cp; | ||
61 | |||
62 | if (likely(!inverse)) { | ||
63 | cp = ip_vs_conn_out_get(iph->protocol, | ||
64 | iph->saddr, 0, | ||
65 | iph->daddr, 0); | ||
66 | } else { | ||
67 | cp = ip_vs_conn_out_get(IPPROTO_UDP, | ||
68 | iph->daddr, 0, | ||
69 | iph->saddr, 0); | ||
70 | } | ||
71 | |||
72 | return cp; | ||
73 | #else | ||
74 | return NULL; | ||
75 | #endif | ||
76 | } | ||
77 | |||
78 | static int | ||
79 | icmp_conn_schedule(struct sk_buff *skb, struct ip_vs_protocol *pp, | ||
80 | int *verdict, struct ip_vs_conn **cpp) | ||
81 | { | ||
82 | *verdict = NF_ACCEPT; | ||
83 | return 0; | ||
84 | } | ||
85 | |||
86 | static int | ||
87 | icmp_csum_check(struct sk_buff *skb, struct ip_vs_protocol *pp) | ||
88 | { | ||
89 | if (!(skb->nh.iph->frag_off & __constant_htons(IP_OFFSET))) { | ||
90 | if (skb->ip_summed != CHECKSUM_UNNECESSARY) { | ||
91 | if (ip_vs_checksum_complete(skb, skb->nh.iph->ihl * 4)) { | ||
92 | IP_VS_DBG_RL_PKT(0, pp, skb, 0, "Failed checksum for"); | ||
93 | return 0; | ||
94 | } | ||
95 | } | ||
96 | } | ||
97 | return 1; | ||
98 | } | ||
99 | |||
100 | static void | ||
101 | icmp_debug_packet(struct ip_vs_protocol *pp, | ||
102 | const struct sk_buff *skb, | ||
103 | int offset, | ||
104 | const char *msg) | ||
105 | { | ||
106 | char buf[256]; | ||
107 | struct iphdr _iph, *ih; | ||
108 | |||
109 | ih = skb_header_pointer(skb, offset, sizeof(_iph), &_iph); | ||
110 | if (ih == NULL) | ||
111 | sprintf(buf, "%s TRUNCATED", pp->name); | ||
112 | else if (ih->frag_off & __constant_htons(IP_OFFSET)) | ||
113 | sprintf(buf, "%s %u.%u.%u.%u->%u.%u.%u.%u frag", | ||
114 | pp->name, NIPQUAD(ih->saddr), | ||
115 | NIPQUAD(ih->daddr)); | ||
116 | else { | ||
117 | struct icmphdr _icmph, *ic; | ||
118 | |||
119 | ic = skb_header_pointer(skb, offset + ih->ihl*4, | ||
120 | sizeof(_icmph), &_icmph); | ||
121 | if (ic == NULL) | ||
122 | sprintf(buf, "%s TRUNCATED to %u bytes\n", | ||
123 | pp->name, skb->len - offset); | ||
124 | else | ||
125 | sprintf(buf, "%s %u.%u.%u.%u->%u.%u.%u.%u T:%d C:%d", | ||
126 | pp->name, NIPQUAD(ih->saddr), | ||
127 | NIPQUAD(ih->daddr), | ||
128 | ic->type, ic->code); | ||
129 | } | ||
130 | printk(KERN_DEBUG "IPVS: %s: %s\n", msg, buf); | ||
131 | } | ||
132 | |||
133 | static int | ||
134 | icmp_state_transition(struct ip_vs_conn *cp, int direction, | ||
135 | const struct sk_buff *skb, | ||
136 | struct ip_vs_protocol *pp) | ||
137 | { | ||
138 | cp->timeout = pp->timeout_table[IP_VS_ICMP_S_NORMAL]; | ||
139 | return 1; | ||
140 | } | ||
141 | |||
142 | static int | ||
143 | icmp_set_state_timeout(struct ip_vs_protocol *pp, char *sname, int to) | ||
144 | { | ||
145 | int num; | ||
146 | char **names; | ||
147 | |||
148 | num = IP_VS_ICMP_S_LAST; | ||
149 | names = icmp_state_name_table; | ||
150 | return ip_vs_set_state_timeout(pp->timeout_table, num, names, sname, to); | ||
151 | } | ||
152 | |||
153 | |||
154 | static void icmp_init(struct ip_vs_protocol *pp) | ||
155 | { | ||
156 | pp->timeout_table = icmp_timeouts; | ||
157 | } | ||
158 | |||
159 | static void icmp_exit(struct ip_vs_protocol *pp) | ||
160 | { | ||
161 | } | ||
162 | |||
163 | struct ip_vs_protocol ip_vs_protocol_icmp = { | ||
164 | .name = "ICMP", | ||
165 | .protocol = IPPROTO_ICMP, | ||
166 | .dont_defrag = 0, | ||
167 | .init = icmp_init, | ||
168 | .exit = icmp_exit, | ||
169 | .conn_schedule = icmp_conn_schedule, | ||
170 | .conn_in_get = icmp_conn_in_get, | ||
171 | .conn_out_get = icmp_conn_out_get, | ||
172 | .snat_handler = NULL, | ||
173 | .dnat_handler = NULL, | ||
174 | .csum_check = icmp_csum_check, | ||
175 | .state_transition = icmp_state_transition, | ||
176 | .register_app = NULL, | ||
177 | .unregister_app = NULL, | ||
178 | .app_conn_bind = NULL, | ||
179 | .debug_packet = icmp_debug_packet, | ||
180 | .timeout_change = NULL, | ||
181 | .set_state_timeout = icmp_set_state_timeout, | ||
182 | }; | ||
diff --git a/net/ipv4/multipath_drr.c b/net/ipv4/multipath_drr.c index cf2e6bcf7973..c9cf8726051d 100644 --- a/net/ipv4/multipath_drr.c +++ b/net/ipv4/multipath_drr.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/igmp.h> | 31 | #include <linux/igmp.h> |
32 | #include <linux/proc_fs.h> | 32 | #include <linux/proc_fs.h> |
33 | #include <linux/seq_file.h> | 33 | #include <linux/seq_file.h> |
34 | #include <linux/module.h> | ||
34 | #include <linux/mroute.h> | 35 | #include <linux/mroute.h> |
35 | #include <linux/init.h> | 36 | #include <linux/init.h> |
36 | #include <net/ip.h> | 37 | #include <net/ip.h> |
@@ -247,3 +248,4 @@ static void __exit drr_exit(void) | |||
247 | 248 | ||
248 | module_init(drr_init); | 249 | module_init(drr_init); |
249 | module_exit(drr_exit); | 250 | module_exit(drr_exit); |
251 | MODULE_LICENSE("GPL"); | ||
diff --git a/net/ipv4/multipath_random.c b/net/ipv4/multipath_random.c index 805a16e47de5..5249dbe7c559 100644 --- a/net/ipv4/multipath_random.c +++ b/net/ipv4/multipath_random.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/igmp.h> | 31 | #include <linux/igmp.h> |
32 | #include <linux/proc_fs.h> | 32 | #include <linux/proc_fs.h> |
33 | #include <linux/seq_file.h> | 33 | #include <linux/seq_file.h> |
34 | #include <linux/module.h> | ||
34 | #include <linux/mroute.h> | 35 | #include <linux/mroute.h> |
35 | #include <linux/init.h> | 36 | #include <linux/init.h> |
36 | #include <net/ip.h> | 37 | #include <net/ip.h> |
@@ -126,3 +127,4 @@ static void __exit random_exit(void) | |||
126 | 127 | ||
127 | module_init(random_init); | 128 | module_init(random_init); |
128 | module_exit(random_exit); | 129 | module_exit(random_exit); |
130 | MODULE_LICENSE("GPL"); | ||
diff --git a/net/ipv4/multipath_rr.c b/net/ipv4/multipath_rr.c index 061b6b253982..b6cd2870478f 100644 --- a/net/ipv4/multipath_rr.c +++ b/net/ipv4/multipath_rr.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/igmp.h> | 31 | #include <linux/igmp.h> |
32 | #include <linux/proc_fs.h> | 32 | #include <linux/proc_fs.h> |
33 | #include <linux/seq_file.h> | 33 | #include <linux/seq_file.h> |
34 | #include <linux/module.h> | ||
34 | #include <linux/mroute.h> | 35 | #include <linux/mroute.h> |
35 | #include <linux/init.h> | 36 | #include <linux/init.h> |
36 | #include <net/ip.h> | 37 | #include <net/ip.h> |
@@ -93,3 +94,4 @@ static void __exit rr_exit(void) | |||
93 | 94 | ||
94 | module_init(rr_init); | 95 | module_init(rr_init); |
95 | module_exit(rr_exit); | 96 | module_exit(rr_exit); |
97 | MODULE_LICENSE("GPL"); | ||
diff --git a/net/ipv4/multipath_wrandom.c b/net/ipv4/multipath_wrandom.c index c3d2ca1a6781..bd7d75b6abe0 100644 --- a/net/ipv4/multipath_wrandom.c +++ b/net/ipv4/multipath_wrandom.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/igmp.h> | 31 | #include <linux/igmp.h> |
32 | #include <linux/proc_fs.h> | 32 | #include <linux/proc_fs.h> |
33 | #include <linux/seq_file.h> | 33 | #include <linux/seq_file.h> |
34 | #include <linux/module.h> | ||
34 | #include <linux/mroute.h> | 35 | #include <linux/mroute.h> |
35 | #include <linux/init.h> | 36 | #include <linux/init.h> |
36 | #include <net/ip.h> | 37 | #include <net/ip.h> |
@@ -342,3 +343,4 @@ static void __exit wrandom_exit(void) | |||
342 | 343 | ||
343 | module_init(wrandom_init); | 344 | module_init(wrandom_init); |
344 | module_exit(wrandom_exit); | 345 | module_exit(wrandom_exit); |
346 | MODULE_LICENSE("GPL"); | ||
diff --git a/net/ipv4/netfilter/ip_conntrack_standalone.c b/net/ipv4/netfilter/ip_conntrack_standalone.c index 46ca45f74d85..bc59f7b39805 100644 --- a/net/ipv4/netfilter/ip_conntrack_standalone.c +++ b/net/ipv4/netfilter/ip_conntrack_standalone.c | |||
@@ -256,6 +256,7 @@ static void *exp_seq_next(struct seq_file *s, void *v, loff_t *pos) | |||
256 | { | 256 | { |
257 | struct list_head *e = v; | 257 | struct list_head *e = v; |
258 | 258 | ||
259 | ++*pos; | ||
259 | e = e->next; | 260 | e = e->next; |
260 | 261 | ||
261 | if (e == &ip_conntrack_expect_list) | 262 | if (e == &ip_conntrack_expect_list) |
diff --git a/net/ipv4/netfilter/ipt_recent.c b/net/ipv4/netfilter/ipt_recent.c index 25ab9fabdcba..2d44b07688af 100644 --- a/net/ipv4/netfilter/ipt_recent.c +++ b/net/ipv4/netfilter/ipt_recent.c | |||
@@ -223,7 +223,7 @@ static int ip_recent_ctrl(struct file *file, const char __user *input, unsigned | |||
223 | curr_table->table[count].last_seen = 0; | 223 | curr_table->table[count].last_seen = 0; |
224 | curr_table->table[count].addr = 0; | 224 | curr_table->table[count].addr = 0; |
225 | curr_table->table[count].ttl = 0; | 225 | curr_table->table[count].ttl = 0; |
226 | memset(curr_table->table[count].last_pkts,0,ip_pkt_list_tot*sizeof(u_int32_t)); | 226 | memset(curr_table->table[count].last_pkts,0,ip_pkt_list_tot*sizeof(unsigned long)); |
227 | curr_table->table[count].oldest_pkt = 0; | 227 | curr_table->table[count].oldest_pkt = 0; |
228 | curr_table->table[count].time_pos = 0; | 228 | curr_table->table[count].time_pos = 0; |
229 | curr_table->time_info[count].position = count; | 229 | curr_table->time_info[count].position = count; |
@@ -502,7 +502,7 @@ match(const struct sk_buff *skb, | |||
502 | location = time_info[curr_table->time_pos].position; | 502 | location = time_info[curr_table->time_pos].position; |
503 | hash_table[r_list[location].hash_entry] = -1; | 503 | hash_table[r_list[location].hash_entry] = -1; |
504 | hash_table[hash_result] = location; | 504 | hash_table[hash_result] = location; |
505 | memset(r_list[location].last_pkts,0,ip_pkt_list_tot*sizeof(u_int32_t)); | 505 | memset(r_list[location].last_pkts,0,ip_pkt_list_tot*sizeof(unsigned long)); |
506 | r_list[location].time_pos = curr_table->time_pos; | 506 | r_list[location].time_pos = curr_table->time_pos; |
507 | r_list[location].addr = addr; | 507 | r_list[location].addr = addr; |
508 | r_list[location].ttl = ttl; | 508 | r_list[location].ttl = ttl; |
@@ -631,7 +631,7 @@ match(const struct sk_buff *skb, | |||
631 | r_list[location].last_seen = 0; | 631 | r_list[location].last_seen = 0; |
632 | r_list[location].addr = 0; | 632 | r_list[location].addr = 0; |
633 | r_list[location].ttl = 0; | 633 | r_list[location].ttl = 0; |
634 | memset(r_list[location].last_pkts,0,ip_pkt_list_tot*sizeof(u_int32_t)); | 634 | memset(r_list[location].last_pkts,0,ip_pkt_list_tot*sizeof(unsigned long)); |
635 | r_list[location].oldest_pkt = 0; | 635 | r_list[location].oldest_pkt = 0; |
636 | ans = !info->invert; | 636 | ans = !info->invert; |
637 | } | 637 | } |
@@ -734,10 +734,10 @@ checkentry(const char *tablename, | |||
734 | memset(curr_table->table,0,sizeof(struct recent_ip_list)*ip_list_tot); | 734 | memset(curr_table->table,0,sizeof(struct recent_ip_list)*ip_list_tot); |
735 | #ifdef DEBUG | 735 | #ifdef DEBUG |
736 | if(debug) printk(KERN_INFO RECENT_NAME ": checkentry: Allocating %d for pkt_list.\n", | 736 | if(debug) printk(KERN_INFO RECENT_NAME ": checkentry: Allocating %d for pkt_list.\n", |
737 | sizeof(u_int32_t)*ip_pkt_list_tot*ip_list_tot); | 737 | sizeof(unsigned long)*ip_pkt_list_tot*ip_list_tot); |
738 | #endif | 738 | #endif |
739 | 739 | ||
740 | hold = vmalloc(sizeof(u_int32_t)*ip_pkt_list_tot*ip_list_tot); | 740 | hold = vmalloc(sizeof(unsigned long)*ip_pkt_list_tot*ip_list_tot); |
741 | #ifdef DEBUG | 741 | #ifdef DEBUG |
742 | if(debug) printk(KERN_INFO RECENT_NAME ": checkentry: After pkt_list allocation.\n"); | 742 | if(debug) printk(KERN_INFO RECENT_NAME ": checkentry: After pkt_list allocation.\n"); |
743 | #endif | 743 | #endif |
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 3aafb298c1c1..23068bddbf0b 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c | |||
@@ -23,6 +23,7 @@ extern int sysctl_ip_nonlocal_bind; | |||
23 | extern int sysctl_icmp_echo_ignore_all; | 23 | extern int sysctl_icmp_echo_ignore_all; |
24 | extern int sysctl_icmp_echo_ignore_broadcasts; | 24 | extern int sysctl_icmp_echo_ignore_broadcasts; |
25 | extern int sysctl_icmp_ignore_bogus_error_responses; | 25 | extern int sysctl_icmp_ignore_bogus_error_responses; |
26 | extern int sysctl_icmp_errors_use_inbound_ifaddr; | ||
26 | 27 | ||
27 | /* From ip_fragment.c */ | 28 | /* From ip_fragment.c */ |
28 | extern int sysctl_ipfrag_low_thresh; | 29 | extern int sysctl_ipfrag_low_thresh; |
@@ -396,6 +397,14 @@ ctl_table ipv4_table[] = { | |||
396 | .proc_handler = &proc_dointvec | 397 | .proc_handler = &proc_dointvec |
397 | }, | 398 | }, |
398 | { | 399 | { |
400 | .ctl_name = NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR, | ||
401 | .procname = "icmp_errors_use_inbound_ifaddr", | ||
402 | .data = &sysctl_icmp_errors_use_inbound_ifaddr, | ||
403 | .maxlen = sizeof(int), | ||
404 | .mode = 0644, | ||
405 | .proc_handler = &proc_dointvec | ||
406 | }, | ||
407 | { | ||
399 | .ctl_name = NET_IPV4_ROUTE, | 408 | .ctl_name = NET_IPV4_ROUTE, |
400 | .procname = "route", | 409 | .procname = "route", |
401 | .maxlen = 0, | 410 | .maxlen = 0, |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index a037bafcba3c..0d9a4fd5f1a4 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -2338,7 +2338,7 @@ void __init tcp_init(void) | |||
2338 | (tcp_bhash_size * sizeof(struct tcp_bind_hashbucket)); | 2338 | (tcp_bhash_size * sizeof(struct tcp_bind_hashbucket)); |
2339 | order++) | 2339 | order++) |
2340 | ; | 2340 | ; |
2341 | if (order > 4) { | 2341 | if (order >= 4) { |
2342 | sysctl_local_port_range[0] = 32768; | 2342 | sysctl_local_port_range[0] = 32768; |
2343 | sysctl_local_port_range[1] = 61000; | 2343 | sysctl_local_port_range[1] = 61000; |
2344 | sysctl_tcp_max_tw_buckets = 180000; | 2344 | sysctl_tcp_max_tw_buckets = 180000; |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 7744a2592693..2720899d516c 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -372,6 +372,7 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev) | |||
372 | ndev->regen_timer.data = (unsigned long) ndev; | 372 | ndev->regen_timer.data = (unsigned long) ndev; |
373 | if ((dev->flags&IFF_LOOPBACK) || | 373 | if ((dev->flags&IFF_LOOPBACK) || |
374 | dev->type == ARPHRD_TUNNEL || | 374 | dev->type == ARPHRD_TUNNEL || |
375 | dev->type == ARPHRD_NONE || | ||
375 | dev->type == ARPHRD_SIT) { | 376 | dev->type == ARPHRD_SIT) { |
376 | printk(KERN_INFO | 377 | printk(KERN_INFO |
377 | "Disabled Privacy Extensions on device %p(%s)\n", | 378 | "Disabled Privacy Extensions on device %p(%s)\n", |
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index 8e0f569b883e..ff3ec9822e36 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c | |||
@@ -277,8 +277,8 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info, | |||
277 | { | 277 | { |
278 | struct inet6_dev *idev = NULL; | 278 | struct inet6_dev *idev = NULL; |
279 | struct ipv6hdr *hdr = skb->nh.ipv6h; | 279 | struct ipv6hdr *hdr = skb->nh.ipv6h; |
280 | struct sock *sk = icmpv6_socket->sk; | 280 | struct sock *sk; |
281 | struct ipv6_pinfo *np = inet6_sk(sk); | 281 | struct ipv6_pinfo *np; |
282 | struct in6_addr *saddr = NULL; | 282 | struct in6_addr *saddr = NULL; |
283 | struct dst_entry *dst; | 283 | struct dst_entry *dst; |
284 | struct icmp6hdr tmp_hdr; | 284 | struct icmp6hdr tmp_hdr; |
@@ -358,6 +358,9 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info, | |||
358 | if (icmpv6_xmit_lock()) | 358 | if (icmpv6_xmit_lock()) |
359 | return; | 359 | return; |
360 | 360 | ||
361 | sk = icmpv6_socket->sk; | ||
362 | np = inet6_sk(sk); | ||
363 | |||
361 | if (!icmpv6_xrlim_allow(sk, type, &fl)) | 364 | if (!icmpv6_xrlim_allow(sk, type, &fl)) |
362 | goto out; | 365 | goto out; |
363 | 366 | ||
@@ -423,9 +426,9 @@ out: | |||
423 | 426 | ||
424 | static void icmpv6_echo_reply(struct sk_buff *skb) | 427 | static void icmpv6_echo_reply(struct sk_buff *skb) |
425 | { | 428 | { |
426 | struct sock *sk = icmpv6_socket->sk; | 429 | struct sock *sk; |
427 | struct inet6_dev *idev; | 430 | struct inet6_dev *idev; |
428 | struct ipv6_pinfo *np = inet6_sk(sk); | 431 | struct ipv6_pinfo *np; |
429 | struct in6_addr *saddr = NULL; | 432 | struct in6_addr *saddr = NULL; |
430 | struct icmp6hdr *icmph = (struct icmp6hdr *) skb->h.raw; | 433 | struct icmp6hdr *icmph = (struct icmp6hdr *) skb->h.raw; |
431 | struct icmp6hdr tmp_hdr; | 434 | struct icmp6hdr tmp_hdr; |
@@ -454,6 +457,9 @@ static void icmpv6_echo_reply(struct sk_buff *skb) | |||
454 | if (icmpv6_xmit_lock()) | 457 | if (icmpv6_xmit_lock()) |
455 | return; | 458 | return; |
456 | 459 | ||
460 | sk = icmpv6_socket->sk; | ||
461 | np = inet6_sk(sk); | ||
462 | |||
457 | if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst)) | 463 | if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst)) |
458 | fl.oif = np->mcast_oif; | 464 | fl.oif = np->mcast_oif; |
459 | 465 | ||
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 3b1c9fa184ae..ba3b0c267f75 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -882,6 +882,7 @@ ip6ip6_tnl_change(struct ip6_tnl *t, struct ip6_tnl_parm *p) | |||
882 | t->parms.hop_limit = p->hop_limit; | 882 | t->parms.hop_limit = p->hop_limit; |
883 | t->parms.encap_limit = p->encap_limit; | 883 | t->parms.encap_limit = p->encap_limit; |
884 | t->parms.flowinfo = p->flowinfo; | 884 | t->parms.flowinfo = p->flowinfo; |
885 | t->parms.link = p->link; | ||
885 | ip6ip6_tnl_link_config(t); | 886 | ip6ip6_tnl_link_config(t); |
886 | return 0; | 887 | return 0; |
887 | } | 888 | } |
diff --git a/net/ipv6/ipv6_syms.c b/net/ipv6/ipv6_syms.c index 2f4c91ddc9a3..5ade5a5d1990 100644 --- a/net/ipv6/ipv6_syms.c +++ b/net/ipv6/ipv6_syms.c | |||
@@ -37,5 +37,4 @@ EXPORT_SYMBOL(in6_dev_finish_destroy); | |||
37 | EXPORT_SYMBOL(xfrm6_rcv); | 37 | EXPORT_SYMBOL(xfrm6_rcv); |
38 | #endif | 38 | #endif |
39 | EXPORT_SYMBOL(rt6_lookup); | 39 | EXPORT_SYMBOL(rt6_lookup); |
40 | EXPORT_SYMBOL(fl6_sock_lookup); | ||
41 | EXPORT_SYMBOL(ipv6_push_nfrag_opts); | 40 | EXPORT_SYMBOL(ipv6_push_nfrag_opts); |
diff --git a/net/sched/Kconfig b/net/sched/Kconfig index b0941186f867..b22c9beb604d 100644 --- a/net/sched/Kconfig +++ b/net/sched/Kconfig | |||
@@ -405,7 +405,7 @@ config NET_EMATCH_STACK | |||
405 | ---help--- | 405 | ---help--- |
406 | Size of the local stack variable used while evaluating the tree of | 406 | Size of the local stack variable used while evaluating the tree of |
407 | ematches. Limits the depth of the tree, i.e. the number of | 407 | ematches. Limits the depth of the tree, i.e. the number of |
408 | encapsulated precedences. Every level requires 4 bytes of addtional | 408 | encapsulated precedences. Every level requires 4 bytes of additional |
409 | stack space. | 409 | stack space. |
410 | 410 | ||
411 | config NET_EMATCH_CMP | 411 | config NET_EMATCH_CMP |
diff --git a/net/sched/act_api.c b/net/sched/act_api.c index cafcb084098d..914c85ff8fe6 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c | |||
@@ -881,7 +881,7 @@ static int __init tc_action_init(void) | |||
881 | link_p[RTM_GETACTION-RTM_BASE].dumpit = tc_dump_action; | 881 | link_p[RTM_GETACTION-RTM_BASE].dumpit = tc_dump_action; |
882 | } | 882 | } |
883 | 883 | ||
884 | printk("TC classifier action (bugs to netdev@oss.sgi.com cc " | 884 | printk("TC classifier action (bugs to netdev@vger.kernel.org cc " |
885 | "hadi@cyberus.ca)\n"); | 885 | "hadi@cyberus.ca)\n"); |
886 | return 0; | 886 | return 0; |
887 | } | 887 | } |
diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c index 0d2d4415f334..dfb300bb6baa 100644 --- a/net/sched/cls_basic.c +++ b/net/sched/cls_basic.c | |||
@@ -261,6 +261,9 @@ static int basic_dump(struct tcf_proto *tp, unsigned long fh, | |||
261 | rta = (struct rtattr *) b; | 261 | rta = (struct rtattr *) b; |
262 | RTA_PUT(skb, TCA_OPTIONS, 0, NULL); | 262 | RTA_PUT(skb, TCA_OPTIONS, 0, NULL); |
263 | 263 | ||
264 | if (f->res.classid) | ||
265 | RTA_PUT(skb, TCA_BASIC_CLASSID, sizeof(u32), &f->res.classid); | ||
266 | |||
264 | if (tcf_exts_dump(skb, &f->exts, &basic_ext_map) < 0 || | 267 | if (tcf_exts_dump(skb, &f->exts, &basic_ext_map) < 0 || |
265 | tcf_em_tree_dump(skb, &f->ematches, TCA_BASIC_EMATCHES) < 0) | 268 | tcf_em_tree_dump(skb, &f->ematches, TCA_BASIC_EMATCHES) < 0) |
266 | goto rtattr_failure; | 269 | goto rtattr_failure; |
diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c index f1eeaf65cee5..48bb23c2a35a 100644 --- a/net/sched/em_meta.c +++ b/net/sched/em_meta.c | |||
@@ -32,7 +32,7 @@ | |||
32 | * +-----------+ +-----------+ | 32 | * +-----------+ +-----------+ |
33 | * | | | 33 | * | | |
34 | * ---> meta_ops[INT][INDEV](...) | | 34 | * ---> meta_ops[INT][INDEV](...) | |
35 | * | | | 35 | * | | |
36 | * ----------- | | 36 | * ----------- | |
37 | * V V | 37 | * V V |
38 | * +-----------+ +-----------+ | 38 | * +-----------+ +-----------+ |
@@ -70,6 +70,7 @@ | |||
70 | #include <net/dst.h> | 70 | #include <net/dst.h> |
71 | #include <net/route.h> | 71 | #include <net/route.h> |
72 | #include <net/pkt_cls.h> | 72 | #include <net/pkt_cls.h> |
73 | #include <net/sock.h> | ||
73 | 74 | ||
74 | struct meta_obj | 75 | struct meta_obj |
75 | { | 76 | { |
@@ -284,6 +285,214 @@ META_COLLECTOR(int_rtiif) | |||
284 | } | 285 | } |
285 | 286 | ||
286 | /************************************************************************** | 287 | /************************************************************************** |
288 | * Socket Attributes | ||
289 | **************************************************************************/ | ||
290 | |||
291 | #define SKIP_NONLOCAL(skb) \ | ||
292 | if (unlikely(skb->sk == NULL)) { \ | ||
293 | *err = -1; \ | ||
294 | return; \ | ||
295 | } | ||
296 | |||
297 | META_COLLECTOR(int_sk_family) | ||
298 | { | ||
299 | SKIP_NONLOCAL(skb); | ||
300 | dst->value = skb->sk->sk_family; | ||
301 | } | ||
302 | |||
303 | META_COLLECTOR(int_sk_state) | ||
304 | { | ||
305 | SKIP_NONLOCAL(skb); | ||
306 | dst->value = skb->sk->sk_state; | ||
307 | } | ||
308 | |||
309 | META_COLLECTOR(int_sk_reuse) | ||
310 | { | ||
311 | SKIP_NONLOCAL(skb); | ||
312 | dst->value = skb->sk->sk_reuse; | ||
313 | } | ||
314 | |||
315 | META_COLLECTOR(int_sk_bound_if) | ||
316 | { | ||
317 | SKIP_NONLOCAL(skb); | ||
318 | /* No error if bound_dev_if is 0, legal userspace check */ | ||
319 | dst->value = skb->sk->sk_bound_dev_if; | ||
320 | } | ||
321 | |||
322 | META_COLLECTOR(var_sk_bound_if) | ||
323 | { | ||
324 | SKIP_NONLOCAL(skb); | ||
325 | |||
326 | if (skb->sk->sk_bound_dev_if == 0) { | ||
327 | dst->value = (unsigned long) "any"; | ||
328 | dst->len = 3; | ||
329 | } else { | ||
330 | struct net_device *dev; | ||
331 | |||
332 | dev = dev_get_by_index(skb->sk->sk_bound_dev_if); | ||
333 | *err = var_dev(dev, dst); | ||
334 | if (dev) | ||
335 | dev_put(dev); | ||
336 | } | ||
337 | } | ||
338 | |||
339 | META_COLLECTOR(int_sk_refcnt) | ||
340 | { | ||
341 | SKIP_NONLOCAL(skb); | ||
342 | dst->value = atomic_read(&skb->sk->sk_refcnt); | ||
343 | } | ||
344 | |||
345 | META_COLLECTOR(int_sk_rcvbuf) | ||
346 | { | ||
347 | SKIP_NONLOCAL(skb); | ||
348 | dst->value = skb->sk->sk_rcvbuf; | ||
349 | } | ||
350 | |||
351 | META_COLLECTOR(int_sk_shutdown) | ||
352 | { | ||
353 | SKIP_NONLOCAL(skb); | ||
354 | dst->value = skb->sk->sk_shutdown; | ||
355 | } | ||
356 | |||
357 | META_COLLECTOR(int_sk_proto) | ||
358 | { | ||
359 | SKIP_NONLOCAL(skb); | ||
360 | dst->value = skb->sk->sk_protocol; | ||
361 | } | ||
362 | |||
363 | META_COLLECTOR(int_sk_type) | ||
364 | { | ||
365 | SKIP_NONLOCAL(skb); | ||
366 | dst->value = skb->sk->sk_type; | ||
367 | } | ||
368 | |||
369 | META_COLLECTOR(int_sk_rmem_alloc) | ||
370 | { | ||
371 | SKIP_NONLOCAL(skb); | ||
372 | dst->value = atomic_read(&skb->sk->sk_rmem_alloc); | ||
373 | } | ||
374 | |||
375 | META_COLLECTOR(int_sk_wmem_alloc) | ||
376 | { | ||
377 | SKIP_NONLOCAL(skb); | ||
378 | dst->value = atomic_read(&skb->sk->sk_wmem_alloc); | ||
379 | } | ||
380 | |||
381 | META_COLLECTOR(int_sk_omem_alloc) | ||
382 | { | ||
383 | SKIP_NONLOCAL(skb); | ||
384 | dst->value = atomic_read(&skb->sk->sk_omem_alloc); | ||
385 | } | ||
386 | |||
387 | META_COLLECTOR(int_sk_rcv_qlen) | ||
388 | { | ||
389 | SKIP_NONLOCAL(skb); | ||
390 | dst->value = skb->sk->sk_receive_queue.qlen; | ||
391 | } | ||
392 | |||
393 | META_COLLECTOR(int_sk_snd_qlen) | ||
394 | { | ||
395 | SKIP_NONLOCAL(skb); | ||
396 | dst->value = skb->sk->sk_write_queue.qlen; | ||
397 | } | ||
398 | |||
399 | META_COLLECTOR(int_sk_wmem_queued) | ||
400 | { | ||
401 | SKIP_NONLOCAL(skb); | ||
402 | dst->value = skb->sk->sk_wmem_queued; | ||
403 | } | ||
404 | |||
405 | META_COLLECTOR(int_sk_fwd_alloc) | ||
406 | { | ||
407 | SKIP_NONLOCAL(skb); | ||
408 | dst->value = skb->sk->sk_forward_alloc; | ||
409 | } | ||
410 | |||
411 | META_COLLECTOR(int_sk_sndbuf) | ||
412 | { | ||
413 | SKIP_NONLOCAL(skb); | ||
414 | dst->value = skb->sk->sk_sndbuf; | ||
415 | } | ||
416 | |||
417 | META_COLLECTOR(int_sk_alloc) | ||
418 | { | ||
419 | SKIP_NONLOCAL(skb); | ||
420 | dst->value = skb->sk->sk_allocation; | ||
421 | } | ||
422 | |||
423 | META_COLLECTOR(int_sk_route_caps) | ||
424 | { | ||
425 | SKIP_NONLOCAL(skb); | ||
426 | dst->value = skb->sk->sk_route_caps; | ||
427 | } | ||
428 | |||
429 | META_COLLECTOR(int_sk_hashent) | ||
430 | { | ||
431 | SKIP_NONLOCAL(skb); | ||
432 | dst->value = skb->sk->sk_hashent; | ||
433 | } | ||
434 | |||
435 | META_COLLECTOR(int_sk_lingertime) | ||
436 | { | ||
437 | SKIP_NONLOCAL(skb); | ||
438 | dst->value = skb->sk->sk_lingertime / HZ; | ||
439 | } | ||
440 | |||
441 | META_COLLECTOR(int_sk_err_qlen) | ||
442 | { | ||
443 | SKIP_NONLOCAL(skb); | ||
444 | dst->value = skb->sk->sk_error_queue.qlen; | ||
445 | } | ||
446 | |||
447 | META_COLLECTOR(int_sk_ack_bl) | ||
448 | { | ||
449 | SKIP_NONLOCAL(skb); | ||
450 | dst->value = skb->sk->sk_ack_backlog; | ||
451 | } | ||
452 | |||
453 | META_COLLECTOR(int_sk_max_ack_bl) | ||
454 | { | ||
455 | SKIP_NONLOCAL(skb); | ||
456 | dst->value = skb->sk->sk_max_ack_backlog; | ||
457 | } | ||
458 | |||
459 | META_COLLECTOR(int_sk_prio) | ||
460 | { | ||
461 | SKIP_NONLOCAL(skb); | ||
462 | dst->value = skb->sk->sk_priority; | ||
463 | } | ||
464 | |||
465 | META_COLLECTOR(int_sk_rcvlowat) | ||
466 | { | ||
467 | SKIP_NONLOCAL(skb); | ||
468 | dst->value = skb->sk->sk_rcvlowat; | ||
469 | } | ||
470 | |||
471 | META_COLLECTOR(int_sk_rcvtimeo) | ||
472 | { | ||
473 | SKIP_NONLOCAL(skb); | ||
474 | dst->value = skb->sk->sk_rcvtimeo / HZ; | ||
475 | } | ||
476 | |||
477 | META_COLLECTOR(int_sk_sndtimeo) | ||
478 | { | ||
479 | SKIP_NONLOCAL(skb); | ||
480 | dst->value = skb->sk->sk_sndtimeo / HZ; | ||
481 | } | ||
482 | |||
483 | META_COLLECTOR(int_sk_sendmsg_off) | ||
484 | { | ||
485 | SKIP_NONLOCAL(skb); | ||
486 | dst->value = skb->sk->sk_sndmsg_off; | ||
487 | } | ||
488 | |||
489 | META_COLLECTOR(int_sk_write_pend) | ||
490 | { | ||
491 | SKIP_NONLOCAL(skb); | ||
492 | dst->value = skb->sk->sk_write_pending; | ||
493 | } | ||
494 | |||
495 | /************************************************************************** | ||
287 | * Meta value collectors assignment table | 496 | * Meta value collectors assignment table |
288 | **************************************************************************/ | 497 | **************************************************************************/ |
289 | 498 | ||
@@ -293,41 +502,75 @@ struct meta_ops | |||
293 | struct meta_value *, struct meta_obj *, int *); | 502 | struct meta_value *, struct meta_obj *, int *); |
294 | }; | 503 | }; |
295 | 504 | ||
505 | #define META_ID(name) TCF_META_ID_##name | ||
506 | #define META_FUNC(name) { .get = meta_##name } | ||
507 | |||
296 | /* Meta value operations table listing all meta value collectors and | 508 | /* Meta value operations table listing all meta value collectors and |
297 | * assigns them to a type and meta id. */ | 509 | * assigns them to a type and meta id. */ |
298 | static struct meta_ops __meta_ops[TCF_META_TYPE_MAX+1][TCF_META_ID_MAX+1] = { | 510 | static struct meta_ops __meta_ops[TCF_META_TYPE_MAX+1][TCF_META_ID_MAX+1] = { |
299 | [TCF_META_TYPE_VAR] = { | 511 | [TCF_META_TYPE_VAR] = { |
300 | [TCF_META_ID_DEV] = { .get = meta_var_dev }, | 512 | [META_ID(DEV)] = META_FUNC(var_dev), |
301 | [TCF_META_ID_INDEV] = { .get = meta_var_indev }, | 513 | [META_ID(INDEV)] = META_FUNC(var_indev), |
302 | [TCF_META_ID_REALDEV] = { .get = meta_var_realdev } | 514 | [META_ID(REALDEV)] = META_FUNC(var_realdev), |
515 | [META_ID(SK_BOUND_IF)] = META_FUNC(var_sk_bound_if), | ||
303 | }, | 516 | }, |
304 | [TCF_META_TYPE_INT] = { | 517 | [TCF_META_TYPE_INT] = { |
305 | [TCF_META_ID_RANDOM] = { .get = meta_int_random }, | 518 | [META_ID(RANDOM)] = META_FUNC(int_random), |
306 | [TCF_META_ID_LOADAVG_0] = { .get = meta_int_loadavg_0 }, | 519 | [META_ID(LOADAVG_0)] = META_FUNC(int_loadavg_0), |
307 | [TCF_META_ID_LOADAVG_1] = { .get = meta_int_loadavg_1 }, | 520 | [META_ID(LOADAVG_1)] = META_FUNC(int_loadavg_1), |
308 | [TCF_META_ID_LOADAVG_2] = { .get = meta_int_loadavg_2 }, | 521 | [META_ID(LOADAVG_2)] = META_FUNC(int_loadavg_2), |
309 | [TCF_META_ID_DEV] = { .get = meta_int_dev }, | 522 | [META_ID(DEV)] = META_FUNC(int_dev), |
310 | [TCF_META_ID_INDEV] = { .get = meta_int_indev }, | 523 | [META_ID(INDEV)] = META_FUNC(int_indev), |
311 | [TCF_META_ID_REALDEV] = { .get = meta_int_realdev }, | 524 | [META_ID(REALDEV)] = META_FUNC(int_realdev), |
312 | [TCF_META_ID_PRIORITY] = { .get = meta_int_priority }, | 525 | [META_ID(PRIORITY)] = META_FUNC(int_priority), |
313 | [TCF_META_ID_PROTOCOL] = { .get = meta_int_protocol }, | 526 | [META_ID(PROTOCOL)] = META_FUNC(int_protocol), |
314 | [TCF_META_ID_SECURITY] = { .get = meta_int_security }, | 527 | [META_ID(SECURITY)] = META_FUNC(int_security), |
315 | [TCF_META_ID_PKTTYPE] = { .get = meta_int_pkttype }, | 528 | [META_ID(PKTTYPE)] = META_FUNC(int_pkttype), |
316 | [TCF_META_ID_PKTLEN] = { .get = meta_int_pktlen }, | 529 | [META_ID(PKTLEN)] = META_FUNC(int_pktlen), |
317 | [TCF_META_ID_DATALEN] = { .get = meta_int_datalen }, | 530 | [META_ID(DATALEN)] = META_FUNC(int_datalen), |
318 | [TCF_META_ID_MACLEN] = { .get = meta_int_maclen }, | 531 | [META_ID(MACLEN)] = META_FUNC(int_maclen), |
319 | #ifdef CONFIG_NETFILTER | 532 | #ifdef CONFIG_NETFILTER |
320 | [TCF_META_ID_NFMARK] = { .get = meta_int_nfmark }, | 533 | [META_ID(NFMARK)] = META_FUNC(int_nfmark), |
321 | #endif | 534 | #endif |
322 | [TCF_META_ID_TCINDEX] = { .get = meta_int_tcindex }, | 535 | [META_ID(TCINDEX)] = META_FUNC(int_tcindex), |
323 | #ifdef CONFIG_NET_CLS_ACT | 536 | #ifdef CONFIG_NET_CLS_ACT |
324 | [TCF_META_ID_TCVERDICT] = { .get = meta_int_tcverd }, | 537 | [META_ID(TCVERDICT)] = META_FUNC(int_tcverd), |
325 | [TCF_META_ID_TCCLASSID] = { .get = meta_int_tcclassid }, | 538 | [META_ID(TCCLASSID)] = META_FUNC(int_tcclassid), |
326 | #endif | 539 | #endif |
327 | #ifdef CONFIG_NET_CLS_ROUTE | 540 | #ifdef CONFIG_NET_CLS_ROUTE |
328 | [TCF_META_ID_RTCLASSID] = { .get = meta_int_rtclassid }, | 541 | [META_ID(RTCLASSID)] = META_FUNC(int_rtclassid), |
329 | #endif | 542 | #endif |
330 | [TCF_META_ID_RTIIF] = { .get = meta_int_rtiif } | 543 | [META_ID(RTIIF)] = META_FUNC(int_rtiif), |
544 | [META_ID(SK_FAMILY)] = META_FUNC(int_sk_family), | ||
545 | [META_ID(SK_STATE)] = META_FUNC(int_sk_state), | ||
546 | [META_ID(SK_REUSE)] = META_FUNC(int_sk_reuse), | ||
547 | [META_ID(SK_BOUND_IF)] = META_FUNC(int_sk_bound_if), | ||
548 | [META_ID(SK_REFCNT)] = META_FUNC(int_sk_refcnt), | ||
549 | [META_ID(SK_RCVBUF)] = META_FUNC(int_sk_rcvbuf), | ||
550 | [META_ID(SK_SNDBUF)] = META_FUNC(int_sk_sndbuf), | ||
551 | [META_ID(SK_SHUTDOWN)] = META_FUNC(int_sk_shutdown), | ||
552 | [META_ID(SK_PROTO)] = META_FUNC(int_sk_proto), | ||
553 | [META_ID(SK_TYPE)] = META_FUNC(int_sk_type), | ||
554 | [META_ID(SK_RMEM_ALLOC)] = META_FUNC(int_sk_rmem_alloc), | ||
555 | [META_ID(SK_WMEM_ALLOC)] = META_FUNC(int_sk_wmem_alloc), | ||
556 | [META_ID(SK_OMEM_ALLOC)] = META_FUNC(int_sk_omem_alloc), | ||
557 | [META_ID(SK_WMEM_QUEUED)] = META_FUNC(int_sk_wmem_queued), | ||
558 | [META_ID(SK_RCV_QLEN)] = META_FUNC(int_sk_rcv_qlen), | ||
559 | [META_ID(SK_SND_QLEN)] = META_FUNC(int_sk_snd_qlen), | ||
560 | [META_ID(SK_ERR_QLEN)] = META_FUNC(int_sk_err_qlen), | ||
561 | [META_ID(SK_FORWARD_ALLOCS)] = META_FUNC(int_sk_fwd_alloc), | ||
562 | [META_ID(SK_ALLOCS)] = META_FUNC(int_sk_alloc), | ||
563 | [META_ID(SK_ROUTE_CAPS)] = META_FUNC(int_sk_route_caps), | ||
564 | [META_ID(SK_HASHENT)] = META_FUNC(int_sk_hashent), | ||
565 | [META_ID(SK_LINGERTIME)] = META_FUNC(int_sk_lingertime), | ||
566 | [META_ID(SK_ACK_BACKLOG)] = META_FUNC(int_sk_ack_bl), | ||
567 | [META_ID(SK_MAX_ACK_BACKLOG)] = META_FUNC(int_sk_max_ack_bl), | ||
568 | [META_ID(SK_PRIO)] = META_FUNC(int_sk_prio), | ||
569 | [META_ID(SK_RCVLOWAT)] = META_FUNC(int_sk_rcvlowat), | ||
570 | [META_ID(SK_RCVTIMEO)] = META_FUNC(int_sk_rcvtimeo), | ||
571 | [META_ID(SK_SNDTIMEO)] = META_FUNC(int_sk_sndtimeo), | ||
572 | [META_ID(SK_SENDMSG_OFF)] = META_FUNC(int_sk_sendmsg_off), | ||
573 | [META_ID(SK_WRITE_PENDING)] = META_FUNC(int_sk_write_pend), | ||
331 | } | 574 | } |
332 | }; | 575 | }; |
333 | 576 | ||
@@ -396,9 +639,9 @@ static int meta_int_compare(struct meta_obj *a, struct meta_obj *b) | |||
396 | /* Let gcc optimize it, the unlikely is not really based on | 639 | /* Let gcc optimize it, the unlikely is not really based on |
397 | * some numbers but jump free code for mismatches seems | 640 | * some numbers but jump free code for mismatches seems |
398 | * more logical. */ | 641 | * more logical. */ |
399 | if (unlikely(a == b)) | 642 | if (unlikely(a->value == b->value)) |
400 | return 0; | 643 | return 0; |
401 | else if (a < b) | 644 | else if (a->value < b->value) |
402 | return -1; | 645 | return -1; |
403 | else | 646 | else |
404 | return 1; | 647 | return 1; |
diff --git a/net/sctp/input.c b/net/sctp/input.c index b719a77d66b4..fffc880a646d 100644 --- a/net/sctp/input.c +++ b/net/sctp/input.c | |||
@@ -178,6 +178,37 @@ int sctp_rcv(struct sk_buff *skb) | |||
178 | 178 | ||
179 | asoc = __sctp_rcv_lookup(skb, &src, &dest, &transport); | 179 | asoc = __sctp_rcv_lookup(skb, &src, &dest, &transport); |
180 | 180 | ||
181 | if (!asoc) | ||
182 | ep = __sctp_rcv_lookup_endpoint(&dest); | ||
183 | |||
184 | /* Retrieve the common input handling substructure. */ | ||
185 | rcvr = asoc ? &asoc->base : &ep->base; | ||
186 | sk = rcvr->sk; | ||
187 | |||
188 | /* | ||
189 | * If a frame arrives on an interface and the receiving socket is | ||
190 | * bound to another interface, via SO_BINDTODEVICE, treat it as OOTB | ||
191 | */ | ||
192 | if (sk->sk_bound_dev_if && (sk->sk_bound_dev_if != af->skb_iif(skb))) | ||
193 | { | ||
194 | sock_put(sk); | ||
195 | if (asoc) { | ||
196 | sctp_association_put(asoc); | ||
197 | asoc = NULL; | ||
198 | } else { | ||
199 | sctp_endpoint_put(ep); | ||
200 | ep = NULL; | ||
201 | } | ||
202 | sk = sctp_get_ctl_sock(); | ||
203 | ep = sctp_sk(sk)->ep; | ||
204 | sctp_endpoint_hold(ep); | ||
205 | sock_hold(sk); | ||
206 | rcvr = &ep->base; | ||
207 | } | ||
208 | |||
209 | if (atomic_read(&sk->sk_rmem_alloc) >= sk->sk_rcvbuf) | ||
210 | goto discard_release; | ||
211 | |||
181 | /* | 212 | /* |
182 | * RFC 2960, 8.4 - Handle "Out of the blue" Packets. | 213 | * RFC 2960, 8.4 - Handle "Out of the blue" Packets. |
183 | * An SCTP packet is called an "out of the blue" (OOTB) | 214 | * An SCTP packet is called an "out of the blue" (OOTB) |
@@ -187,22 +218,12 @@ int sctp_rcv(struct sk_buff *skb) | |||
187 | * packet belongs. | 218 | * packet belongs. |
188 | */ | 219 | */ |
189 | if (!asoc) { | 220 | if (!asoc) { |
190 | ep = __sctp_rcv_lookup_endpoint(&dest); | ||
191 | if (sctp_rcv_ootb(skb)) { | 221 | if (sctp_rcv_ootb(skb)) { |
192 | SCTP_INC_STATS_BH(SCTP_MIB_OUTOFBLUES); | 222 | SCTP_INC_STATS_BH(SCTP_MIB_OUTOFBLUES); |
193 | goto discard_release; | 223 | goto discard_release; |
194 | } | 224 | } |
195 | } | 225 | } |
196 | 226 | ||
197 | /* Retrieve the common input handling substructure. */ | ||
198 | rcvr = asoc ? &asoc->base : &ep->base; | ||
199 | sk = rcvr->sk; | ||
200 | |||
201 | if ((sk) && (atomic_read(&sk->sk_rmem_alloc) >= sk->sk_rcvbuf)) { | ||
202 | goto discard_release; | ||
203 | } | ||
204 | |||
205 | |||
206 | /* SCTP seems to always need a timestamp right now (FIXME) */ | 227 | /* SCTP seems to always need a timestamp right now (FIXME) */ |
207 | if (skb->stamp.tv_sec == 0) { | 228 | if (skb->stamp.tv_sec == 0) { |
208 | do_gettimeofday(&skb->stamp); | 229 | do_gettimeofday(&skb->stamp); |
@@ -265,13 +286,11 @@ discard_it: | |||
265 | 286 | ||
266 | discard_release: | 287 | discard_release: |
267 | /* Release any structures we may be holding. */ | 288 | /* Release any structures we may be holding. */ |
268 | if (asoc) { | 289 | sock_put(sk); |
269 | sock_put(asoc->base.sk); | 290 | if (asoc) |
270 | sctp_association_put(asoc); | 291 | sctp_association_put(asoc); |
271 | } else { | 292 | else |
272 | sock_put(ep->base.sk); | ||
273 | sctp_endpoint_put(ep); | 293 | sctp_endpoint_put(ep); |
274 | } | ||
275 | 294 | ||
276 | goto discard_it; | 295 | goto discard_it; |
277 | } | 296 | } |
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c index c9d9ea064734..c7e42d125b9c 100644 --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c | |||
@@ -812,26 +812,23 @@ static int sctp_inet6_bind_verify(struct sctp_sock *opt, union sctp_addr *addr) | |||
812 | if (addr->sa.sa_family != AF_INET6) | 812 | if (addr->sa.sa_family != AF_INET6) |
813 | af = sctp_get_af_specific(addr->sa.sa_family); | 813 | af = sctp_get_af_specific(addr->sa.sa_family); |
814 | else { | 814 | else { |
815 | struct sock *sk; | ||
816 | int type = ipv6_addr_type(&addr->v6.sin6_addr); | 815 | int type = ipv6_addr_type(&addr->v6.sin6_addr); |
817 | sk = sctp_opt2sk(opt); | 816 | struct net_device *dev; |
817 | |||
818 | if (type & IPV6_ADDR_LINKLOCAL) { | 818 | if (type & IPV6_ADDR_LINKLOCAL) { |
819 | /* Note: Behavior similar to af_inet6.c: | 819 | if (!addr->v6.sin6_scope_id) |
820 | * 1) Overrides previous bound_dev_if | 820 | return 0; |
821 | * 2) Destructive even if bind isn't successful. | 821 | dev = dev_get_by_index(addr->v6.sin6_scope_id); |
822 | */ | 822 | if (!dev) |
823 | |||
824 | if (addr->v6.sin6_scope_id) | ||
825 | sk->sk_bound_dev_if = addr->v6.sin6_scope_id; | ||
826 | if (!sk->sk_bound_dev_if) | ||
827 | return 0; | 823 | return 0; |
824 | dev_put(dev); | ||
828 | } | 825 | } |
829 | af = opt->pf->af; | 826 | af = opt->pf->af; |
830 | } | 827 | } |
831 | return af->available(addr, opt); | 828 | return af->available(addr, opt); |
832 | } | 829 | } |
833 | 830 | ||
834 | /* Verify that the provided sockaddr looks bindable. Common verification, | 831 | /* Verify that the provided sockaddr looks sendable. Common verification, |
835 | * has already been taken care of. | 832 | * has already been taken care of. |
836 | */ | 833 | */ |
837 | static int sctp_inet6_send_verify(struct sctp_sock *opt, union sctp_addr *addr) | 834 | static int sctp_inet6_send_verify(struct sctp_sock *opt, union sctp_addr *addr) |
@@ -842,19 +839,16 @@ static int sctp_inet6_send_verify(struct sctp_sock *opt, union sctp_addr *addr) | |||
842 | if (addr->sa.sa_family != AF_INET6) | 839 | if (addr->sa.sa_family != AF_INET6) |
843 | af = sctp_get_af_specific(addr->sa.sa_family); | 840 | af = sctp_get_af_specific(addr->sa.sa_family); |
844 | else { | 841 | else { |
845 | struct sock *sk; | ||
846 | int type = ipv6_addr_type(&addr->v6.sin6_addr); | 842 | int type = ipv6_addr_type(&addr->v6.sin6_addr); |
847 | sk = sctp_opt2sk(opt); | 843 | struct net_device *dev; |
844 | |||
848 | if (type & IPV6_ADDR_LINKLOCAL) { | 845 | if (type & IPV6_ADDR_LINKLOCAL) { |
849 | /* Note: Behavior similar to af_inet6.c: | 846 | if (!addr->v6.sin6_scope_id) |
850 | * 1) Overrides previous bound_dev_if | 847 | return 0; |
851 | * 2) Destructive even if bind isn't successful. | 848 | dev = dev_get_by_index(addr->v6.sin6_scope_id); |
852 | */ | 849 | if (!dev) |
853 | |||
854 | if (addr->v6.sin6_scope_id) | ||
855 | sk->sk_bound_dev_if = addr->v6.sin6_scope_id; | ||
856 | if (!sk->sk_bound_dev_if) | ||
857 | return 0; | 850 | return 0; |
851 | dev_put(dev); | ||
858 | } | 852 | } |
859 | af = opt->pf->af; | 853 | af = opt->pf->af; |
860 | } | 854 | } |
diff --git a/net/sctp/proc.c b/net/sctp/proc.c index e42fd8c2916b..98d49ec9b74b 100644 --- a/net/sctp/proc.c +++ b/net/sctp/proc.c | |||
@@ -132,14 +132,25 @@ void sctp_snmp_proc_exit(void) | |||
132 | static void sctp_seq_dump_local_addrs(struct seq_file *seq, struct sctp_ep_common *epb) | 132 | static void sctp_seq_dump_local_addrs(struct seq_file *seq, struct sctp_ep_common *epb) |
133 | { | 133 | { |
134 | struct list_head *pos; | 134 | struct list_head *pos; |
135 | struct sctp_association *asoc; | ||
135 | struct sctp_sockaddr_entry *laddr; | 136 | struct sctp_sockaddr_entry *laddr; |
136 | union sctp_addr *addr; | 137 | struct sctp_transport *peer; |
138 | union sctp_addr *addr, *primary = NULL; | ||
137 | struct sctp_af *af; | 139 | struct sctp_af *af; |
138 | 140 | ||
141 | if (epb->type == SCTP_EP_TYPE_ASSOCIATION) { | ||
142 | asoc = sctp_assoc(epb); | ||
143 | peer = asoc->peer.primary_path; | ||
144 | primary = &peer->saddr; | ||
145 | } | ||
146 | |||
139 | list_for_each(pos, &epb->bind_addr.address_list) { | 147 | list_for_each(pos, &epb->bind_addr.address_list) { |
140 | laddr = list_entry(pos, struct sctp_sockaddr_entry, list); | 148 | laddr = list_entry(pos, struct sctp_sockaddr_entry, list); |
141 | addr = (union sctp_addr *)&laddr->a; | 149 | addr = (union sctp_addr *)&laddr->a; |
142 | af = sctp_get_af_specific(addr->sa.sa_family); | 150 | af = sctp_get_af_specific(addr->sa.sa_family); |
151 | if (primary && af->cmp_addr(addr, primary)) { | ||
152 | seq_printf(seq, "*"); | ||
153 | } | ||
143 | af->seq_dump_addr(seq, addr); | 154 | af->seq_dump_addr(seq, addr); |
144 | } | 155 | } |
145 | } | 156 | } |
@@ -149,17 +160,54 @@ static void sctp_seq_dump_remote_addrs(struct seq_file *seq, struct sctp_associa | |||
149 | { | 160 | { |
150 | struct list_head *pos; | 161 | struct list_head *pos; |
151 | struct sctp_transport *transport; | 162 | struct sctp_transport *transport; |
152 | union sctp_addr *addr; | 163 | union sctp_addr *addr, *primary; |
153 | struct sctp_af *af; | 164 | struct sctp_af *af; |
154 | 165 | ||
166 | primary = &(assoc->peer.primary_addr); | ||
155 | list_for_each(pos, &assoc->peer.transport_addr_list) { | 167 | list_for_each(pos, &assoc->peer.transport_addr_list) { |
156 | transport = list_entry(pos, struct sctp_transport, transports); | 168 | transport = list_entry(pos, struct sctp_transport, transports); |
157 | addr = (union sctp_addr *)&transport->ipaddr; | 169 | addr = (union sctp_addr *)&transport->ipaddr; |
158 | af = sctp_get_af_specific(addr->sa.sa_family); | 170 | af = sctp_get_af_specific(addr->sa.sa_family); |
171 | if (af->cmp_addr(addr, primary)) { | ||
172 | seq_printf(seq, "*"); | ||
173 | } | ||
159 | af->seq_dump_addr(seq, addr); | 174 | af->seq_dump_addr(seq, addr); |
160 | } | 175 | } |
161 | } | 176 | } |
162 | 177 | ||
178 | static void * sctp_eps_seq_start(struct seq_file *seq, loff_t *pos) | ||
179 | { | ||
180 | if (*pos > sctp_ep_hashsize) | ||
181 | return NULL; | ||
182 | |||
183 | if (*pos < 0) | ||
184 | *pos = 0; | ||
185 | |||
186 | if (*pos == 0) | ||
187 | seq_printf(seq, " ENDPT SOCK STY SST HBKT LPORT UID INODE LADDRS\n"); | ||
188 | |||
189 | ++*pos; | ||
190 | |||
191 | return (void *)pos; | ||
192 | } | ||
193 | |||
194 | static void sctp_eps_seq_stop(struct seq_file *seq, void *v) | ||
195 | { | ||
196 | return; | ||
197 | } | ||
198 | |||
199 | |||
200 | static void * sctp_eps_seq_next(struct seq_file *seq, void *v, loff_t *pos) | ||
201 | { | ||
202 | if (*pos > sctp_ep_hashsize) | ||
203 | return NULL; | ||
204 | |||
205 | ++*pos; | ||
206 | |||
207 | return pos; | ||
208 | } | ||
209 | |||
210 | |||
163 | /* Display sctp endpoints (/proc/net/sctp/eps). */ | 211 | /* Display sctp endpoints (/proc/net/sctp/eps). */ |
164 | static int sctp_eps_seq_show(struct seq_file *seq, void *v) | 212 | static int sctp_eps_seq_show(struct seq_file *seq, void *v) |
165 | { | 213 | { |
@@ -167,38 +215,50 @@ static int sctp_eps_seq_show(struct seq_file *seq, void *v) | |||
167 | struct sctp_ep_common *epb; | 215 | struct sctp_ep_common *epb; |
168 | struct sctp_endpoint *ep; | 216 | struct sctp_endpoint *ep; |
169 | struct sock *sk; | 217 | struct sock *sk; |
170 | int hash; | 218 | int hash = *(int *)v; |
171 | 219 | ||
172 | seq_printf(seq, " ENDPT SOCK STY SST HBKT LPORT LADDRS\n"); | 220 | if (hash > sctp_ep_hashsize) |
173 | for (hash = 0; hash < sctp_ep_hashsize; hash++) { | 221 | return -ENOMEM; |
174 | head = &sctp_ep_hashtable[hash]; | 222 | |
175 | read_lock(&head->lock); | 223 | head = &sctp_ep_hashtable[hash-1]; |
176 | for (epb = head->chain; epb; epb = epb->next) { | 224 | sctp_local_bh_disable(); |
177 | ep = sctp_ep(epb); | 225 | read_lock(&head->lock); |
178 | sk = epb->sk; | 226 | for (epb = head->chain; epb; epb = epb->next) { |
179 | seq_printf(seq, "%8p %8p %-3d %-3d %-4d %-5d ", ep, sk, | 227 | ep = sctp_ep(epb); |
180 | sctp_sk(sk)->type, sk->sk_state, hash, | 228 | sk = epb->sk; |
181 | epb->bind_addr.port); | 229 | seq_printf(seq, "%8p %8p %-3d %-3d %-4d %-5d %5d %5lu ", ep, sk, |
182 | sctp_seq_dump_local_addrs(seq, epb); | 230 | sctp_sk(sk)->type, sk->sk_state, hash-1, |
183 | seq_printf(seq, "\n"); | 231 | epb->bind_addr.port, |
184 | } | 232 | sock_i_uid(sk), sock_i_ino(sk)); |
185 | read_unlock(&head->lock); | 233 | |
234 | sctp_seq_dump_local_addrs(seq, epb); | ||
235 | seq_printf(seq, "\n"); | ||
186 | } | 236 | } |
237 | read_unlock(&head->lock); | ||
238 | sctp_local_bh_enable(); | ||
187 | 239 | ||
188 | return 0; | 240 | return 0; |
189 | } | 241 | } |
190 | 242 | ||
243 | static struct seq_operations sctp_eps_ops = { | ||
244 | .start = sctp_eps_seq_start, | ||
245 | .next = sctp_eps_seq_next, | ||
246 | .stop = sctp_eps_seq_stop, | ||
247 | .show = sctp_eps_seq_show, | ||
248 | }; | ||
249 | |||
250 | |||
191 | /* Initialize the seq file operations for 'eps' object. */ | 251 | /* Initialize the seq file operations for 'eps' object. */ |
192 | static int sctp_eps_seq_open(struct inode *inode, struct file *file) | 252 | static int sctp_eps_seq_open(struct inode *inode, struct file *file) |
193 | { | 253 | { |
194 | return single_open(file, sctp_eps_seq_show, NULL); | 254 | return seq_open(file, &sctp_eps_ops); |
195 | } | 255 | } |
196 | 256 | ||
197 | static struct file_operations sctp_eps_seq_fops = { | 257 | static struct file_operations sctp_eps_seq_fops = { |
198 | .open = sctp_eps_seq_open, | 258 | .open = sctp_eps_seq_open, |
199 | .read = seq_read, | 259 | .read = seq_read, |
200 | .llseek = seq_lseek, | 260 | .llseek = seq_lseek, |
201 | .release = single_release, | 261 | .release = seq_release, |
202 | }; | 262 | }; |
203 | 263 | ||
204 | /* Set up the proc fs entry for 'eps' object. */ | 264 | /* Set up the proc fs entry for 'eps' object. */ |
@@ -221,6 +281,40 @@ void sctp_eps_proc_exit(void) | |||
221 | remove_proc_entry("eps", proc_net_sctp); | 281 | remove_proc_entry("eps", proc_net_sctp); |
222 | } | 282 | } |
223 | 283 | ||
284 | |||
285 | static void * sctp_assocs_seq_start(struct seq_file *seq, loff_t *pos) | ||
286 | { | ||
287 | if (*pos > sctp_assoc_hashsize) | ||
288 | return NULL; | ||
289 | |||
290 | if (*pos < 0) | ||
291 | *pos = 0; | ||
292 | |||
293 | if (*pos == 0) | ||
294 | seq_printf(seq, " ASSOC SOCK STY SST ST HBKT ASSOC-ID TX_QUEUE RX_QUEUE UID INODE LPORT " | ||
295 | "RPORT LADDRS <-> RADDRS\n"); | ||
296 | |||
297 | ++*pos; | ||
298 | |||
299 | return (void *)pos; | ||
300 | } | ||
301 | |||
302 | static void sctp_assocs_seq_stop(struct seq_file *seq, void *v) | ||
303 | { | ||
304 | return; | ||
305 | } | ||
306 | |||
307 | |||
308 | static void * sctp_assocs_seq_next(struct seq_file *seq, void *v, loff_t *pos) | ||
309 | { | ||
310 | if (*pos > sctp_assoc_hashsize) | ||
311 | return NULL; | ||
312 | |||
313 | ++*pos; | ||
314 | |||
315 | return pos; | ||
316 | } | ||
317 | |||
224 | /* Display sctp associations (/proc/net/sctp/assocs). */ | 318 | /* Display sctp associations (/proc/net/sctp/assocs). */ |
225 | static int sctp_assocs_seq_show(struct seq_file *seq, void *v) | 319 | static int sctp_assocs_seq_show(struct seq_file *seq, void *v) |
226 | { | 320 | { |
@@ -228,43 +322,57 @@ static int sctp_assocs_seq_show(struct seq_file *seq, void *v) | |||
228 | struct sctp_ep_common *epb; | 322 | struct sctp_ep_common *epb; |
229 | struct sctp_association *assoc; | 323 | struct sctp_association *assoc; |
230 | struct sock *sk; | 324 | struct sock *sk; |
231 | int hash; | 325 | int hash = *(int *)v; |
232 | 326 | ||
233 | seq_printf(seq, " ASSOC SOCK STY SST ST HBKT LPORT RPORT " | 327 | if (hash > sctp_assoc_hashsize) |
234 | "LADDRS <-> RADDRS\n"); | 328 | return -ENOMEM; |
235 | for (hash = 0; hash < sctp_assoc_hashsize; hash++) { | 329 | |
236 | head = &sctp_assoc_hashtable[hash]; | 330 | head = &sctp_assoc_hashtable[hash-1]; |
237 | read_lock(&head->lock); | 331 | sctp_local_bh_disable(); |
238 | for (epb = head->chain; epb; epb = epb->next) { | 332 | read_lock(&head->lock); |
239 | assoc = sctp_assoc(epb); | 333 | for (epb = head->chain; epb; epb = epb->next) { |
240 | sk = epb->sk; | 334 | assoc = sctp_assoc(epb); |
241 | seq_printf(seq, | 335 | sk = epb->sk; |
242 | "%8p %8p %-3d %-3d %-2d %-4d %-5d %-5d ", | 336 | seq_printf(seq, |
243 | assoc, sk, sctp_sk(sk)->type, sk->sk_state, | 337 | "%8p %8p %-3d %-3d %-2d %-4d %4d %8d %8d %7d %5lu %-5d %5d ", |
244 | assoc->state, hash, epb->bind_addr.port, | 338 | assoc, sk, sctp_sk(sk)->type, sk->sk_state, |
245 | assoc->peer.port); | 339 | assoc->state, hash-1, assoc->assoc_id, |
246 | sctp_seq_dump_local_addrs(seq, epb); | 340 | (sk->sk_rcvbuf - assoc->rwnd), |
247 | seq_printf(seq, "<-> "); | 341 | assoc->sndbuf_used, |
248 | sctp_seq_dump_remote_addrs(seq, assoc); | 342 | sock_i_uid(sk), sock_i_ino(sk), |
249 | seq_printf(seq, "\n"); | 343 | epb->bind_addr.port, |
250 | } | 344 | assoc->peer.port); |
251 | read_unlock(&head->lock); | 345 | |
346 | seq_printf(seq, " "); | ||
347 | sctp_seq_dump_local_addrs(seq, epb); | ||
348 | seq_printf(seq, "<-> "); | ||
349 | sctp_seq_dump_remote_addrs(seq, assoc); | ||
350 | seq_printf(seq, "\n"); | ||
252 | } | 351 | } |
352 | read_unlock(&head->lock); | ||
353 | sctp_local_bh_enable(); | ||
253 | 354 | ||
254 | return 0; | 355 | return 0; |
255 | } | 356 | } |
256 | 357 | ||
358 | static struct seq_operations sctp_assoc_ops = { | ||
359 | .start = sctp_assocs_seq_start, | ||
360 | .next = sctp_assocs_seq_next, | ||
361 | .stop = sctp_assocs_seq_stop, | ||
362 | .show = sctp_assocs_seq_show, | ||
363 | }; | ||
364 | |||
257 | /* Initialize the seq file operations for 'assocs' object. */ | 365 | /* Initialize the seq file operations for 'assocs' object. */ |
258 | static int sctp_assocs_seq_open(struct inode *inode, struct file *file) | 366 | static int sctp_assocs_seq_open(struct inode *inode, struct file *file) |
259 | { | 367 | { |
260 | return single_open(file, sctp_assocs_seq_show, NULL); | 368 | return seq_open(file, &sctp_assoc_ops); |
261 | } | 369 | } |
262 | 370 | ||
263 | static struct file_operations sctp_assocs_seq_fops = { | 371 | static struct file_operations sctp_assocs_seq_fops = { |
264 | .open = sctp_assocs_seq_open, | 372 | .open = sctp_assocs_seq_open, |
265 | .read = seq_read, | 373 | .read = seq_read, |
266 | .llseek = seq_lseek, | 374 | .llseek = seq_lseek, |
267 | .release = single_release, | 375 | .release = seq_release, |
268 | }; | 376 | }; |
269 | 377 | ||
270 | /* Set up the proc fs entry for 'assocs' object. */ | 378 | /* Set up the proc fs entry for 'assocs' object. */ |
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 2e1f9c3556f5..5135e1a25d25 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -378,10 +378,13 @@ static int sctp_v4_available(union sctp_addr *addr, struct sctp_sock *sp) | |||
378 | { | 378 | { |
379 | int ret = inet_addr_type(addr->v4.sin_addr.s_addr); | 379 | int ret = inet_addr_type(addr->v4.sin_addr.s_addr); |
380 | 380 | ||
381 | /* FIXME: ip_nonlocal_bind sysctl support. */ | ||
382 | 381 | ||
383 | if (addr->v4.sin_addr.s_addr != INADDR_ANY && ret != RTN_LOCAL) | 382 | if (addr->v4.sin_addr.s_addr != INADDR_ANY && |
383 | ret != RTN_LOCAL && | ||
384 | !sp->inet.freebind && | ||
385 | !sysctl_ip_nonlocal_bind) | ||
384 | return 0; | 386 | return 0; |
387 | |||
385 | return 1; | 388 | return 1; |
386 | } | 389 | } |
387 | 390 | ||
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 0b338eca6dc0..2a3c0e08a090 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -4686,6 +4686,7 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, | |||
4686 | struct sctp_endpoint *newep = newsp->ep; | 4686 | struct sctp_endpoint *newep = newsp->ep; |
4687 | struct sk_buff *skb, *tmp; | 4687 | struct sk_buff *skb, *tmp; |
4688 | struct sctp_ulpevent *event; | 4688 | struct sctp_ulpevent *event; |
4689 | int flags = 0; | ||
4689 | 4690 | ||
4690 | /* Migrate socket buffer sizes and all the socket level options to the | 4691 | /* Migrate socket buffer sizes and all the socket level options to the |
4691 | * new socket. | 4692 | * new socket. |
@@ -4707,6 +4708,17 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, | |||
4707 | sctp_sk(newsk)->bind_hash = pp; | 4708 | sctp_sk(newsk)->bind_hash = pp; |
4708 | inet_sk(newsk)->num = inet_sk(oldsk)->num; | 4709 | inet_sk(newsk)->num = inet_sk(oldsk)->num; |
4709 | 4710 | ||
4711 | /* Copy the bind_addr list from the original endpoint to the new | ||
4712 | * endpoint so that we can handle restarts properly | ||
4713 | */ | ||
4714 | if (assoc->peer.ipv4_address) | ||
4715 | flags |= SCTP_ADDR4_PEERSUPP; | ||
4716 | if (assoc->peer.ipv6_address) | ||
4717 | flags |= SCTP_ADDR6_PEERSUPP; | ||
4718 | sctp_bind_addr_copy(&newsp->ep->base.bind_addr, | ||
4719 | &oldsp->ep->base.bind_addr, | ||
4720 | SCTP_SCOPE_GLOBAL, GFP_KERNEL, flags); | ||
4721 | |||
4710 | /* Move any messages in the old socket's receive queue that are for the | 4722 | /* Move any messages in the old socket's receive queue that are for the |
4711 | * peeled off association to the new socket's receive queue. | 4723 | * peeled off association to the new socket's receive queue. |
4712 | */ | 4724 | */ |