diff options
Diffstat (limited to 'net')
43 files changed, 367 insertions, 78 deletions
diff --git a/net/atm/Makefile b/net/atm/Makefile index d5818751f6ba..89656d6c0b90 100644 --- a/net/atm/Makefile +++ b/net/atm/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for the ATM Protocol Families. | 2 | # Makefile for the ATM Protocol Families. |
3 | # | 3 | # |
4 | 4 | ||
5 | atm-y := addr.o pvc.o signaling.o svc.o ioctl.o common.o atm_misc.o raw.o resources.o | 5 | atm-y := addr.o pvc.o signaling.o svc.o ioctl.o common.o atm_misc.o raw.o resources.o atm_sysfs.o |
6 | mpoa-objs := mpc.o mpoa_caches.o mpoa_proc.o | 6 | mpoa-objs := mpc.o mpoa_caches.o mpoa_proc.o |
7 | 7 | ||
8 | obj-$(CONFIG_ATM) += atm.o | 8 | obj-$(CONFIG_ATM) += atm.o |
diff --git a/net/atm/atm_sysfs.c b/net/atm/atm_sysfs.c new file mode 100644 index 000000000000..5df4b9a068bb --- /dev/null +++ b/net/atm/atm_sysfs.c | |||
@@ -0,0 +1,176 @@ | |||
1 | /* ATM driver model support. */ | ||
2 | |||
3 | #include <linux/config.h> | ||
4 | #include <linux/kernel.h> | ||
5 | #include <linux/init.h> | ||
6 | #include <linux/kobject.h> | ||
7 | #include <linux/atmdev.h> | ||
8 | #include "common.h" | ||
9 | #include "resources.h" | ||
10 | |||
11 | #define to_atm_dev(cldev) container_of(cldev, struct atm_dev, class_dev) | ||
12 | |||
13 | static ssize_t show_type(struct class_device *cdev, char *buf) | ||
14 | { | ||
15 | struct atm_dev *adev = to_atm_dev(cdev); | ||
16 | return sprintf(buf, "%s\n", adev->type); | ||
17 | } | ||
18 | |||
19 | static ssize_t show_address(struct class_device *cdev, char *buf) | ||
20 | { | ||
21 | char *pos = buf; | ||
22 | struct atm_dev *adev = to_atm_dev(cdev); | ||
23 | int i; | ||
24 | |||
25 | for (i = 0; i < (ESI_LEN - 1); i++) | ||
26 | pos += sprintf(pos, "%02x:", adev->esi[i]); | ||
27 | pos += sprintf(pos, "%02x\n", adev->esi[i]); | ||
28 | |||
29 | return pos - buf; | ||
30 | } | ||
31 | |||
32 | static ssize_t show_atmaddress(struct class_device *cdev, char *buf) | ||
33 | { | ||
34 | unsigned long flags; | ||
35 | char *pos = buf; | ||
36 | struct atm_dev *adev = to_atm_dev(cdev); | ||
37 | struct atm_dev_addr *aaddr; | ||
38 | int bin[] = { 1, 2, 10, 6, 1 }, *fmt = bin; | ||
39 | int i, j; | ||
40 | |||
41 | spin_lock_irqsave(&adev->lock, flags); | ||
42 | list_for_each_entry(aaddr, &adev->local, entry) { | ||
43 | for(i = 0, j = 0; i < ATM_ESA_LEN; ++i, ++j) { | ||
44 | if (j == *fmt) { | ||
45 | pos += sprintf(pos, "."); | ||
46 | ++fmt; | ||
47 | j = 0; | ||
48 | } | ||
49 | pos += sprintf(pos, "%02x", aaddr->addr.sas_addr.prv[i]); | ||
50 | } | ||
51 | pos += sprintf(pos, "\n"); | ||
52 | } | ||
53 | spin_unlock_irqrestore(&adev->lock, flags); | ||
54 | |||
55 | return pos - buf; | ||
56 | } | ||
57 | |||
58 | static ssize_t show_carrier(struct class_device *cdev, char *buf) | ||
59 | { | ||
60 | char *pos = buf; | ||
61 | struct atm_dev *adev = to_atm_dev(cdev); | ||
62 | |||
63 | pos += sprintf(pos, "%d\n", | ||
64 | adev->signal == ATM_PHY_SIG_LOST ? 0 : 1); | ||
65 | |||
66 | return pos - buf; | ||
67 | } | ||
68 | |||
69 | static ssize_t show_link_rate(struct class_device *cdev, char *buf) | ||
70 | { | ||
71 | char *pos = buf; | ||
72 | struct atm_dev *adev = to_atm_dev(cdev); | ||
73 | int link_rate; | ||
74 | |||
75 | /* show the link rate, not the data rate */ | ||
76 | switch (adev->link_rate) { | ||
77 | case ATM_OC3_PCR: | ||
78 | link_rate = 155520000; | ||
79 | break; | ||
80 | case ATM_OC12_PCR: | ||
81 | link_rate = 622080000; | ||
82 | break; | ||
83 | case ATM_25_PCR: | ||
84 | link_rate = 25600000; | ||
85 | break; | ||
86 | default: | ||
87 | link_rate = adev->link_rate * 8 * 53; | ||
88 | } | ||
89 | pos += sprintf(pos, "%d\n", link_rate); | ||
90 | |||
91 | return pos - buf; | ||
92 | } | ||
93 | |||
94 | static CLASS_DEVICE_ATTR(address, S_IRUGO, show_address, NULL); | ||
95 | static CLASS_DEVICE_ATTR(atmaddress, S_IRUGO, show_atmaddress, NULL); | ||
96 | static CLASS_DEVICE_ATTR(carrier, S_IRUGO, show_carrier, NULL); | ||
97 | static CLASS_DEVICE_ATTR(type, S_IRUGO, show_type, NULL); | ||
98 | static CLASS_DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL); | ||
99 | |||
100 | static struct class_device_attribute *atm_attrs[] = { | ||
101 | &class_device_attr_atmaddress, | ||
102 | &class_device_attr_address, | ||
103 | &class_device_attr_carrier, | ||
104 | &class_device_attr_type, | ||
105 | &class_device_attr_link_rate, | ||
106 | NULL | ||
107 | }; | ||
108 | |||
109 | static int atm_uevent(struct class_device *cdev, char **envp, int num_envp, char *buf, int size) | ||
110 | { | ||
111 | struct atm_dev *adev; | ||
112 | int i = 0, len = 0; | ||
113 | |||
114 | if (!cdev) | ||
115 | return -ENODEV; | ||
116 | |||
117 | adev = to_atm_dev(cdev); | ||
118 | if (!adev) | ||
119 | return -ENODEV; | ||
120 | |||
121 | if (add_uevent_var(envp, num_envp, &i, buf, size, &len, | ||
122 | "NAME=%s%d", adev->type, adev->number)) | ||
123 | return -ENOMEM; | ||
124 | |||
125 | envp[i] = NULL; | ||
126 | return 0; | ||
127 | } | ||
128 | |||
129 | static void atm_release(struct class_device *cdev) | ||
130 | { | ||
131 | struct atm_dev *adev = to_atm_dev(cdev); | ||
132 | |||
133 | kfree(adev); | ||
134 | } | ||
135 | |||
136 | static struct class atm_class = { | ||
137 | .name = "atm", | ||
138 | .release = atm_release, | ||
139 | .uevent = atm_uevent, | ||
140 | }; | ||
141 | |||
142 | int atm_register_sysfs(struct atm_dev *adev) | ||
143 | { | ||
144 | struct class_device *cdev = &adev->class_dev; | ||
145 | int i, err; | ||
146 | |||
147 | cdev->class = &atm_class; | ||
148 | class_set_devdata(cdev, adev); | ||
149 | |||
150 | snprintf(cdev->class_id, BUS_ID_SIZE, "%s%d", adev->type, adev->number); | ||
151 | err = class_device_register(cdev); | ||
152 | if (err < 0) | ||
153 | return err; | ||
154 | |||
155 | for (i = 0; atm_attrs[i]; i++) | ||
156 | class_device_create_file(cdev, atm_attrs[i]); | ||
157 | |||
158 | return 0; | ||
159 | } | ||
160 | |||
161 | void atm_unregister_sysfs(struct atm_dev *adev) | ||
162 | { | ||
163 | struct class_device *cdev = &adev->class_dev; | ||
164 | |||
165 | class_device_del(cdev); | ||
166 | } | ||
167 | |||
168 | int __init atm_sysfs_init(void) | ||
169 | { | ||
170 | return class_register(&atm_class); | ||
171 | } | ||
172 | |||
173 | void __exit atm_sysfs_exit(void) | ||
174 | { | ||
175 | class_unregister(&atm_class); | ||
176 | } | ||
diff --git a/net/atm/common.c b/net/atm/common.c index ae002220fa99..35ab1a61e831 100644 --- a/net/atm/common.c +++ b/net/atm/common.c | |||
@@ -791,8 +791,14 @@ static int __init atm_init(void) | |||
791 | printk(KERN_ERR "atm_proc_init() failed with %d\n",error); | 791 | printk(KERN_ERR "atm_proc_init() failed with %d\n",error); |
792 | goto out_atmsvc_exit; | 792 | goto out_atmsvc_exit; |
793 | } | 793 | } |
794 | if ((error = atm_sysfs_init()) < 0) { | ||
795 | printk(KERN_ERR "atm_sysfs_init() failed with %d\n",error); | ||
796 | goto out_atmproc_exit; | ||
797 | } | ||
794 | out: | 798 | out: |
795 | return error; | 799 | return error; |
800 | out_atmproc_exit: | ||
801 | atm_proc_exit(); | ||
796 | out_atmsvc_exit: | 802 | out_atmsvc_exit: |
797 | atmsvc_exit(); | 803 | atmsvc_exit(); |
798 | out_atmpvc_exit: | 804 | out_atmpvc_exit: |
@@ -805,6 +811,7 @@ out_unregister_vcc_proto: | |||
805 | static void __exit atm_exit(void) | 811 | static void __exit atm_exit(void) |
806 | { | 812 | { |
807 | atm_proc_exit(); | 813 | atm_proc_exit(); |
814 | atm_sysfs_exit(); | ||
808 | atmsvc_exit(); | 815 | atmsvc_exit(); |
809 | atmpvc_exit(); | 816 | atmpvc_exit(); |
810 | proto_unregister(&vcc_proto); | 817 | proto_unregister(&vcc_proto); |
diff --git a/net/atm/common.h b/net/atm/common.h index 4887c317cefe..a422da7788fb 100644 --- a/net/atm/common.h +++ b/net/atm/common.h | |||
@@ -28,6 +28,8 @@ int atmpvc_init(void); | |||
28 | void atmpvc_exit(void); | 28 | void atmpvc_exit(void); |
29 | int atmsvc_init(void); | 29 | int atmsvc_init(void); |
30 | void atmsvc_exit(void); | 30 | void atmsvc_exit(void); |
31 | int atm_sysfs_init(void); | ||
32 | void atm_sysfs_exit(void); | ||
31 | 33 | ||
32 | #ifdef CONFIG_PROC_FS | 34 | #ifdef CONFIG_PROC_FS |
33 | int atm_proc_init(void); | 35 | int atm_proc_init(void); |
diff --git a/net/atm/resources.c b/net/atm/resources.c index 18ac80698f83..534baf704056 100644 --- a/net/atm/resources.c +++ b/net/atm/resources.c | |||
@@ -114,14 +114,27 @@ struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops, | |||
114 | printk(KERN_ERR "atm_dev_register: " | 114 | printk(KERN_ERR "atm_dev_register: " |
115 | "atm_proc_dev_register failed for dev %s\n", | 115 | "atm_proc_dev_register failed for dev %s\n", |
116 | type); | 116 | type); |
117 | mutex_unlock(&atm_dev_mutex); | 117 | goto out_fail; |
118 | kfree(dev); | 118 | } |
119 | return NULL; | 119 | |
120 | if (atm_register_sysfs(dev) < 0) { | ||
121 | printk(KERN_ERR "atm_dev_register: " | ||
122 | "atm_register_sysfs failed for dev %s\n", | ||
123 | type); | ||
124 | atm_proc_dev_deregister(dev); | ||
125 | goto out_fail; | ||
120 | } | 126 | } |
127 | |||
121 | list_add_tail(&dev->dev_list, &atm_devs); | 128 | list_add_tail(&dev->dev_list, &atm_devs); |
122 | mutex_unlock(&atm_dev_mutex); | ||
123 | 129 | ||
130 | out: | ||
131 | mutex_unlock(&atm_dev_mutex); | ||
124 | return dev; | 132 | return dev; |
133 | |||
134 | out_fail: | ||
135 | kfree(dev); | ||
136 | dev = NULL; | ||
137 | goto out; | ||
125 | } | 138 | } |
126 | 139 | ||
127 | 140 | ||
@@ -140,6 +153,7 @@ void atm_dev_deregister(struct atm_dev *dev) | |||
140 | mutex_unlock(&atm_dev_mutex); | 153 | mutex_unlock(&atm_dev_mutex); |
141 | 154 | ||
142 | atm_dev_release_vccs(dev); | 155 | atm_dev_release_vccs(dev); |
156 | atm_unregister_sysfs(dev); | ||
143 | atm_proc_dev_deregister(dev); | 157 | atm_proc_dev_deregister(dev); |
144 | 158 | ||
145 | atm_dev_put(dev); | 159 | atm_dev_put(dev); |
diff --git a/net/atm/resources.h b/net/atm/resources.h index ac7222fee7a8..644989980c37 100644 --- a/net/atm/resources.h +++ b/net/atm/resources.h | |||
@@ -43,4 +43,6 @@ static inline void atm_proc_dev_deregister(struct atm_dev *dev) | |||
43 | 43 | ||
44 | #endif /* CONFIG_PROC_FS */ | 44 | #endif /* CONFIG_PROC_FS */ |
45 | 45 | ||
46 | int atm_register_sysfs(struct atm_dev *adev); | ||
47 | void atm_unregister_sysfs(struct atm_dev *adev); | ||
46 | #endif | 48 | #endif |
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index 2afdc7c0736c..f8dbcee80eba 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c | |||
@@ -184,6 +184,6 @@ void br_dev_setup(struct net_device *dev) | |||
184 | dev->set_mac_address = br_set_mac_address; | 184 | dev->set_mac_address = br_set_mac_address; |
185 | dev->priv_flags = IFF_EBRIDGE; | 185 | dev->priv_flags = IFF_EBRIDGE; |
186 | 186 | ||
187 | dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | 187 | dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | |
188 | | NETIF_F_HIGHDMA | NETIF_F_TSO | NETIF_F_NO_CSUM; | 188 | NETIF_F_TSO | NETIF_F_NO_CSUM | NETIF_F_GSO_ROBUST; |
189 | } | 189 | } |
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 07956ecf545e..f55ef682ef84 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c | |||
@@ -392,7 +392,8 @@ void br_features_recompute(struct net_bridge *br) | |||
392 | features &= feature; | 392 | features &= feature; |
393 | } | 393 | } |
394 | 394 | ||
395 | br->dev->features = features | checksum | NETIF_F_LLTX; | 395 | br->dev->features = features | checksum | NETIF_F_LLTX | |
396 | NETIF_F_GSO_ROBUST; | ||
396 | } | 397 | } |
397 | 398 | ||
398 | /* called with RTNL */ | 399 | /* called with RTNL */ |
diff --git a/net/core/dev.c b/net/core/dev.c index f1c52cbd6ef7..08976b08df5b 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1190,11 +1190,14 @@ out: | |||
1190 | /** | 1190 | /** |
1191 | * skb_gso_segment - Perform segmentation on skb. | 1191 | * skb_gso_segment - Perform segmentation on skb. |
1192 | * @skb: buffer to segment | 1192 | * @skb: buffer to segment |
1193 | * @sg: whether scatter-gather is supported on the target. | 1193 | * @features: features for the output path (see dev->features) |
1194 | * | 1194 | * |
1195 | * This function segments the given skb and returns a list of segments. | 1195 | * This function segments the given skb and returns a list of segments. |
1196 | * | ||
1197 | * It may return NULL if the skb requires no segmentation. This is | ||
1198 | * only possible when GSO is used for verifying header integrity. | ||
1196 | */ | 1199 | */ |
1197 | struct sk_buff *skb_gso_segment(struct sk_buff *skb, int sg) | 1200 | struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features) |
1198 | { | 1201 | { |
1199 | struct sk_buff *segs = ERR_PTR(-EPROTONOSUPPORT); | 1202 | struct sk_buff *segs = ERR_PTR(-EPROTONOSUPPORT); |
1200 | struct packet_type *ptype; | 1203 | struct packet_type *ptype; |
@@ -1210,12 +1213,14 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb, int sg) | |||
1210 | rcu_read_lock(); | 1213 | rcu_read_lock(); |
1211 | list_for_each_entry_rcu(ptype, &ptype_base[ntohs(type) & 15], list) { | 1214 | list_for_each_entry_rcu(ptype, &ptype_base[ntohs(type) & 15], list) { |
1212 | if (ptype->type == type && !ptype->dev && ptype->gso_segment) { | 1215 | if (ptype->type == type && !ptype->dev && ptype->gso_segment) { |
1213 | segs = ptype->gso_segment(skb, sg); | 1216 | segs = ptype->gso_segment(skb, features); |
1214 | break; | 1217 | break; |
1215 | } | 1218 | } |
1216 | } | 1219 | } |
1217 | rcu_read_unlock(); | 1220 | rcu_read_unlock(); |
1218 | 1221 | ||
1222 | __skb_push(skb, skb->data - skb->mac.raw); | ||
1223 | |||
1219 | return segs; | 1224 | return segs; |
1220 | } | 1225 | } |
1221 | 1226 | ||
@@ -1234,7 +1239,6 @@ void netdev_rx_csum_fault(struct net_device *dev) | |||
1234 | EXPORT_SYMBOL(netdev_rx_csum_fault); | 1239 | EXPORT_SYMBOL(netdev_rx_csum_fault); |
1235 | #endif | 1240 | #endif |
1236 | 1241 | ||
1237 | #ifdef CONFIG_HIGHMEM | ||
1238 | /* Actually, we should eliminate this check as soon as we know, that: | 1242 | /* Actually, we should eliminate this check as soon as we know, that: |
1239 | * 1. IOMMU is present and allows to map all the memory. | 1243 | * 1. IOMMU is present and allows to map all the memory. |
1240 | * 2. No high memory really exists on this machine. | 1244 | * 2. No high memory really exists on this machine. |
@@ -1242,6 +1246,7 @@ EXPORT_SYMBOL(netdev_rx_csum_fault); | |||
1242 | 1246 | ||
1243 | static inline int illegal_highdma(struct net_device *dev, struct sk_buff *skb) | 1247 | static inline int illegal_highdma(struct net_device *dev, struct sk_buff *skb) |
1244 | { | 1248 | { |
1249 | #ifdef CONFIG_HIGHMEM | ||
1245 | int i; | 1250 | int i; |
1246 | 1251 | ||
1247 | if (dev->features & NETIF_F_HIGHDMA) | 1252 | if (dev->features & NETIF_F_HIGHDMA) |
@@ -1251,11 +1256,9 @@ static inline int illegal_highdma(struct net_device *dev, struct sk_buff *skb) | |||
1251 | if (PageHighMem(skb_shinfo(skb)->frags[i].page)) | 1256 | if (PageHighMem(skb_shinfo(skb)->frags[i].page)) |
1252 | return 1; | 1257 | return 1; |
1253 | 1258 | ||
1259 | #endif | ||
1254 | return 0; | 1260 | return 0; |
1255 | } | 1261 | } |
1256 | #else | ||
1257 | #define illegal_highdma(dev, skb) (0) | ||
1258 | #endif | ||
1259 | 1262 | ||
1260 | struct dev_gso_cb { | 1263 | struct dev_gso_cb { |
1261 | void (*destructor)(struct sk_buff *skb); | 1264 | void (*destructor)(struct sk_buff *skb); |
@@ -1291,9 +1294,15 @@ static int dev_gso_segment(struct sk_buff *skb) | |||
1291 | { | 1294 | { |
1292 | struct net_device *dev = skb->dev; | 1295 | struct net_device *dev = skb->dev; |
1293 | struct sk_buff *segs; | 1296 | struct sk_buff *segs; |
1297 | int features = dev->features & ~(illegal_highdma(dev, skb) ? | ||
1298 | NETIF_F_SG : 0); | ||
1299 | |||
1300 | segs = skb_gso_segment(skb, features); | ||
1301 | |||
1302 | /* Verifying header integrity only. */ | ||
1303 | if (!segs) | ||
1304 | return 0; | ||
1294 | 1305 | ||
1295 | segs = skb_gso_segment(skb, dev->features & NETIF_F_SG && | ||
1296 | !illegal_highdma(dev, skb)); | ||
1297 | if (unlikely(IS_ERR(segs))) | 1306 | if (unlikely(IS_ERR(segs))) |
1298 | return PTR_ERR(segs); | 1307 | return PTR_ERR(segs); |
1299 | 1308 | ||
@@ -1310,13 +1319,17 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1310 | if (netdev_nit) | 1319 | if (netdev_nit) |
1311 | dev_queue_xmit_nit(skb, dev); | 1320 | dev_queue_xmit_nit(skb, dev); |
1312 | 1321 | ||
1313 | if (!netif_needs_gso(dev, skb)) | 1322 | if (netif_needs_gso(dev, skb)) { |
1314 | return dev->hard_start_xmit(skb, dev); | 1323 | if (unlikely(dev_gso_segment(skb))) |
1324 | goto out_kfree_skb; | ||
1325 | if (skb->next) | ||
1326 | goto gso; | ||
1327 | } | ||
1315 | 1328 | ||
1316 | if (unlikely(dev_gso_segment(skb))) | 1329 | return dev->hard_start_xmit(skb, dev); |
1317 | goto out_kfree_skb; | ||
1318 | } | 1330 | } |
1319 | 1331 | ||
1332 | gso: | ||
1320 | do { | 1333 | do { |
1321 | struct sk_buff *nskb = skb->next; | 1334 | struct sk_buff *nskb = skb->next; |
1322 | int rc; | 1335 | int rc; |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 3fcfa9c59e1f..f25aac17497a 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -663,7 +663,7 @@ rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, int *errp) | |||
663 | sz_idx = type>>2; | 663 | sz_idx = type>>2; |
664 | kind = type&3; | 664 | kind = type&3; |
665 | 665 | ||
666 | if (kind != 2 && security_netlink_recv(skb)) { | 666 | if (kind != 2 && security_netlink_recv(skb, CAP_NET_ADMIN)) { |
667 | *errp = -EPERM; | 667 | *errp = -EPERM; |
668 | return -1; | 668 | return -1; |
669 | } | 669 | } |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 6edbb90cbcec..a1c9ecf4f1e0 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -272,7 +272,7 @@ static void skb_clone_fraglist(struct sk_buff *skb) | |||
272 | skb_get(list); | 272 | skb_get(list); |
273 | } | 273 | } |
274 | 274 | ||
275 | void skb_release_data(struct sk_buff *skb) | 275 | static void skb_release_data(struct sk_buff *skb) |
276 | { | 276 | { |
277 | if (!skb->cloned || | 277 | if (!skb->cloned || |
278 | !atomic_sub_return(skb->nohdr ? (1 << SKB_DATAREF_SHIFT) + 1 : 1, | 278 | !atomic_sub_return(skb->nohdr ? (1 << SKB_DATAREF_SHIFT) + 1 : 1, |
@@ -1848,13 +1848,13 @@ EXPORT_SYMBOL_GPL(skb_pull_rcsum); | |||
1848 | /** | 1848 | /** |
1849 | * skb_segment - Perform protocol segmentation on skb. | 1849 | * skb_segment - Perform protocol segmentation on skb. |
1850 | * @skb: buffer to segment | 1850 | * @skb: buffer to segment |
1851 | * @sg: whether scatter-gather can be used for generated segments | 1851 | * @features: features for the output path (see dev->features) |
1852 | * | 1852 | * |
1853 | * This function performs segmentation on the given skb. It returns | 1853 | * This function performs segmentation on the given skb. It returns |
1854 | * the segment at the given position. It returns NULL if there are | 1854 | * the segment at the given position. It returns NULL if there are |
1855 | * no more segments to generate, or when an error is encountered. | 1855 | * no more segments to generate, or when an error is encountered. |
1856 | */ | 1856 | */ |
1857 | struct sk_buff *skb_segment(struct sk_buff *skb, int sg) | 1857 | struct sk_buff *skb_segment(struct sk_buff *skb, int features) |
1858 | { | 1858 | { |
1859 | struct sk_buff *segs = NULL; | 1859 | struct sk_buff *segs = NULL; |
1860 | struct sk_buff *tail = NULL; | 1860 | struct sk_buff *tail = NULL; |
@@ -1863,6 +1863,7 @@ struct sk_buff *skb_segment(struct sk_buff *skb, int sg) | |||
1863 | unsigned int offset = doffset; | 1863 | unsigned int offset = doffset; |
1864 | unsigned int headroom; | 1864 | unsigned int headroom; |
1865 | unsigned int len; | 1865 | unsigned int len; |
1866 | int sg = features & NETIF_F_SG; | ||
1866 | int nfrags = skb_shinfo(skb)->nr_frags; | 1867 | int nfrags = skb_shinfo(skb)->nr_frags; |
1867 | int err = -ENOMEM; | 1868 | int err = -ENOMEM; |
1868 | int i = 0; | 1869 | int i = 0; |
diff --git a/net/core/sock.c b/net/core/sock.c index 5d820c376653..204a8dec65cc 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -565,6 +565,13 @@ set_rcvbuf: | |||
565 | ret = -ENONET; | 565 | ret = -ENONET; |
566 | break; | 566 | break; |
567 | 567 | ||
568 | case SO_PASSSEC: | ||
569 | if (valbool) | ||
570 | set_bit(SOCK_PASSSEC, &sock->flags); | ||
571 | else | ||
572 | clear_bit(SOCK_PASSSEC, &sock->flags); | ||
573 | break; | ||
574 | |||
568 | /* We implement the SO_SNDLOWAT etc to | 575 | /* We implement the SO_SNDLOWAT etc to |
569 | not be settable (1003.1g 5.3) */ | 576 | not be settable (1003.1g 5.3) */ |
570 | default: | 577 | default: |
@@ -723,6 +730,10 @@ int sock_getsockopt(struct socket *sock, int level, int optname, | |||
723 | v.val = sk->sk_state == TCP_LISTEN; | 730 | v.val = sk->sk_state == TCP_LISTEN; |
724 | break; | 731 | break; |
725 | 732 | ||
733 | case SO_PASSSEC: | ||
734 | v.val = test_bit(SOCK_PASSSEC, &sock->flags) ? 1 : 0; | ||
735 | break; | ||
736 | |||
726 | case SO_PEERSEC: | 737 | case SO_PEERSEC: |
727 | return security_socket_getpeersec_stream(sock, optval, optlen, len); | 738 | return security_socket_getpeersec_stream(sock, optval, optlen, len); |
728 | 739 | ||
diff --git a/net/decnet/netfilter/dn_rtmsg.c b/net/decnet/netfilter/dn_rtmsg.c index 74133ecd7700..8b99bd33540d 100644 --- a/net/decnet/netfilter/dn_rtmsg.c +++ b/net/decnet/netfilter/dn_rtmsg.c | |||
@@ -107,7 +107,7 @@ static inline void dnrmg_receive_user_skb(struct sk_buff *skb) | |||
107 | if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len) | 107 | if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len) |
108 | return; | 108 | return; |
109 | 109 | ||
110 | if (!cap_raised(NETLINK_CB(skb).eff_cap, CAP_NET_ADMIN)) | 110 | if (security_netlink_recv(skb, CAP_NET_ADMIN)) |
111 | RCV_SKB_FAIL(-EPERM); | 111 | RCV_SKB_FAIL(-EPERM); |
112 | 112 | ||
113 | /* Eventually we might send routing messages too */ | 113 | /* Eventually we might send routing messages too */ |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 461216b47948..8d157157bf8e 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -1097,7 +1097,7 @@ int inet_sk_rebuild_header(struct sock *sk) | |||
1097 | 1097 | ||
1098 | EXPORT_SYMBOL(inet_sk_rebuild_header); | 1098 | EXPORT_SYMBOL(inet_sk_rebuild_header); |
1099 | 1099 | ||
1100 | static struct sk_buff *inet_gso_segment(struct sk_buff *skb, int sg) | 1100 | static struct sk_buff *inet_gso_segment(struct sk_buff *skb, int features) |
1101 | { | 1101 | { |
1102 | struct sk_buff *segs = ERR_PTR(-EINVAL); | 1102 | struct sk_buff *segs = ERR_PTR(-EINVAL); |
1103 | struct iphdr *iph; | 1103 | struct iphdr *iph; |
@@ -1126,10 +1126,10 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb, int sg) | |||
1126 | rcu_read_lock(); | 1126 | rcu_read_lock(); |
1127 | ops = rcu_dereference(inet_protos[proto]); | 1127 | ops = rcu_dereference(inet_protos[proto]); |
1128 | if (ops && ops->gso_segment) | 1128 | if (ops && ops->gso_segment) |
1129 | segs = ops->gso_segment(skb, sg); | 1129 | segs = ops->gso_segment(skb, features); |
1130 | rcu_read_unlock(); | 1130 | rcu_read_unlock(); |
1131 | 1131 | ||
1132 | if (IS_ERR(segs)) | 1132 | if (!segs || unlikely(IS_ERR(segs))) |
1133 | goto out; | 1133 | goto out; |
1134 | 1134 | ||
1135 | skb = segs; | 1135 | skb = segs; |
diff --git a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig index e1d7f5fbc526..ef0b5aac5838 100644 --- a/net/ipv4/netfilter/Kconfig +++ b/net/ipv4/netfilter/Kconfig | |||
@@ -332,7 +332,7 @@ config IP_NF_MATCH_HASHLIMIT | |||
332 | help | 332 | help |
333 | This option adds a new iptables `hashlimit' match. | 333 | This option adds a new iptables `hashlimit' match. |
334 | 334 | ||
335 | As opposed to `limit', this match dynamically crates a hash table | 335 | As opposed to `limit', this match dynamically creates a hash table |
336 | of limit buckets, based on your selection of source/destination | 336 | of limit buckets, based on your selection of source/destination |
337 | ip addresses and/or ports. | 337 | ip addresses and/or ports. |
338 | 338 | ||
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c index d0d19192026d..ad39bf640567 100644 --- a/net/ipv4/netfilter/arp_tables.c +++ b/net/ipv4/netfilter/arp_tables.c | |||
@@ -1120,7 +1120,8 @@ int arpt_register_table(struct arpt_table *table, | |||
1120 | return ret; | 1120 | return ret; |
1121 | } | 1121 | } |
1122 | 1122 | ||
1123 | if (xt_register_table(table, &bootstrap, newinfo) != 0) { | 1123 | ret = xt_register_table(table, &bootstrap, newinfo); |
1124 | if (ret != 0) { | ||
1124 | xt_free_table_info(newinfo); | 1125 | xt_free_table_info(newinfo); |
1125 | return ret; | 1126 | return ret; |
1126 | } | 1127 | } |
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c index b93f0494362f..198ac36db861 100644 --- a/net/ipv4/netfilter/ip_queue.c +++ b/net/ipv4/netfilter/ip_queue.c | |||
@@ -457,11 +457,19 @@ dev_cmp(struct ipq_queue_entry *entry, unsigned long ifindex) | |||
457 | if (entry->info->indev) | 457 | if (entry->info->indev) |
458 | if (entry->info->indev->ifindex == ifindex) | 458 | if (entry->info->indev->ifindex == ifindex) |
459 | return 1; | 459 | return 1; |
460 | |||
461 | if (entry->info->outdev) | 460 | if (entry->info->outdev) |
462 | if (entry->info->outdev->ifindex == ifindex) | 461 | if (entry->info->outdev->ifindex == ifindex) |
463 | return 1; | 462 | return 1; |
464 | 463 | #ifdef CONFIG_BRIDGE_NETFILTER | |
464 | if (entry->skb->nf_bridge) { | ||
465 | if (entry->skb->nf_bridge->physindev && | ||
466 | entry->skb->nf_bridge->physindev->ifindex == ifindex) | ||
467 | return 1; | ||
468 | if (entry->skb->nf_bridge->physoutdev && | ||
469 | entry->skb->nf_bridge->physoutdev->ifindex == ifindex) | ||
470 | return 1; | ||
471 | } | ||
472 | #endif | ||
465 | return 0; | 473 | return 0; |
466 | } | 474 | } |
467 | 475 | ||
@@ -507,7 +515,7 @@ ipq_rcv_skb(struct sk_buff *skb) | |||
507 | if (type <= IPQM_BASE) | 515 | if (type <= IPQM_BASE) |
508 | return; | 516 | return; |
509 | 517 | ||
510 | if (security_netlink_recv(skb)) | 518 | if (security_netlink_recv(skb, CAP_NET_ADMIN)) |
511 | RCV_SKB_FAIL(-EPERM); | 519 | RCV_SKB_FAIL(-EPERM); |
512 | 520 | ||
513 | write_lock_bh(&queue_lock); | 521 | write_lock_bh(&queue_lock); |
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c index 706c0025ec5e..7aaaf92efb59 100644 --- a/net/ipv4/netfilter/ip_tables.c +++ b/net/ipv4/netfilter/ip_tables.c | |||
@@ -2113,7 +2113,8 @@ int ipt_register_table(struct xt_table *table, const struct ipt_replace *repl) | |||
2113 | return ret; | 2113 | return ret; |
2114 | } | 2114 | } |
2115 | 2115 | ||
2116 | if (xt_register_table(table, &bootstrap, newinfo) != 0) { | 2116 | ret = xt_register_table(table, &bootstrap, newinfo); |
2117 | if (ret != 0) { | ||
2117 | xt_free_table_info(newinfo); | 2118 | xt_free_table_info(newinfo); |
2118 | return ret; | 2119 | return ret; |
2119 | } | 2120 | } |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index c04176be7ed1..0336422c88a0 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -2145,7 +2145,7 @@ int compat_tcp_getsockopt(struct sock *sk, int level, int optname, | |||
2145 | EXPORT_SYMBOL(compat_tcp_getsockopt); | 2145 | EXPORT_SYMBOL(compat_tcp_getsockopt); |
2146 | #endif | 2146 | #endif |
2147 | 2147 | ||
2148 | struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int sg) | 2148 | struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features) |
2149 | { | 2149 | { |
2150 | struct sk_buff *segs = ERR_PTR(-EINVAL); | 2150 | struct sk_buff *segs = ERR_PTR(-EINVAL); |
2151 | struct tcphdr *th; | 2151 | struct tcphdr *th; |
@@ -2166,10 +2166,14 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int sg) | |||
2166 | if (!pskb_may_pull(skb, thlen)) | 2166 | if (!pskb_may_pull(skb, thlen)) |
2167 | goto out; | 2167 | goto out; |
2168 | 2168 | ||
2169 | segs = NULL; | ||
2170 | if (skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST)) | ||
2171 | goto out; | ||
2172 | |||
2169 | oldlen = (u16)~skb->len; | 2173 | oldlen = (u16)~skb->len; |
2170 | __skb_pull(skb, thlen); | 2174 | __skb_pull(skb, thlen); |
2171 | 2175 | ||
2172 | segs = skb_segment(skb, sg); | 2176 | segs = skb_segment(skb, features); |
2173 | if (IS_ERR(segs)) | 2177 | if (IS_ERR(segs)) |
2174 | goto out; | 2178 | goto out; |
2175 | 2179 | ||
diff --git a/net/ipv4/tcp_diag.c b/net/ipv4/tcp_diag.c index c148c1081880..b56399c7cc12 100644 --- a/net/ipv4/tcp_diag.c +++ b/net/ipv4/tcp_diag.c | |||
@@ -26,7 +26,10 @@ static void tcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r, | |||
26 | const struct tcp_sock *tp = tcp_sk(sk); | 26 | const struct tcp_sock *tp = tcp_sk(sk); |
27 | struct tcp_info *info = _info; | 27 | struct tcp_info *info = _info; |
28 | 28 | ||
29 | r->idiag_rqueue = tp->rcv_nxt - tp->copied_seq; | 29 | if (sk->sk_state == TCP_LISTEN) |
30 | r->idiag_rqueue = sk->sk_ack_backlog; | ||
31 | else | ||
32 | r->idiag_rqueue = tp->rcv_nxt - tp->copied_seq; | ||
30 | r->idiag_wqueue = tp->write_seq - tp->snd_una; | 33 | r->idiag_wqueue = tp->write_seq - tp->snd_una; |
31 | if (info != NULL) | 34 | if (info != NULL) |
32 | tcp_get_info(sk, info); | 35 | tcp_get_info(sk, info); |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 94fe5b1f9dcb..7fa0b4a8a389 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -4178,8 +4178,6 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, | |||
4178 | */ | 4178 | */ |
4179 | 4179 | ||
4180 | TCP_ECN_rcv_synack(tp, th); | 4180 | TCP_ECN_rcv_synack(tp, th); |
4181 | if (tp->ecn_flags&TCP_ECN_OK) | ||
4182 | sock_set_flag(sk, SOCK_NO_LARGESEND); | ||
4183 | 4181 | ||
4184 | tp->snd_wl1 = TCP_SKB_CB(skb)->seq; | 4182 | tp->snd_wl1 = TCP_SKB_CB(skb)->seq; |
4185 | tcp_ack(sk, skb, FLAG_SLOWPATH); | 4183 | tcp_ack(sk, skb, FLAG_SLOWPATH); |
@@ -4322,8 +4320,6 @@ discard: | |||
4322 | tp->max_window = tp->snd_wnd; | 4320 | tp->max_window = tp->snd_wnd; |
4323 | 4321 | ||
4324 | TCP_ECN_rcv_syn(tp, th); | 4322 | TCP_ECN_rcv_syn(tp, th); |
4325 | if (tp->ecn_flags&TCP_ECN_OK) | ||
4326 | sock_set_flag(sk, SOCK_NO_LARGESEND); | ||
4327 | 4323 | ||
4328 | tcp_mtup_init(sk); | 4324 | tcp_mtup_init(sk); |
4329 | tcp_sync_mss(sk, icsk->icsk_pmtu_cookie); | 4325 | tcp_sync_mss(sk, icsk->icsk_pmtu_cookie); |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 25ecc6e2478b..4c6ef47eb1c3 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -1726,7 +1726,8 @@ static void get_tcp4_sock(struct sock *sp, char *tmpbuf, int i) | |||
1726 | sprintf(tmpbuf, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX " | 1726 | sprintf(tmpbuf, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX " |
1727 | "%08X %5d %8d %lu %d %p %u %u %u %u %d", | 1727 | "%08X %5d %8d %lu %d %p %u %u %u %u %d", |
1728 | i, src, srcp, dest, destp, sp->sk_state, | 1728 | i, src, srcp, dest, destp, sp->sk_state, |
1729 | tp->write_seq - tp->snd_una, tp->rcv_nxt - tp->copied_seq, | 1729 | tp->write_seq - tp->snd_una, |
1730 | (sp->sk_state == TCP_LISTEN) ? sp->sk_ack_backlog : (tp->rcv_nxt - tp->copied_seq), | ||
1730 | timer_active, | 1731 | timer_active, |
1731 | jiffies_to_clock_t(timer_expires - jiffies), | 1732 | jiffies_to_clock_t(timer_expires - jiffies), |
1732 | icsk->icsk_retransmits, | 1733 | icsk->icsk_retransmits, |
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index 2b9b7f6c7f7c..54b2ef7d3efe 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c | |||
@@ -440,8 +440,6 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req, | |||
440 | newicsk->icsk_ack.last_seg_size = skb->len - newtp->tcp_header_len; | 440 | newicsk->icsk_ack.last_seg_size = skb->len - newtp->tcp_header_len; |
441 | newtp->rx_opt.mss_clamp = req->mss; | 441 | newtp->rx_opt.mss_clamp = req->mss; |
442 | TCP_ECN_openreq_child(newtp, req); | 442 | TCP_ECN_openreq_child(newtp, req); |
443 | if (newtp->ecn_flags&TCP_ECN_OK) | ||
444 | sock_set_flag(newsk, SOCK_NO_LARGESEND); | ||
445 | 443 | ||
446 | TCP_INC_STATS_BH(TCP_MIB_PASSIVEOPENS); | 444 | TCP_INC_STATS_BH(TCP_MIB_PASSIVEOPENS); |
447 | } | 445 | } |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index bdd71db8bf90..5a7cb4a9c867 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -2044,8 +2044,6 @@ struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst, | |||
2044 | memset(th, 0, sizeof(struct tcphdr)); | 2044 | memset(th, 0, sizeof(struct tcphdr)); |
2045 | th->syn = 1; | 2045 | th->syn = 1; |
2046 | th->ack = 1; | 2046 | th->ack = 1; |
2047 | if (dst->dev->features&NETIF_F_TSO) | ||
2048 | ireq->ecn_ok = 0; | ||
2049 | TCP_ECN_make_synack(req, th); | 2047 | TCP_ECN_make_synack(req, th); |
2050 | th->source = inet_sk(sk)->sport; | 2048 | th->source = inet_sk(sk)->sport; |
2051 | th->dest = ireq->rmt_port; | 2049 | th->dest = ireq->rmt_port; |
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c index b4b7d441af25..968a14be0d05 100644 --- a/net/ipv6/netfilter/ip6_queue.c +++ b/net/ipv6/netfilter/ip6_queue.c | |||
@@ -505,7 +505,7 @@ ipq_rcv_skb(struct sk_buff *skb) | |||
505 | if (type <= IPQM_BASE) | 505 | if (type <= IPQM_BASE) |
506 | return; | 506 | return; |
507 | 507 | ||
508 | if (security_netlink_recv(skb)) | 508 | if (security_netlink_recv(skb, CAP_NET_ADMIN)) |
509 | RCV_SKB_FAIL(-EPERM); | 509 | RCV_SKB_FAIL(-EPERM); |
510 | 510 | ||
511 | write_lock_bh(&queue_lock); | 511 | write_lock_bh(&queue_lock); |
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c index 2e72f89a7019..0b5bd5587a3e 100644 --- a/net/ipv6/netfilter/ip6_tables.c +++ b/net/ipv6/netfilter/ip6_tables.c | |||
@@ -1281,7 +1281,8 @@ int ip6t_register_table(struct xt_table *table, | |||
1281 | return ret; | 1281 | return ret; |
1282 | } | 1282 | } |
1283 | 1283 | ||
1284 | if (xt_register_table(table, &bootstrap, newinfo) != 0) { | 1284 | ret = xt_register_table(table, &bootstrap, newinfo); |
1285 | if (ret != 0) { | ||
1285 | xt_free_table_info(newinfo); | 1286 | xt_free_table_info(newinfo); |
1286 | return ret; | 1287 | return ret; |
1287 | } | 1288 | } |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index a50eb306e9e2..b36d5b2e7c30 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -1469,7 +1469,8 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i) | |||
1469 | dest->s6_addr32[0], dest->s6_addr32[1], | 1469 | dest->s6_addr32[0], dest->s6_addr32[1], |
1470 | dest->s6_addr32[2], dest->s6_addr32[3], destp, | 1470 | dest->s6_addr32[2], dest->s6_addr32[3], destp, |
1471 | sp->sk_state, | 1471 | sp->sk_state, |
1472 | tp->write_seq-tp->snd_una, tp->rcv_nxt-tp->copied_seq, | 1472 | tp->write_seq-tp->snd_una, |
1473 | (sp->sk_state == TCP_LISTEN) ? sp->sk_ack_backlog : (tp->rcv_nxt - tp->copied_seq), | ||
1473 | timer_active, | 1474 | timer_active, |
1474 | jiffies_to_clock_t(timer_expires - jiffies), | 1475 | jiffies_to_clock_t(timer_expires - jiffies), |
1475 | icsk->icsk_retransmits, | 1476 | icsk->icsk_retransmits, |
diff --git a/net/irda/irlan/irlan_client.c b/net/irda/irlan/irlan_client.c index f8e6cb0db04b..95cf1234ea17 100644 --- a/net/irda/irlan/irlan_client.c +++ b/net/irda/irlan/irlan_client.c | |||
@@ -173,13 +173,14 @@ void irlan_client_discovery_indication(discinfo_t *discovery, | |||
173 | rcu_read_lock(); | 173 | rcu_read_lock(); |
174 | self = irlan_get_any(); | 174 | self = irlan_get_any(); |
175 | if (self) { | 175 | if (self) { |
176 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); | 176 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, goto out;); |
177 | 177 | ||
178 | IRDA_DEBUG(1, "%s(), Found instance (%08x)!\n", __FUNCTION__ , | 178 | IRDA_DEBUG(1, "%s(), Found instance (%08x)!\n", __FUNCTION__ , |
179 | daddr); | 179 | daddr); |
180 | 180 | ||
181 | irlan_client_wakeup(self, saddr, daddr); | 181 | irlan_client_wakeup(self, saddr, daddr); |
182 | } | 182 | } |
183 | IRDA_ASSERT_LABEL(out:) | ||
183 | rcu_read_unlock(); | 184 | rcu_read_unlock(); |
184 | } | 185 | } |
185 | 186 | ||
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig index b1622b7de1cf..42a178aa30f9 100644 --- a/net/netfilter/Kconfig +++ b/net/netfilter/Kconfig | |||
@@ -411,7 +411,10 @@ config NETFILTER_XT_MATCH_STATISTIC | |||
411 | tristate '"statistic" match support' | 411 | tristate '"statistic" match support' |
412 | depends on NETFILTER_XTABLES | 412 | depends on NETFILTER_XTABLES |
413 | help | 413 | help |
414 | statistic module | 414 | This option adds a `statistic' match, which allows you to match |
415 | on packets periodically or randomly with a given percentage. | ||
416 | |||
417 | To compile it as a module, choose M here. If unsure, say N. | ||
415 | 418 | ||
416 | config NETFILTER_XT_MATCH_STRING | 419 | config NETFILTER_XT_MATCH_STRING |
417 | tristate '"string" match support' | 420 | tristate '"string" match support' |
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index b8c7c567c9df..af4845971f70 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/errno.h> | 29 | #include <linux/errno.h> |
30 | #include <linux/netlink.h> | 30 | #include <linux/netlink.h> |
31 | #include <linux/spinlock.h> | 31 | #include <linux/spinlock.h> |
32 | #include <linux/interrupt.h> | ||
32 | #include <linux/notifier.h> | 33 | #include <linux/notifier.h> |
33 | 34 | ||
34 | #include <linux/netfilter.h> | 35 | #include <linux/netfilter.h> |
diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c index 0c6da496cfa9..0839b701b930 100644 --- a/net/netfilter/nf_conntrack_proto_sctp.c +++ b/net/netfilter/nf_conntrack_proto_sctp.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include <linux/sctp.h> | 28 | #include <linux/sctp.h> |
29 | #include <linux/string.h> | 29 | #include <linux/string.h> |
30 | #include <linux/seq_file.h> | 30 | #include <linux/seq_file.h> |
31 | #include <linux/spinlock.h> | ||
32 | #include <linux/interrupt.h> | ||
31 | 33 | ||
32 | #include <net/netfilter/nf_conntrack.h> | 34 | #include <net/netfilter/nf_conntrack.h> |
33 | #include <net/netfilter/nf_conntrack_protocol.h> | 35 | #include <net/netfilter/nf_conntrack_protocol.h> |
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c index b88e82a1a987..ec9f0efea6bb 100644 --- a/net/netfilter/nfnetlink.c +++ b/net/netfilter/nfnetlink.c | |||
@@ -229,7 +229,7 @@ static int nfnetlink_rcv_msg(struct sk_buff *skb, | |||
229 | NFNL_SUBSYS_ID(nlh->nlmsg_type), | 229 | NFNL_SUBSYS_ID(nlh->nlmsg_type), |
230 | NFNL_MSG_TYPE(nlh->nlmsg_type)); | 230 | NFNL_MSG_TYPE(nlh->nlmsg_type)); |
231 | 231 | ||
232 | if (!cap_raised(NETLINK_CB(skb).eff_cap, CAP_NET_ADMIN)) { | 232 | if (security_netlink_recv(skb, CAP_NET_ADMIN)) { |
233 | DEBUGP("missing CAP_NET_ADMIN\n"); | 233 | DEBUGP("missing CAP_NET_ADMIN\n"); |
234 | *errp = -EPERM; | 234 | *errp = -EPERM; |
235 | return -1; | 235 | return -1; |
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c index 86a4ac33de34..49ef41e34c48 100644 --- a/net/netfilter/nfnetlink_queue.c +++ b/net/netfilter/nfnetlink_queue.c | |||
@@ -680,11 +680,19 @@ dev_cmp(struct nfqnl_queue_entry *entry, unsigned long ifindex) | |||
680 | if (entinf->indev) | 680 | if (entinf->indev) |
681 | if (entinf->indev->ifindex == ifindex) | 681 | if (entinf->indev->ifindex == ifindex) |
682 | return 1; | 682 | return 1; |
683 | |||
684 | if (entinf->outdev) | 683 | if (entinf->outdev) |
685 | if (entinf->outdev->ifindex == ifindex) | 684 | if (entinf->outdev->ifindex == ifindex) |
686 | return 1; | 685 | return 1; |
687 | 686 | #ifdef CONFIG_BRIDGE_NETFILTER | |
687 | if (entry->skb->nf_bridge) { | ||
688 | if (entry->skb->nf_bridge->physindev && | ||
689 | entry->skb->nf_bridge->physindev->ifindex == ifindex) | ||
690 | return 1; | ||
691 | if (entry->skb->nf_bridge->physoutdev && | ||
692 | entry->skb->nf_bridge->physoutdev->ifindex == ifindex) | ||
693 | return 1; | ||
694 | } | ||
695 | #endif | ||
688 | return 0; | 696 | return 0; |
689 | } | 697 | } |
690 | 698 | ||
diff --git a/net/netfilter/xt_sctp.c b/net/netfilter/xt_sctp.c index 9316c753692f..843383e01d41 100644 --- a/net/netfilter/xt_sctp.c +++ b/net/netfilter/xt_sctp.c | |||
@@ -151,7 +151,7 @@ match(const struct sk_buff *skb, | |||
151 | && SCCHECK(((ntohs(sh->dest) >= info->dpts[0]) | 151 | && SCCHECK(((ntohs(sh->dest) >= info->dpts[0]) |
152 | && (ntohs(sh->dest) <= info->dpts[1])), | 152 | && (ntohs(sh->dest) <= info->dpts[1])), |
153 | XT_SCTP_DEST_PORTS, info->flags, info->invflags) | 153 | XT_SCTP_DEST_PORTS, info->flags, info->invflags) |
154 | && SCCHECK(match_packet(skb, protoff, | 154 | && SCCHECK(match_packet(skb, protoff + sizeof (sctp_sctphdr_t), |
155 | info->chunkmap, info->chunk_match_type, | 155 | info->chunkmap, info->chunk_match_type, |
156 | info->flag_info, info->flag_count, | 156 | info->flag_info, info->flag_count, |
157 | hotdrop), | 157 | hotdrop), |
diff --git a/net/netfilter/xt_tcpudp.c b/net/netfilter/xt_tcpudp.c index 1b61dac9c873..a9a63aa68936 100644 --- a/net/netfilter/xt_tcpudp.c +++ b/net/netfilter/xt_tcpudp.c | |||
@@ -260,7 +260,7 @@ static int __init xt_tcpudp_init(void) | |||
260 | return ret; | 260 | return ret; |
261 | 261 | ||
262 | out_unreg_udp: | 262 | out_unreg_udp: |
263 | xt_unregister_match(&tcp_matchstruct); | 263 | xt_unregister_match(&udp_matchstruct); |
264 | out_unreg_tcp6: | 264 | out_unreg_tcp6: |
265 | xt_unregister_match(&tcp6_matchstruct); | 265 | xt_unregister_match(&tcp6_matchstruct); |
266 | out_unreg_tcp: | 266 | out_unreg_tcp: |
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index f329b72578f5..edf084becd5e 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c | |||
@@ -320,7 +320,7 @@ static int genl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
320 | goto errout; | 320 | goto errout; |
321 | } | 321 | } |
322 | 322 | ||
323 | if ((ops->flags & GENL_ADMIN_PERM) && security_netlink_recv(skb)) { | 323 | if ((ops->flags & GENL_ADMIN_PERM) && security_netlink_recv(skb, CAP_NET_ADMIN)) { |
324 | err = -EPERM; | 324 | err = -EPERM; |
325 | goto errout; | 325 | goto errout; |
326 | } | 326 | } |
diff --git a/net/tipc/core.c b/net/tipc/core.c index 5003acb15919..0539a8362858 100644 --- a/net/tipc/core.c +++ b/net/tipc/core.c | |||
@@ -191,7 +191,8 @@ static int __init tipc_init(void) | |||
191 | int res; | 191 | int res; |
192 | 192 | ||
193 | tipc_log_reinit(CONFIG_TIPC_LOG); | 193 | tipc_log_reinit(CONFIG_TIPC_LOG); |
194 | info("Activated (compiled " __DATE__ " " __TIME__ ")\n"); | 194 | info("Activated (version " TIPC_MOD_VER |
195 | " compiled " __DATE__ " " __TIME__ ")\n"); | ||
195 | 196 | ||
196 | tipc_own_addr = 0; | 197 | tipc_own_addr = 0; |
197 | tipc_remote_management = 1; | 198 | tipc_remote_management = 1; |
diff --git a/net/tipc/link.c b/net/tipc/link.c index d64658053746..c6831c75cfa4 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * net/tipc/link.c: TIPC link code | 2 | * net/tipc/link.c: TIPC link code |
3 | * | 3 | * |
4 | * Copyright (c) 1996-2006, Ericsson AB | 4 | * Copyright (c) 1996-2006, Ericsson AB |
5 | * Copyright (c) 2004-2005, Wind River Systems | 5 | * Copyright (c) 2004-2006, Wind River Systems |
6 | * All rights reserved. | 6 | * All rights reserved. |
7 | * | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
@@ -988,17 +988,18 @@ static int link_bundle_buf(struct link *l_ptr, | |||
988 | struct tipc_msg *bundler_msg = buf_msg(bundler); | 988 | struct tipc_msg *bundler_msg = buf_msg(bundler); |
989 | struct tipc_msg *msg = buf_msg(buf); | 989 | struct tipc_msg *msg = buf_msg(buf); |
990 | u32 size = msg_size(msg); | 990 | u32 size = msg_size(msg); |
991 | u32 to_pos = align(msg_size(bundler_msg)); | 991 | u32 bundle_size = msg_size(bundler_msg); |
992 | u32 rest = link_max_pkt(l_ptr) - to_pos; | 992 | u32 to_pos = align(bundle_size); |
993 | u32 pad = to_pos - bundle_size; | ||
993 | 994 | ||
994 | if (msg_user(bundler_msg) != MSG_BUNDLER) | 995 | if (msg_user(bundler_msg) != MSG_BUNDLER) |
995 | return 0; | 996 | return 0; |
996 | if (msg_type(bundler_msg) != OPEN_MSG) | 997 | if (msg_type(bundler_msg) != OPEN_MSG) |
997 | return 0; | 998 | return 0; |
998 | if (rest < align(size)) | 999 | if (skb_tailroom(bundler) < (pad + size)) |
999 | return 0; | 1000 | return 0; |
1000 | 1001 | ||
1001 | skb_put(bundler, (to_pos - msg_size(bundler_msg)) + size); | 1002 | skb_put(bundler, pad + size); |
1002 | memcpy(bundler->data + to_pos, buf->data, size); | 1003 | memcpy(bundler->data + to_pos, buf->data, size); |
1003 | msg_set_size(bundler_msg, to_pos + size); | 1004 | msg_set_size(bundler_msg, to_pos + size); |
1004 | msg_set_msgcnt(bundler_msg, msg_msgcnt(bundler_msg) + 1); | 1005 | msg_set_msgcnt(bundler_msg, msg_msgcnt(bundler_msg) + 1); |
diff --git a/net/tipc/node.c b/net/tipc/node.c index 861322b935da..fc6d09630ccd 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * net/tipc/node.c: TIPC node management routines | 2 | * net/tipc/node.c: TIPC node management routines |
3 | * | 3 | * |
4 | * Copyright (c) 2000-2006, Ericsson AB | 4 | * Copyright (c) 2000-2006, Ericsson AB |
5 | * Copyright (c) 2005, Wind River Systems | 5 | * Copyright (c) 2005-2006, Wind River Systems |
6 | * All rights reserved. | 6 | * All rights reserved. |
7 | * | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
@@ -592,6 +592,7 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space) | |||
592 | struct sk_buff *buf; | 592 | struct sk_buff *buf; |
593 | struct node *n_ptr; | 593 | struct node *n_ptr; |
594 | struct tipc_node_info node_info; | 594 | struct tipc_node_info node_info; |
595 | u32 payload_size; | ||
595 | 596 | ||
596 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) | 597 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) |
597 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 598 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
@@ -608,8 +609,11 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space) | |||
608 | /* For now, get space for all other nodes | 609 | /* For now, get space for all other nodes |
609 | (will need to modify this when slave nodes are supported */ | 610 | (will need to modify this when slave nodes are supported */ |
610 | 611 | ||
611 | buf = tipc_cfg_reply_alloc(TLV_SPACE(sizeof(node_info)) * | 612 | payload_size = TLV_SPACE(sizeof(node_info)) * (tipc_max_nodes - 1); |
612 | (tipc_max_nodes - 1)); | 613 | if (payload_size > 32768u) |
614 | return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED | ||
615 | " (too many nodes)"); | ||
616 | buf = tipc_cfg_reply_alloc(payload_size); | ||
613 | if (!buf) | 617 | if (!buf) |
614 | return NULL; | 618 | return NULL; |
615 | 619 | ||
@@ -633,6 +637,7 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space) | |||
633 | struct sk_buff *buf; | 637 | struct sk_buff *buf; |
634 | struct node *n_ptr; | 638 | struct node *n_ptr; |
635 | struct tipc_link_info link_info; | 639 | struct tipc_link_info link_info; |
640 | u32 payload_size; | ||
636 | 641 | ||
637 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) | 642 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) |
638 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 643 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
@@ -645,12 +650,15 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space) | |||
645 | 650 | ||
646 | if (!tipc_nodes) | 651 | if (!tipc_nodes) |
647 | return tipc_cfg_reply_none(); | 652 | return tipc_cfg_reply_none(); |
648 | 653 | ||
649 | /* For now, get space for 2 links to all other nodes + bcast link | 654 | /* Get space for all unicast links + multicast link */ |
650 | (will need to modify this when slave nodes are supported */ | 655 | |
651 | 656 | payload_size = TLV_SPACE(sizeof(link_info)) * | |
652 | buf = tipc_cfg_reply_alloc(TLV_SPACE(sizeof(link_info)) * | 657 | (tipc_net.zones[tipc_zone(tipc_own_addr)]->links + 1); |
653 | (2 * (tipc_max_nodes - 1) + 1)); | 658 | if (payload_size > 32768u) |
659 | return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED | ||
660 | " (too many links)"); | ||
661 | buf = tipc_cfg_reply_alloc(payload_size); | ||
654 | if (!buf) | 662 | if (!buf) |
655 | return NULL; | 663 | return NULL; |
656 | 664 | ||
diff --git a/net/tipc/zone.h b/net/tipc/zone.h index 267999c5a240..5ab3d08602e2 100644 --- a/net/tipc/zone.h +++ b/net/tipc/zone.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * net/tipc/zone.h: Include file for TIPC zone management routines | 2 | * net/tipc/zone.h: Include file for TIPC zone management routines |
3 | * | 3 | * |
4 | * Copyright (c) 2000-2006, Ericsson AB | 4 | * Copyright (c) 2000-2006, Ericsson AB |
5 | * Copyright (c) 2005, Wind River Systems | 5 | * Copyright (c) 2005-2006, Wind River Systems |
6 | * All rights reserved. | 6 | * All rights reserved. |
7 | * | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
@@ -45,7 +45,7 @@ | |||
45 | * struct _zone - TIPC zone structure | 45 | * struct _zone - TIPC zone structure |
46 | * @addr: network address of zone | 46 | * @addr: network address of zone |
47 | * @clusters: array of pointers to all clusters within zone | 47 | * @clusters: array of pointers to all clusters within zone |
48 | * @links: (used for inter-zone communication) | 48 | * @links: number of (unicast) links to zone |
49 | */ | 49 | */ |
50 | 50 | ||
51 | struct _zone { | 51 | struct _zone { |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index d901465ce013..fd11d4048b52 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -128,6 +128,30 @@ static atomic_t unix_nr_socks = ATOMIC_INIT(0); | |||
128 | 128 | ||
129 | #define UNIX_ABSTRACT(sk) (unix_sk(sk)->addr->hash != UNIX_HASH_SIZE) | 129 | #define UNIX_ABSTRACT(sk) (unix_sk(sk)->addr->hash != UNIX_HASH_SIZE) |
130 | 130 | ||
131 | #ifdef CONFIG_SECURITY_NETWORK | ||
132 | static void unix_get_peersec_dgram(struct sk_buff *skb) | ||
133 | { | ||
134 | int err; | ||
135 | |||
136 | err = security_socket_getpeersec_dgram(skb, UNIXSECDATA(skb), | ||
137 | UNIXSECLEN(skb)); | ||
138 | if (err) | ||
139 | *(UNIXSECDATA(skb)) = NULL; | ||
140 | } | ||
141 | |||
142 | static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb) | ||
143 | { | ||
144 | scm->secdata = *UNIXSECDATA(skb); | ||
145 | scm->seclen = *UNIXSECLEN(skb); | ||
146 | } | ||
147 | #else | ||
148 | static void unix_get_peersec_dgram(struct sk_buff *skb) | ||
149 | { } | ||
150 | |||
151 | static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb) | ||
152 | { } | ||
153 | #endif /* CONFIG_SECURITY_NETWORK */ | ||
154 | |||
131 | /* | 155 | /* |
132 | * SMP locking strategy: | 156 | * SMP locking strategy: |
133 | * hash table is protected with spinlock unix_table_lock | 157 | * hash table is protected with spinlock unix_table_lock |
@@ -1291,6 +1315,8 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
1291 | if (siocb->scm->fp) | 1315 | if (siocb->scm->fp) |
1292 | unix_attach_fds(siocb->scm, skb); | 1316 | unix_attach_fds(siocb->scm, skb); |
1293 | 1317 | ||
1318 | unix_get_peersec_dgram(skb); | ||
1319 | |||
1294 | skb->h.raw = skb->data; | 1320 | skb->h.raw = skb->data; |
1295 | err = memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len); | 1321 | err = memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len); |
1296 | if (err) | 1322 | if (err) |
@@ -1570,6 +1596,7 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1570 | memset(&tmp_scm, 0, sizeof(tmp_scm)); | 1596 | memset(&tmp_scm, 0, sizeof(tmp_scm)); |
1571 | } | 1597 | } |
1572 | siocb->scm->creds = *UNIXCREDS(skb); | 1598 | siocb->scm->creds = *UNIXCREDS(skb); |
1599 | unix_set_secdata(siocb->scm, skb); | ||
1573 | 1600 | ||
1574 | if (!(flags & MSG_PEEK)) | 1601 | if (!(flags & MSG_PEEK)) |
1575 | { | 1602 | { |
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 17b29ec3c417..43f00fc28a3d 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -1164,8 +1164,6 @@ int xfrm_state_mtu(struct xfrm_state *x, int mtu) | |||
1164 | return res; | 1164 | return res; |
1165 | } | 1165 | } |
1166 | 1166 | ||
1167 | EXPORT_SYMBOL(xfrm_state_mtu); | ||
1168 | |||
1169 | int xfrm_init_state(struct xfrm_state *x) | 1167 | int xfrm_init_state(struct xfrm_state *x) |
1170 | { | 1168 | { |
1171 | struct xfrm_state_afinfo *afinfo; | 1169 | struct xfrm_state_afinfo *afinfo; |
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index c21dc26141ea..3e6a722d072e 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -1435,7 +1435,7 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, int *err | |||
1435 | link = &xfrm_dispatch[type]; | 1435 | link = &xfrm_dispatch[type]; |
1436 | 1436 | ||
1437 | /* All operations require privileges, even GET */ | 1437 | /* All operations require privileges, even GET */ |
1438 | if (security_netlink_recv(skb)) { | 1438 | if (security_netlink_recv(skb, CAP_NET_ADMIN)) { |
1439 | *errp = -EPERM; | 1439 | *errp = -EPERM; |
1440 | return -1; | 1440 | return -1; |
1441 | } | 1441 | } |