diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-10 11:09:41 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-10 11:09:41 -0500 |
commit | 4b0955a6edb9b058ca1314ca210a92ee166c4d9a (patch) | |
tree | 735e60ef67484b67432f2c81babab5bd37cb60ab | |
parent | 5bc159e6cb7ca8d173195919ee935885c129011e (diff) | |
parent | bab1deea308afcf9200837d6ac20aefe92972efb (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
-rw-r--r-- | include/linux/netlink.h | 3 | ||||
-rw-r--r-- | include/net/irda/irlap.h | 3 | ||||
-rw-r--r-- | ipc/mqueue.c | 3 | ||||
-rw-r--r-- | net/bridge/br_if.c | 94 | ||||
-rw-r--r-- | net/bridge/br_input.c | 19 | ||||
-rw-r--r-- | net/bridge/br_netfilter.c | 53 | ||||
-rw-r--r-- | net/bridge/br_private.h | 6 | ||||
-rw-r--r-- | net/bridge/br_stp_bpdu.c | 30 | ||||
-rw-r--r-- | net/bridge/br_sysfs_if.c | 50 | ||||
-rw-r--r-- | net/core/rtnetlink.c | 2 | ||||
-rw-r--r-- | net/ipv4/devinet.c | 2 | ||||
-rw-r--r-- | net/ipv4/fib_semantics.c | 2 | ||||
-rw-r--r-- | net/ipv4/tcp_input.c | 3 | ||||
-rw-r--r-- | net/irda/irda_device.c | 4 | ||||
-rw-r--r-- | net/irda/irnet/irnet_irda.c | 2 | ||||
-rw-r--r-- | net/netlink/af_netlink.c | 7 |
16 files changed, 155 insertions, 128 deletions
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index 6a2ccf78a356..c256ebe2a7b4 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
@@ -160,7 +160,8 @@ extern int netlink_unregister_notifier(struct notifier_block *nb); | |||
160 | 160 | ||
161 | /* finegrained unicast helpers: */ | 161 | /* finegrained unicast helpers: */ |
162 | struct sock *netlink_getsockbyfilp(struct file *filp); | 162 | struct sock *netlink_getsockbyfilp(struct file *filp); |
163 | int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, long timeo); | 163 | int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, |
164 | long timeo, struct sock *ssk); | ||
164 | void netlink_detachskb(struct sock *sk, struct sk_buff *skb); | 165 | void netlink_detachskb(struct sock *sk, struct sk_buff *skb); |
165 | int netlink_sendskb(struct sock *sk, struct sk_buff *skb, int protocol); | 166 | int netlink_sendskb(struct sock *sk, struct sk_buff *skb, int protocol); |
166 | 167 | ||
diff --git a/include/net/irda/irlap.h b/include/net/irda/irlap.h index f55e86e75030..2127cae1e0a6 100644 --- a/include/net/irda/irlap.h +++ b/include/net/irda/irlap.h | |||
@@ -50,6 +50,9 @@ | |||
50 | /* May be different when we get VFIR */ | 50 | /* May be different when we get VFIR */ |
51 | #define LAP_MAX_HEADER (LAP_ADDR_HEADER + LAP_CTRL_HEADER) | 51 | #define LAP_MAX_HEADER (LAP_ADDR_HEADER + LAP_CTRL_HEADER) |
52 | 52 | ||
53 | /* Each IrDA device gets a random 32 bits IRLAP device address */ | ||
54 | #define LAP_ALEN 4 | ||
55 | |||
53 | #define BROADCAST 0xffffffff /* Broadcast device address */ | 56 | #define BROADCAST 0xffffffff /* Broadcast device address */ |
54 | #define CBROADCAST 0xfe /* Connection broadcast address */ | 57 | #define CBROADCAST 0xfe /* Connection broadcast address */ |
55 | #define XID_FORMAT 0x01 /* Discovery XID format */ | 58 | #define XID_FORMAT 0x01 /* Discovery XID format */ |
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index 59302fc3643b..fd2e26b6f966 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c | |||
@@ -1018,7 +1018,8 @@ retry: | |||
1018 | goto out; | 1018 | goto out; |
1019 | } | 1019 | } |
1020 | 1020 | ||
1021 | ret = netlink_attachskb(sock, nc, 0, MAX_SCHEDULE_TIMEOUT); | 1021 | ret = netlink_attachskb(sock, nc, 0, |
1022 | MAX_SCHEDULE_TIMEOUT, NULL); | ||
1022 | if (ret == 1) | 1023 | if (ret == 1) |
1023 | goto retry; | 1024 | goto retry; |
1024 | if (ret) { | 1025 | if (ret) { |
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index da687c8dc6ff..7fa3a5a9971f 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c | |||
@@ -79,9 +79,14 @@ static int port_cost(struct net_device *dev) | |||
79 | */ | 79 | */ |
80 | static void port_carrier_check(void *arg) | 80 | static void port_carrier_check(void *arg) |
81 | { | 81 | { |
82 | struct net_bridge_port *p = arg; | 82 | struct net_device *dev = arg; |
83 | struct net_bridge_port *p; | ||
83 | 84 | ||
84 | rtnl_lock(); | 85 | rtnl_lock(); |
86 | p = dev->br_port; | ||
87 | if (!p) | ||
88 | goto done; | ||
89 | |||
85 | if (netif_carrier_ok(p->dev)) { | 90 | if (netif_carrier_ok(p->dev)) { |
86 | u32 cost = port_cost(p->dev); | 91 | u32 cost = port_cost(p->dev); |
87 | 92 | ||
@@ -97,19 +102,33 @@ static void port_carrier_check(void *arg) | |||
97 | br_stp_disable_port(p); | 102 | br_stp_disable_port(p); |
98 | spin_unlock_bh(&p->br->lock); | 103 | spin_unlock_bh(&p->br->lock); |
99 | } | 104 | } |
105 | done: | ||
100 | rtnl_unlock(); | 106 | rtnl_unlock(); |
101 | } | 107 | } |
102 | 108 | ||
109 | static void release_nbp(struct kobject *kobj) | ||
110 | { | ||
111 | struct net_bridge_port *p | ||
112 | = container_of(kobj, struct net_bridge_port, kobj); | ||
113 | kfree(p); | ||
114 | } | ||
115 | |||
116 | static struct kobj_type brport_ktype = { | ||
117 | #ifdef CONFIG_SYSFS | ||
118 | .sysfs_ops = &brport_sysfs_ops, | ||
119 | #endif | ||
120 | .release = release_nbp, | ||
121 | }; | ||
122 | |||
103 | static void destroy_nbp(struct net_bridge_port *p) | 123 | static void destroy_nbp(struct net_bridge_port *p) |
104 | { | 124 | { |
105 | struct net_device *dev = p->dev; | 125 | struct net_device *dev = p->dev; |
106 | 126 | ||
107 | dev->br_port = NULL; | ||
108 | p->br = NULL; | 127 | p->br = NULL; |
109 | p->dev = NULL; | 128 | p->dev = NULL; |
110 | dev_put(dev); | 129 | dev_put(dev); |
111 | 130 | ||
112 | br_sysfs_freeif(p); | 131 | kobject_put(&p->kobj); |
113 | } | 132 | } |
114 | 133 | ||
115 | static void destroy_nbp_rcu(struct rcu_head *head) | 134 | static void destroy_nbp_rcu(struct rcu_head *head) |
@@ -133,24 +152,24 @@ static void del_nbp(struct net_bridge_port *p) | |||
133 | struct net_bridge *br = p->br; | 152 | struct net_bridge *br = p->br; |
134 | struct net_device *dev = p->dev; | 153 | struct net_device *dev = p->dev; |
135 | 154 | ||
136 | /* Race between RTNL notify and RCU callback */ | 155 | sysfs_remove_link(&br->ifobj, dev->name); |
137 | if (p->deleted) | ||
138 | return; | ||
139 | 156 | ||
140 | dev_set_promiscuity(dev, -1); | 157 | dev_set_promiscuity(dev, -1); |
141 | 158 | ||
142 | cancel_delayed_work(&p->carrier_check); | 159 | cancel_delayed_work(&p->carrier_check); |
143 | flush_scheduled_work(); | ||
144 | 160 | ||
145 | spin_lock_bh(&br->lock); | 161 | spin_lock_bh(&br->lock); |
146 | br_stp_disable_port(p); | 162 | br_stp_disable_port(p); |
147 | p->deleted = 1; | ||
148 | spin_unlock_bh(&br->lock); | 163 | spin_unlock_bh(&br->lock); |
149 | 164 | ||
150 | br_fdb_delete_by_port(br, p); | 165 | br_fdb_delete_by_port(br, p); |
151 | 166 | ||
152 | list_del_rcu(&p->list); | 167 | list_del_rcu(&p->list); |
153 | 168 | ||
169 | rcu_assign_pointer(dev->br_port, NULL); | ||
170 | |||
171 | kobject_del(&p->kobj); | ||
172 | |||
154 | call_rcu(&p->rcu, destroy_nbp_rcu); | 173 | call_rcu(&p->rcu, destroy_nbp_rcu); |
155 | } | 174 | } |
156 | 175 | ||
@@ -160,7 +179,6 @@ static void del_br(struct net_bridge *br) | |||
160 | struct net_bridge_port *p, *n; | 179 | struct net_bridge_port *p, *n; |
161 | 180 | ||
162 | list_for_each_entry_safe(p, n, &br->port_list, list) { | 181 | list_for_each_entry_safe(p, n, &br->port_list, list) { |
163 | br_sysfs_removeif(p); | ||
164 | del_nbp(p); | 182 | del_nbp(p); |
165 | } | 183 | } |
166 | 184 | ||
@@ -254,13 +272,17 @@ static struct net_bridge_port *new_nbp(struct net_bridge *br, | |||
254 | p->dev = dev; | 272 | p->dev = dev; |
255 | p->path_cost = port_cost(dev); | 273 | p->path_cost = port_cost(dev); |
256 | p->priority = 0x8000 >> BR_PORT_BITS; | 274 | p->priority = 0x8000 >> BR_PORT_BITS; |
257 | dev->br_port = p; | ||
258 | p->port_no = index; | 275 | p->port_no = index; |
259 | br_init_port(p); | 276 | br_init_port(p); |
260 | p->state = BR_STATE_DISABLED; | 277 | p->state = BR_STATE_DISABLED; |
261 | INIT_WORK(&p->carrier_check, port_carrier_check, p); | 278 | INIT_WORK(&p->carrier_check, port_carrier_check, dev); |
262 | kobject_init(&p->kobj); | 279 | kobject_init(&p->kobj); |
263 | 280 | ||
281 | kobject_set_name(&p->kobj, SYSFS_BRIDGE_PORT_ATTR); | ||
282 | p->kobj.ktype = &brport_ktype; | ||
283 | p->kobj.parent = &(dev->class_dev.kobj); | ||
284 | p->kobj.kset = NULL; | ||
285 | |||
264 | return p; | 286 | return p; |
265 | } | 287 | } |
266 | 288 | ||
@@ -388,30 +410,43 @@ int br_add_if(struct net_bridge *br, struct net_device *dev) | |||
388 | if (dev->br_port != NULL) | 410 | if (dev->br_port != NULL) |
389 | return -EBUSY; | 411 | return -EBUSY; |
390 | 412 | ||
391 | if (IS_ERR(p = new_nbp(br, dev))) | 413 | p = new_nbp(br, dev); |
414 | if (IS_ERR(p)) | ||
392 | return PTR_ERR(p); | 415 | return PTR_ERR(p); |
393 | 416 | ||
394 | if ((err = br_fdb_insert(br, p, dev->dev_addr))) | 417 | err = kobject_add(&p->kobj); |
395 | destroy_nbp(p); | 418 | if (err) |
396 | 419 | goto err0; | |
397 | else if ((err = br_sysfs_addif(p))) | ||
398 | del_nbp(p); | ||
399 | else { | ||
400 | dev_set_promiscuity(dev, 1); | ||
401 | 420 | ||
402 | list_add_rcu(&p->list, &br->port_list); | 421 | err = br_fdb_insert(br, p, dev->dev_addr); |
422 | if (err) | ||
423 | goto err1; | ||
403 | 424 | ||
404 | spin_lock_bh(&br->lock); | 425 | err = br_sysfs_addif(p); |
405 | br_stp_recalculate_bridge_id(br); | 426 | if (err) |
406 | br_features_recompute(br); | 427 | goto err2; |
407 | if ((br->dev->flags & IFF_UP) | ||
408 | && (dev->flags & IFF_UP) && netif_carrier_ok(dev)) | ||
409 | br_stp_enable_port(p); | ||
410 | spin_unlock_bh(&br->lock); | ||
411 | 428 | ||
412 | dev_set_mtu(br->dev, br_min_mtu(br)); | 429 | rcu_assign_pointer(dev->br_port, p); |
413 | } | 430 | dev_set_promiscuity(dev, 1); |
431 | |||
432 | list_add_rcu(&p->list, &br->port_list); | ||
414 | 433 | ||
434 | spin_lock_bh(&br->lock); | ||
435 | br_stp_recalculate_bridge_id(br); | ||
436 | br_features_recompute(br); | ||
437 | schedule_delayed_work(&p->carrier_check, BR_PORT_DEBOUNCE); | ||
438 | spin_unlock_bh(&br->lock); | ||
439 | |||
440 | dev_set_mtu(br->dev, br_min_mtu(br)); | ||
441 | kobject_uevent(&p->kobj, KOBJ_ADD); | ||
442 | |||
443 | return 0; | ||
444 | err2: | ||
445 | br_fdb_delete_by_port(br, p); | ||
446 | err1: | ||
447 | kobject_del(&p->kobj); | ||
448 | err0: | ||
449 | kobject_put(&p->kobj); | ||
415 | return err; | 450 | return err; |
416 | } | 451 | } |
417 | 452 | ||
@@ -423,7 +458,6 @@ int br_del_if(struct net_bridge *br, struct net_device *dev) | |||
423 | if (!p || p->br != br) | 458 | if (!p || p->br != br) |
424 | return -EINVAL; | 459 | return -EINVAL; |
425 | 460 | ||
426 | br_sysfs_removeif(p); | ||
427 | del_nbp(p); | 461 | del_nbp(p); |
428 | 462 | ||
429 | spin_lock_bh(&br->lock); | 463 | spin_lock_bh(&br->lock); |
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c index e3a73cead6b6..4eef83755315 100644 --- a/net/bridge/br_input.c +++ b/net/bridge/br_input.c | |||
@@ -45,18 +45,20 @@ static void br_pass_frame_up(struct net_bridge *br, struct sk_buff *skb) | |||
45 | int br_handle_frame_finish(struct sk_buff *skb) | 45 | int br_handle_frame_finish(struct sk_buff *skb) |
46 | { | 46 | { |
47 | const unsigned char *dest = eth_hdr(skb)->h_dest; | 47 | const unsigned char *dest = eth_hdr(skb)->h_dest; |
48 | struct net_bridge_port *p = skb->dev->br_port; | 48 | struct net_bridge_port *p = rcu_dereference(skb->dev->br_port); |
49 | struct net_bridge *br = p->br; | 49 | struct net_bridge *br; |
50 | struct net_bridge_fdb_entry *dst; | 50 | struct net_bridge_fdb_entry *dst; |
51 | int passedup = 0; | 51 | int passedup = 0; |
52 | 52 | ||
53 | if (!p || p->state == BR_STATE_DISABLED) | ||
54 | goto drop; | ||
55 | |||
53 | /* insert into forwarding database after filtering to avoid spoofing */ | 56 | /* insert into forwarding database after filtering to avoid spoofing */ |
54 | br_fdb_update(p->br, p, eth_hdr(skb)->h_source); | 57 | br = p->br; |
58 | br_fdb_update(br, p, eth_hdr(skb)->h_source); | ||
55 | 59 | ||
56 | if (p->state == BR_STATE_LEARNING) { | 60 | if (p->state == BR_STATE_LEARNING) |
57 | kfree_skb(skb); | 61 | goto drop; |
58 | goto out; | ||
59 | } | ||
60 | 62 | ||
61 | if (br->dev->flags & IFF_PROMISC) { | 63 | if (br->dev->flags & IFF_PROMISC) { |
62 | struct sk_buff *skb2; | 64 | struct sk_buff *skb2; |
@@ -93,6 +95,9 @@ int br_handle_frame_finish(struct sk_buff *skb) | |||
93 | 95 | ||
94 | out: | 96 | out: |
95 | return 0; | 97 | return 0; |
98 | drop: | ||
99 | kfree_skb(skb); | ||
100 | goto out; | ||
96 | } | 101 | } |
97 | 102 | ||
98 | /* | 103 | /* |
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index 7cac3fb9f809..b5018166b0e5 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
@@ -51,9 +51,6 @@ | |||
51 | #define store_orig_dstaddr(skb) (skb_origaddr(skb) = (skb)->nh.iph->daddr) | 51 | #define store_orig_dstaddr(skb) (skb_origaddr(skb) = (skb)->nh.iph->daddr) |
52 | #define dnat_took_place(skb) (skb_origaddr(skb) != (skb)->nh.iph->daddr) | 52 | #define dnat_took_place(skb) (skb_origaddr(skb) != (skb)->nh.iph->daddr) |
53 | 53 | ||
54 | #define has_bridge_parent(device) ((device)->br_port != NULL) | ||
55 | #define bridge_parent(device) ((device)->br_port->br->dev) | ||
56 | |||
57 | #ifdef CONFIG_SYSCTL | 54 | #ifdef CONFIG_SYSCTL |
58 | static struct ctl_table_header *brnf_sysctl_header; | 55 | static struct ctl_table_header *brnf_sysctl_header; |
59 | static int brnf_call_iptables = 1; | 56 | static int brnf_call_iptables = 1; |
@@ -98,6 +95,12 @@ static struct rtable __fake_rtable = { | |||
98 | .rt_flags = 0, | 95 | .rt_flags = 0, |
99 | }; | 96 | }; |
100 | 97 | ||
98 | static inline struct net_device *bridge_parent(const struct net_device *dev) | ||
99 | { | ||
100 | struct net_bridge_port *port = rcu_dereference(dev->br_port); | ||
101 | |||
102 | return port ? port->br->dev : NULL; | ||
103 | } | ||
101 | 104 | ||
102 | /* PF_BRIDGE/PRE_ROUTING *********************************************/ | 105 | /* PF_BRIDGE/PRE_ROUTING *********************************************/ |
103 | /* Undo the changes made for ip6tables PREROUTING and continue the | 106 | /* Undo the changes made for ip6tables PREROUTING and continue the |
@@ -189,11 +192,15 @@ static int br_nf_pre_routing_finish_bridge(struct sk_buff *skb) | |||
189 | skb->nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING; | 192 | skb->nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING; |
190 | 193 | ||
191 | skb->dev = bridge_parent(skb->dev); | 194 | skb->dev = bridge_parent(skb->dev); |
192 | if (skb->protocol == __constant_htons(ETH_P_8021Q)) { | 195 | if (!skb->dev) |
193 | skb_pull(skb, VLAN_HLEN); | 196 | kfree_skb(skb); |
194 | skb->nh.raw += VLAN_HLEN; | 197 | else { |
198 | if (skb->protocol == __constant_htons(ETH_P_8021Q)) { | ||
199 | skb_pull(skb, VLAN_HLEN); | ||
200 | skb->nh.raw += VLAN_HLEN; | ||
201 | } | ||
202 | skb->dst->output(skb); | ||
195 | } | 203 | } |
196 | skb->dst->output(skb); | ||
197 | return 0; | 204 | return 0; |
198 | } | 205 | } |
199 | 206 | ||
@@ -270,7 +277,7 @@ bridged_dnat: | |||
270 | } | 277 | } |
271 | 278 | ||
272 | /* Some common code for IPv4/IPv6 */ | 279 | /* Some common code for IPv4/IPv6 */ |
273 | static void setup_pre_routing(struct sk_buff *skb) | 280 | static struct net_device *setup_pre_routing(struct sk_buff *skb) |
274 | { | 281 | { |
275 | struct nf_bridge_info *nf_bridge = skb->nf_bridge; | 282 | struct nf_bridge_info *nf_bridge = skb->nf_bridge; |
276 | 283 | ||
@@ -282,6 +289,8 @@ static void setup_pre_routing(struct sk_buff *skb) | |||
282 | nf_bridge->mask |= BRNF_NF_BRIDGE_PREROUTING; | 289 | nf_bridge->mask |= BRNF_NF_BRIDGE_PREROUTING; |
283 | nf_bridge->physindev = skb->dev; | 290 | nf_bridge->physindev = skb->dev; |
284 | skb->dev = bridge_parent(skb->dev); | 291 | skb->dev = bridge_parent(skb->dev); |
292 | |||
293 | return skb->dev; | ||
285 | } | 294 | } |
286 | 295 | ||
287 | /* We only check the length. A bridge shouldn't do any hop-by-hop stuff anyway */ | 296 | /* We only check the length. A bridge shouldn't do any hop-by-hop stuff anyway */ |
@@ -376,7 +385,8 @@ static unsigned int br_nf_pre_routing_ipv6(unsigned int hook, | |||
376 | nf_bridge_put(skb->nf_bridge); | 385 | nf_bridge_put(skb->nf_bridge); |
377 | if ((nf_bridge = nf_bridge_alloc(skb)) == NULL) | 386 | if ((nf_bridge = nf_bridge_alloc(skb)) == NULL) |
378 | return NF_DROP; | 387 | return NF_DROP; |
379 | setup_pre_routing(skb); | 388 | if (!setup_pre_routing(skb)) |
389 | return NF_DROP; | ||
380 | 390 | ||
381 | NF_HOOK(PF_INET6, NF_IP6_PRE_ROUTING, skb, skb->dev, NULL, | 391 | NF_HOOK(PF_INET6, NF_IP6_PRE_ROUTING, skb, skb->dev, NULL, |
382 | br_nf_pre_routing_finish_ipv6); | 392 | br_nf_pre_routing_finish_ipv6); |
@@ -465,7 +475,8 @@ static unsigned int br_nf_pre_routing(unsigned int hook, struct sk_buff **pskb, | |||
465 | nf_bridge_put(skb->nf_bridge); | 475 | nf_bridge_put(skb->nf_bridge); |
466 | if ((nf_bridge = nf_bridge_alloc(skb)) == NULL) | 476 | if ((nf_bridge = nf_bridge_alloc(skb)) == NULL) |
467 | return NF_DROP; | 477 | return NF_DROP; |
468 | setup_pre_routing(skb); | 478 | if (!setup_pre_routing(skb)) |
479 | return NF_DROP; | ||
469 | store_orig_dstaddr(skb); | 480 | store_orig_dstaddr(skb); |
470 | 481 | ||
471 | NF_HOOK(PF_INET, NF_IP_PRE_ROUTING, skb, skb->dev, NULL, | 482 | NF_HOOK(PF_INET, NF_IP_PRE_ROUTING, skb, skb->dev, NULL, |
@@ -539,11 +550,16 @@ static unsigned int br_nf_forward_ip(unsigned int hook, struct sk_buff **pskb, | |||
539 | struct sk_buff *skb = *pskb; | 550 | struct sk_buff *skb = *pskb; |
540 | struct nf_bridge_info *nf_bridge; | 551 | struct nf_bridge_info *nf_bridge; |
541 | struct vlan_ethhdr *hdr = vlan_eth_hdr(skb); | 552 | struct vlan_ethhdr *hdr = vlan_eth_hdr(skb); |
553 | struct net_device *parent; | ||
542 | int pf; | 554 | int pf; |
543 | 555 | ||
544 | if (!skb->nf_bridge) | 556 | if (!skb->nf_bridge) |
545 | return NF_ACCEPT; | 557 | return NF_ACCEPT; |
546 | 558 | ||
559 | parent = bridge_parent(out); | ||
560 | if (!parent) | ||
561 | return NF_DROP; | ||
562 | |||
547 | if (skb->protocol == __constant_htons(ETH_P_IP) || IS_VLAN_IP) | 563 | if (skb->protocol == __constant_htons(ETH_P_IP) || IS_VLAN_IP) |
548 | pf = PF_INET; | 564 | pf = PF_INET; |
549 | else | 565 | else |
@@ -564,8 +580,8 @@ static unsigned int br_nf_forward_ip(unsigned int hook, struct sk_buff **pskb, | |||
564 | nf_bridge->mask |= BRNF_BRIDGED; | 580 | nf_bridge->mask |= BRNF_BRIDGED; |
565 | nf_bridge->physoutdev = skb->dev; | 581 | nf_bridge->physoutdev = skb->dev; |
566 | 582 | ||
567 | NF_HOOK(pf, NF_IP_FORWARD, skb, bridge_parent(in), | 583 | NF_HOOK(pf, NF_IP_FORWARD, skb, bridge_parent(in), parent, |
568 | bridge_parent(out), br_nf_forward_finish); | 584 | br_nf_forward_finish); |
569 | 585 | ||
570 | return NF_STOLEN; | 586 | return NF_STOLEN; |
571 | } | 587 | } |
@@ -688,6 +704,8 @@ static unsigned int br_nf_local_out(unsigned int hook, struct sk_buff **pskb, | |||
688 | goto out; | 704 | goto out; |
689 | } | 705 | } |
690 | realoutdev = bridge_parent(skb->dev); | 706 | realoutdev = bridge_parent(skb->dev); |
707 | if (!realoutdev) | ||
708 | return NF_DROP; | ||
691 | 709 | ||
692 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) | 710 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) |
693 | /* iptables should match -o br0.x */ | 711 | /* iptables should match -o br0.x */ |
@@ -701,9 +719,11 @@ static unsigned int br_nf_local_out(unsigned int hook, struct sk_buff **pskb, | |||
701 | /* IP forwarded traffic has a physindev, locally | 719 | /* IP forwarded traffic has a physindev, locally |
702 | * generated traffic hasn't. */ | 720 | * generated traffic hasn't. */ |
703 | if (realindev != NULL) { | 721 | if (realindev != NULL) { |
704 | if (!(nf_bridge->mask & BRNF_DONT_TAKE_PARENT) && | 722 | if (!(nf_bridge->mask & BRNF_DONT_TAKE_PARENT) ) { |
705 | has_bridge_parent(realindev)) | 723 | struct net_device *parent = bridge_parent(realindev); |
706 | realindev = bridge_parent(realindev); | 724 | if (parent) |
725 | realindev = parent; | ||
726 | } | ||
707 | 727 | ||
708 | NF_HOOK_THRESH(pf, NF_IP_FORWARD, skb, realindev, | 728 | NF_HOOK_THRESH(pf, NF_IP_FORWARD, skb, realindev, |
709 | realoutdev, br_nf_local_out_finish, | 729 | realoutdev, br_nf_local_out_finish, |
@@ -743,6 +763,9 @@ static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff **pskb, | |||
743 | if (!nf_bridge) | 763 | if (!nf_bridge) |
744 | return NF_ACCEPT; | 764 | return NF_ACCEPT; |
745 | 765 | ||
766 | if (!realoutdev) | ||
767 | return NF_DROP; | ||
768 | |||
746 | if (skb->protocol == __constant_htons(ETH_P_IP) || IS_VLAN_IP) | 769 | if (skb->protocol == __constant_htons(ETH_P_IP) || IS_VLAN_IP) |
747 | pf = PF_INET; | 770 | pf = PF_INET; |
748 | else | 771 | else |
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index e330b17b6d81..8f10e09f251b 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h | |||
@@ -68,7 +68,6 @@ struct net_bridge_port | |||
68 | /* STP */ | 68 | /* STP */ |
69 | u8 priority; | 69 | u8 priority; |
70 | u8 state; | 70 | u8 state; |
71 | u8 deleted; | ||
72 | u16 port_no; | 71 | u16 port_no; |
73 | unsigned char topology_change_ack; | 72 | unsigned char topology_change_ack; |
74 | unsigned char config_pending; | 73 | unsigned char config_pending; |
@@ -233,9 +232,8 @@ extern void (*br_fdb_put_hook)(struct net_bridge_fdb_entry *ent); | |||
233 | 232 | ||
234 | #ifdef CONFIG_SYSFS | 233 | #ifdef CONFIG_SYSFS |
235 | /* br_sysfs_if.c */ | 234 | /* br_sysfs_if.c */ |
235 | extern struct sysfs_ops brport_sysfs_ops; | ||
236 | extern int br_sysfs_addif(struct net_bridge_port *p); | 236 | extern int br_sysfs_addif(struct net_bridge_port *p); |
237 | extern void br_sysfs_removeif(struct net_bridge_port *p); | ||
238 | extern void br_sysfs_freeif(struct net_bridge_port *p); | ||
239 | 237 | ||
240 | /* br_sysfs_br.c */ | 238 | /* br_sysfs_br.c */ |
241 | extern int br_sysfs_addbr(struct net_device *dev); | 239 | extern int br_sysfs_addbr(struct net_device *dev); |
@@ -244,8 +242,6 @@ extern void br_sysfs_delbr(struct net_device *dev); | |||
244 | #else | 242 | #else |
245 | 243 | ||
246 | #define br_sysfs_addif(p) (0) | 244 | #define br_sysfs_addif(p) (0) |
247 | #define br_sysfs_removeif(p) do { } while(0) | ||
248 | #define br_sysfs_freeif(p) kfree(p) | ||
249 | #define br_sysfs_addbr(dev) (0) | 245 | #define br_sysfs_addbr(dev) (0) |
250 | #define br_sysfs_delbr(dev) do { } while(0) | 246 | #define br_sysfs_delbr(dev) do { } while(0) |
251 | #endif /* CONFIG_SYSFS */ | 247 | #endif /* CONFIG_SYSFS */ |
diff --git a/net/bridge/br_stp_bpdu.c b/net/bridge/br_stp_bpdu.c index d071f1c9ad0b..296f6a487c52 100644 --- a/net/bridge/br_stp_bpdu.c +++ b/net/bridge/br_stp_bpdu.c | |||
@@ -133,29 +133,35 @@ void br_send_tcn_bpdu(struct net_bridge_port *p) | |||
133 | 133 | ||
134 | static const unsigned char header[6] = {0x42, 0x42, 0x03, 0x00, 0x00, 0x00}; | 134 | static const unsigned char header[6] = {0x42, 0x42, 0x03, 0x00, 0x00, 0x00}; |
135 | 135 | ||
136 | /* NO locks */ | 136 | /* NO locks, but rcu_read_lock (preempt_disabled) */ |
137 | int br_stp_handle_bpdu(struct sk_buff *skb) | 137 | int br_stp_handle_bpdu(struct sk_buff *skb) |
138 | { | 138 | { |
139 | struct net_bridge_port *p = skb->dev->br_port; | 139 | struct net_bridge_port *p = rcu_dereference(skb->dev->br_port); |
140 | struct net_bridge *br = p->br; | 140 | struct net_bridge *br; |
141 | unsigned char *buf; | 141 | unsigned char *buf; |
142 | 142 | ||
143 | if (!p) | ||
144 | goto err; | ||
145 | |||
146 | br = p->br; | ||
147 | spin_lock(&br->lock); | ||
148 | |||
149 | if (p->state == BR_STATE_DISABLED || !(br->dev->flags & IFF_UP)) | ||
150 | goto out; | ||
151 | |||
143 | /* insert into forwarding database after filtering to avoid spoofing */ | 152 | /* insert into forwarding database after filtering to avoid spoofing */ |
144 | br_fdb_update(p->br, p, eth_hdr(skb)->h_source); | 153 | br_fdb_update(br, p, eth_hdr(skb)->h_source); |
154 | |||
155 | if (!br->stp_enabled) | ||
156 | goto out; | ||
145 | 157 | ||
146 | /* need at least the 802 and STP headers */ | 158 | /* need at least the 802 and STP headers */ |
147 | if (!pskb_may_pull(skb, sizeof(header)+1) || | 159 | if (!pskb_may_pull(skb, sizeof(header)+1) || |
148 | memcmp(skb->data, header, sizeof(header))) | 160 | memcmp(skb->data, header, sizeof(header))) |
149 | goto err; | 161 | goto out; |
150 | 162 | ||
151 | buf = skb_pull(skb, sizeof(header)); | 163 | buf = skb_pull(skb, sizeof(header)); |
152 | 164 | ||
153 | spin_lock_bh(&br->lock); | ||
154 | if (p->state == BR_STATE_DISABLED | ||
155 | || !(br->dev->flags & IFF_UP) | ||
156 | || !br->stp_enabled) | ||
157 | goto out; | ||
158 | |||
159 | if (buf[0] == BPDU_TYPE_CONFIG) { | 165 | if (buf[0] == BPDU_TYPE_CONFIG) { |
160 | struct br_config_bpdu bpdu; | 166 | struct br_config_bpdu bpdu; |
161 | 167 | ||
@@ -201,7 +207,7 @@ int br_stp_handle_bpdu(struct sk_buff *skb) | |||
201 | br_received_tcn_bpdu(p); | 207 | br_received_tcn_bpdu(p); |
202 | } | 208 | } |
203 | out: | 209 | out: |
204 | spin_unlock_bh(&br->lock); | 210 | spin_unlock(&br->lock); |
205 | err: | 211 | err: |
206 | kfree_skb(skb); | 212 | kfree_skb(skb); |
207 | return 0; | 213 | return 0; |
diff --git a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c index 0ac0355d16dd..c51c9e42aeb3 100644 --- a/net/bridge/br_sysfs_if.c +++ b/net/bridge/br_sysfs_if.c | |||
@@ -195,23 +195,11 @@ static ssize_t brport_store(struct kobject * kobj, | |||
195 | return ret; | 195 | return ret; |
196 | } | 196 | } |
197 | 197 | ||
198 | /* called from kobject_put when port ref count goes to zero. */ | 198 | struct sysfs_ops brport_sysfs_ops = { |
199 | static void brport_release(struct kobject *kobj) | ||
200 | { | ||
201 | kfree(container_of(kobj, struct net_bridge_port, kobj)); | ||
202 | } | ||
203 | |||
204 | static struct sysfs_ops brport_sysfs_ops = { | ||
205 | .show = brport_show, | 199 | .show = brport_show, |
206 | .store = brport_store, | 200 | .store = brport_store, |
207 | }; | 201 | }; |
208 | 202 | ||
209 | static struct kobj_type brport_ktype = { | ||
210 | .sysfs_ops = &brport_sysfs_ops, | ||
211 | .release = brport_release, | ||
212 | }; | ||
213 | |||
214 | |||
215 | /* | 203 | /* |
216 | * Add sysfs entries to ethernet device added to a bridge. | 204 | * Add sysfs entries to ethernet device added to a bridge. |
217 | * Creates a brport subdirectory with bridge attributes. | 205 | * Creates a brport subdirectory with bridge attributes. |
@@ -223,17 +211,6 @@ int br_sysfs_addif(struct net_bridge_port *p) | |||
223 | struct brport_attribute **a; | 211 | struct brport_attribute **a; |
224 | int err; | 212 | int err; |
225 | 213 | ||
226 | ASSERT_RTNL(); | ||
227 | |||
228 | kobject_set_name(&p->kobj, SYSFS_BRIDGE_PORT_ATTR); | ||
229 | p->kobj.ktype = &brport_ktype; | ||
230 | p->kobj.parent = &(p->dev->class_dev.kobj); | ||
231 | p->kobj.kset = NULL; | ||
232 | |||
233 | err = kobject_add(&p->kobj); | ||
234 | if(err) | ||
235 | goto out1; | ||
236 | |||
237 | err = sysfs_create_link(&p->kobj, &br->dev->class_dev.kobj, | 214 | err = sysfs_create_link(&p->kobj, &br->dev->class_dev.kobj, |
238 | SYSFS_BRIDGE_PORT_LINK); | 215 | SYSFS_BRIDGE_PORT_LINK); |
239 | if (err) | 216 | if (err) |
@@ -245,28 +222,7 @@ int br_sysfs_addif(struct net_bridge_port *p) | |||
245 | goto out2; | 222 | goto out2; |
246 | } | 223 | } |
247 | 224 | ||
248 | err = sysfs_create_link(&br->ifobj, &p->kobj, p->dev->name); | 225 | err= sysfs_create_link(&br->ifobj, &p->kobj, p->dev->name); |
249 | if (err) | 226 | out2: |
250 | goto out2; | ||
251 | |||
252 | kobject_uevent(&p->kobj, KOBJ_ADD); | ||
253 | return 0; | ||
254 | out2: | ||
255 | kobject_del(&p->kobj); | ||
256 | out1: | ||
257 | return err; | 227 | return err; |
258 | } | 228 | } |
259 | |||
260 | void br_sysfs_removeif(struct net_bridge_port *p) | ||
261 | { | ||
262 | pr_debug("br_sysfs_removeif\n"); | ||
263 | sysfs_remove_link(&p->br->ifobj, p->dev->name); | ||
264 | kobject_uevent(&p->kobj, KOBJ_REMOVE); | ||
265 | kobject_del(&p->kobj); | ||
266 | } | ||
267 | |||
268 | void br_sysfs_freeif(struct net_bridge_port *p) | ||
269 | { | ||
270 | pr_debug("br_sysfs_freeif\n"); | ||
271 | kobject_put(&p->kobj); | ||
272 | } | ||
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 8700379685e0..eca2976abb25 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -455,7 +455,7 @@ void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change) | |||
455 | if (!skb) | 455 | if (!skb) |
456 | return; | 456 | return; |
457 | 457 | ||
458 | if (rtnetlink_fill_ifinfo(skb, dev, type, current->pid, 0, change, 0) < 0) { | 458 | if (rtnetlink_fill_ifinfo(skb, dev, type, 0, 0, change, 0) < 0) { |
459 | kfree_skb(skb); | 459 | kfree_skb(skb); |
460 | return; | 460 | return; |
461 | } | 461 | } |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 95b9d81ac488..3ffa60dadc0c 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -1135,7 +1135,7 @@ static void rtmsg_ifa(int event, struct in_ifaddr* ifa) | |||
1135 | 1135 | ||
1136 | if (!skb) | 1136 | if (!skb) |
1137 | netlink_set_err(rtnl, 0, RTNLGRP_IPV4_IFADDR, ENOBUFS); | 1137 | netlink_set_err(rtnl, 0, RTNLGRP_IPV4_IFADDR, ENOBUFS); |
1138 | else if (inet_fill_ifaddr(skb, ifa, current->pid, 0, event, 0) < 0) { | 1138 | else if (inet_fill_ifaddr(skb, ifa, 0, 0, event, 0) < 0) { |
1139 | kfree_skb(skb); | 1139 | kfree_skb(skb); |
1140 | netlink_set_err(rtnl, 0, RTNLGRP_IPV4_IFADDR, EINVAL); | 1140 | netlink_set_err(rtnl, 0, RTNLGRP_IPV4_IFADDR, EINVAL); |
1141 | } else { | 1141 | } else { |
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index ef4724de7350..0f4145babb14 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
@@ -1045,7 +1045,7 @@ fib_convert_rtentry(int cmd, struct nlmsghdr *nl, struct rtmsg *rtm, | |||
1045 | } | 1045 | } |
1046 | 1046 | ||
1047 | nl->nlmsg_flags = NLM_F_REQUEST; | 1047 | nl->nlmsg_flags = NLM_F_REQUEST; |
1048 | nl->nlmsg_pid = current->pid; | 1048 | nl->nlmsg_pid = 0; |
1049 | nl->nlmsg_seq = 0; | 1049 | nl->nlmsg_seq = 0; |
1050 | nl->nlmsg_len = NLMSG_LENGTH(sizeof(*rtm)); | 1050 | nl->nlmsg_len = NLMSG_LENGTH(sizeof(*rtm)); |
1051 | if (cmd == SIOCDELRT) { | 1051 | if (cmd == SIOCDELRT) { |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index a97ed5416c28..e9a54ae7d690 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -456,7 +456,8 @@ void tcp_rcv_space_adjust(struct sock *sk) | |||
456 | 456 | ||
457 | tp->rcvq_space.space = space; | 457 | tp->rcvq_space.space = space; |
458 | 458 | ||
459 | if (sysctl_tcp_moderate_rcvbuf) { | 459 | if (sysctl_tcp_moderate_rcvbuf && |
460 | !(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) { | ||
460 | int new_clamp = space; | 461 | int new_clamp = space; |
461 | 462 | ||
462 | /* Receive space grows, normalize in order to | 463 | /* Receive space grows, normalize in order to |
diff --git a/net/irda/irda_device.c b/net/irda/irda_device.c index 890bac0d4a56..e3debbdb67f5 100644 --- a/net/irda/irda_device.c +++ b/net/irda/irda_device.c | |||
@@ -343,12 +343,12 @@ static void irda_task_timer_expired(void *data) | |||
343 | static void irda_device_setup(struct net_device *dev) | 343 | static void irda_device_setup(struct net_device *dev) |
344 | { | 344 | { |
345 | dev->hard_header_len = 0; | 345 | dev->hard_header_len = 0; |
346 | dev->addr_len = 0; | 346 | dev->addr_len = LAP_ALEN; |
347 | 347 | ||
348 | dev->type = ARPHRD_IRDA; | 348 | dev->type = ARPHRD_IRDA; |
349 | dev->tx_queue_len = 8; /* Window size + 1 s-frame */ | 349 | dev->tx_queue_len = 8; /* Window size + 1 s-frame */ |
350 | 350 | ||
351 | memset(dev->broadcast, 0xff, 4); | 351 | memset(dev->broadcast, 0xff, LAP_ALEN); |
352 | 352 | ||
353 | dev->mtu = 2048; | 353 | dev->mtu = 2048; |
354 | dev->flags = IFF_NOARP; | 354 | dev->flags = IFF_NOARP; |
diff --git a/net/irda/irnet/irnet_irda.c b/net/irda/irnet/irnet_irda.c index 07ec326c71f5..f65c7a83bc5c 100644 --- a/net/irda/irnet/irnet_irda.c +++ b/net/irda/irnet/irnet_irda.c | |||
@@ -696,7 +696,7 @@ irnet_daddr_to_dname(irnet_socket * self) | |||
696 | { | 696 | { |
697 | /* Yes !!! Get it.. */ | 697 | /* Yes !!! Get it.. */ |
698 | strlcpy(self->rname, discoveries[i].info, sizeof(self->rname)); | 698 | strlcpy(self->rname, discoveries[i].info, sizeof(self->rname)); |
699 | self->rname[NICKNAME_MAX_LEN + 1] = '\0'; | 699 | self->rname[sizeof(self->rname) - 1] = '\0'; |
700 | DEBUG(IRDA_SERV_INFO, "Device 0x%08x is in fact ``%s''.\n", | 700 | DEBUG(IRDA_SERV_INFO, "Device 0x%08x is in fact ``%s''.\n", |
701 | self->daddr, self->rname); | 701 | self->daddr, self->rname); |
702 | kfree(discoveries); | 702 | kfree(discoveries); |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 2101b45d2ec6..6b9772d95872 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -702,7 +702,8 @@ struct sock *netlink_getsockbyfilp(struct file *filp) | |||
702 | * 0: continue | 702 | * 0: continue |
703 | * 1: repeat lookup - reference dropped while waiting for socket memory. | 703 | * 1: repeat lookup - reference dropped while waiting for socket memory. |
704 | */ | 704 | */ |
705 | int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, long timeo) | 705 | int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, |
706 | long timeo, struct sock *ssk) | ||
706 | { | 707 | { |
707 | struct netlink_sock *nlk; | 708 | struct netlink_sock *nlk; |
708 | 709 | ||
@@ -712,7 +713,7 @@ int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, long t | |||
712 | test_bit(0, &nlk->state)) { | 713 | test_bit(0, &nlk->state)) { |
713 | DECLARE_WAITQUEUE(wait, current); | 714 | DECLARE_WAITQUEUE(wait, current); |
714 | if (!timeo) { | 715 | if (!timeo) { |
715 | if (!nlk->pid) | 716 | if (!ssk || nlk_sk(ssk)->pid == 0) |
716 | netlink_overrun(sk); | 717 | netlink_overrun(sk); |
717 | sock_put(sk); | 718 | sock_put(sk); |
718 | kfree_skb(skb); | 719 | kfree_skb(skb); |
@@ -797,7 +798,7 @@ retry: | |||
797 | kfree_skb(skb); | 798 | kfree_skb(skb); |
798 | return PTR_ERR(sk); | 799 | return PTR_ERR(sk); |
799 | } | 800 | } |
800 | err = netlink_attachskb(sk, skb, nonblock, timeo); | 801 | err = netlink_attachskb(sk, skb, nonblock, timeo, ssk); |
801 | if (err == 1) | 802 | if (err == 1) |
802 | goto retry; | 803 | goto retry; |
803 | if (err) | 804 | if (err) |