diff options
Diffstat (limited to 'net')
50 files changed, 435 insertions, 219 deletions
diff --git a/net/atm/addr.c b/net/atm/addr.c index 6afa77d63bb5..82e85abc303d 100644 --- a/net/atm/addr.c +++ b/net/atm/addr.c | |||
@@ -9,7 +9,7 @@ | |||
9 | #include "signaling.h" | 9 | #include "signaling.h" |
10 | #include "addr.h" | 10 | #include "addr.h" |
11 | 11 | ||
12 | static int check_addr(struct sockaddr_atmsvc *addr) | 12 | static int check_addr(const struct sockaddr_atmsvc *addr) |
13 | { | 13 | { |
14 | int i; | 14 | int i; |
15 | 15 | ||
@@ -23,7 +23,7 @@ static int check_addr(struct sockaddr_atmsvc *addr) | |||
23 | return -EINVAL; | 23 | return -EINVAL; |
24 | } | 24 | } |
25 | 25 | ||
26 | static int identical(struct sockaddr_atmsvc *a, struct sockaddr_atmsvc *b) | 26 | static int identical(const struct sockaddr_atmsvc *a, const struct sockaddr_atmsvc *b) |
27 | { | 27 | { |
28 | if (*a->sas_addr.prv) | 28 | if (*a->sas_addr.prv) |
29 | if (memcmp(a->sas_addr.prv, b->sas_addr.prv, ATM_ESA_LEN)) | 29 | if (memcmp(a->sas_addr.prv, b->sas_addr.prv, ATM_ESA_LEN)) |
@@ -35,7 +35,7 @@ static int identical(struct sockaddr_atmsvc *a, struct sockaddr_atmsvc *b) | |||
35 | return !strcmp(a->sas_addr.pub, b->sas_addr.pub); | 35 | return !strcmp(a->sas_addr.pub, b->sas_addr.pub); |
36 | } | 36 | } |
37 | 37 | ||
38 | static void notify_sigd(struct atm_dev *dev) | 38 | static void notify_sigd(const struct atm_dev *dev) |
39 | { | 39 | { |
40 | struct sockaddr_atmpvc pvc; | 40 | struct sockaddr_atmpvc pvc; |
41 | 41 | ||
@@ -63,7 +63,7 @@ void atm_reset_addr(struct atm_dev *dev, enum atm_addr_type_t atype) | |||
63 | notify_sigd(dev); | 63 | notify_sigd(dev); |
64 | } | 64 | } |
65 | 65 | ||
66 | int atm_add_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr, | 66 | int atm_add_addr(struct atm_dev *dev, const struct sockaddr_atmsvc *addr, |
67 | enum atm_addr_type_t atype) | 67 | enum atm_addr_type_t atype) |
68 | { | 68 | { |
69 | unsigned long flags; | 69 | unsigned long flags; |
@@ -98,7 +98,7 @@ int atm_add_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr, | |||
98 | return 0; | 98 | return 0; |
99 | } | 99 | } |
100 | 100 | ||
101 | int atm_del_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr, | 101 | int atm_del_addr(struct atm_dev *dev, const struct sockaddr_atmsvc *addr, |
102 | enum atm_addr_type_t atype) | 102 | enum atm_addr_type_t atype) |
103 | { | 103 | { |
104 | unsigned long flags; | 104 | unsigned long flags; |
diff --git a/net/atm/addr.h b/net/atm/addr.h index f39433ad45da..6837e9e7eb13 100644 --- a/net/atm/addr.h +++ b/net/atm/addr.h | |||
@@ -10,9 +10,9 @@ | |||
10 | #include <linux/atmdev.h> | 10 | #include <linux/atmdev.h> |
11 | 11 | ||
12 | void atm_reset_addr(struct atm_dev *dev, enum atm_addr_type_t type); | 12 | void atm_reset_addr(struct atm_dev *dev, enum atm_addr_type_t type); |
13 | int atm_add_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr, | 13 | int atm_add_addr(struct atm_dev *dev, const struct sockaddr_atmsvc *addr, |
14 | enum atm_addr_type_t type); | 14 | enum atm_addr_type_t type); |
15 | int atm_del_addr(struct atm_dev *dev, struct sockaddr_atmsvc *addr, | 15 | int atm_del_addr(struct atm_dev *dev, const struct sockaddr_atmsvc *addr, |
16 | enum atm_addr_type_t type); | 16 | enum atm_addr_type_t type); |
17 | int atm_get_addr(struct atm_dev *dev, struct sockaddr_atmsvc __user *buf, | 17 | int atm_get_addr(struct atm_dev *dev, struct sockaddr_atmsvc __user *buf, |
18 | size_t size, enum atm_addr_type_t type); | 18 | size_t size, enum atm_addr_type_t type); |
diff --git a/net/atm/br2684.c b/net/atm/br2684.c index 05fafdc2eea3..8d9a6f158880 100644 --- a/net/atm/br2684.c +++ b/net/atm/br2684.c | |||
@@ -52,12 +52,12 @@ static void skb_debug(const struct sk_buff *skb) | |||
52 | #define ETHERTYPE_IPV6 0x86, 0xdd | 52 | #define ETHERTYPE_IPV6 0x86, 0xdd |
53 | #define PAD_BRIDGED 0x00, 0x00 | 53 | #define PAD_BRIDGED 0x00, 0x00 |
54 | 54 | ||
55 | static unsigned char ethertype_ipv4[] = { ETHERTYPE_IPV4 }; | 55 | static const unsigned char ethertype_ipv4[] = { ETHERTYPE_IPV4 }; |
56 | static unsigned char ethertype_ipv6[] = { ETHERTYPE_IPV6 }; | 56 | static const unsigned char ethertype_ipv6[] = { ETHERTYPE_IPV6 }; |
57 | static unsigned char llc_oui_pid_pad[] = | 57 | static const unsigned char llc_oui_pid_pad[] = |
58 | { LLC, SNAP_BRIDGED, PID_ETHERNET, PAD_BRIDGED }; | 58 | { LLC, SNAP_BRIDGED, PID_ETHERNET, PAD_BRIDGED }; |
59 | static unsigned char llc_oui_ipv4[] = { LLC, SNAP_ROUTED, ETHERTYPE_IPV4 }; | 59 | static const unsigned char llc_oui_ipv4[] = { LLC, SNAP_ROUTED, ETHERTYPE_IPV4 }; |
60 | static unsigned char llc_oui_ipv6[] = { LLC, SNAP_ROUTED, ETHERTYPE_IPV6 }; | 60 | static const unsigned char llc_oui_ipv6[] = { LLC, SNAP_ROUTED, ETHERTYPE_IPV6 }; |
61 | 61 | ||
62 | enum br2684_encaps { | 62 | enum br2684_encaps { |
63 | e_vc = BR2684_ENCAPS_VC, | 63 | e_vc = BR2684_ENCAPS_VC, |
@@ -217,8 +217,8 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct br2684_dev *brdev, | |||
217 | return 1; | 217 | return 1; |
218 | } | 218 | } |
219 | 219 | ||
220 | static inline struct br2684_vcc *pick_outgoing_vcc(struct sk_buff *skb, | 220 | static inline struct br2684_vcc *pick_outgoing_vcc(const struct sk_buff *skb, |
221 | struct br2684_dev *brdev) | 221 | const struct br2684_dev *brdev) |
222 | { | 222 | { |
223 | return list_empty(&brdev->brvccs) ? NULL : list_entry_brvcc(brdev->brvccs.next); /* 1 vcc/dev right now */ | 223 | return list_empty(&brdev->brvccs) ? NULL : list_entry_brvcc(brdev->brvccs.next); /* 1 vcc/dev right now */ |
224 | } | 224 | } |
diff --git a/net/atm/common.c b/net/atm/common.c index c865517ba449..d34edbe754c8 100644 --- a/net/atm/common.c +++ b/net/atm/common.c | |||
@@ -262,7 +262,7 @@ static int adjust_tp(struct atm_trafprm *tp,unsigned char aal) | |||
262 | } | 262 | } |
263 | 263 | ||
264 | 264 | ||
265 | static int check_ci(struct atm_vcc *vcc, short vpi, int vci) | 265 | static int check_ci(const struct atm_vcc *vcc, short vpi, int vci) |
266 | { | 266 | { |
267 | struct hlist_head *head = &vcc_hash[vci & | 267 | struct hlist_head *head = &vcc_hash[vci & |
268 | (VCC_HTABLE_SIZE - 1)]; | 268 | (VCC_HTABLE_SIZE - 1)]; |
@@ -290,7 +290,7 @@ static int check_ci(struct atm_vcc *vcc, short vpi, int vci) | |||
290 | } | 290 | } |
291 | 291 | ||
292 | 292 | ||
293 | static int find_ci(struct atm_vcc *vcc, short *vpi, int *vci) | 293 | static int find_ci(const struct atm_vcc *vcc, short *vpi, int *vci) |
294 | { | 294 | { |
295 | static short p; /* poor man's per-device cache */ | 295 | static short p; /* poor man's per-device cache */ |
296 | static int c; | 296 | static int c; |
@@ -646,7 +646,7 @@ static int atm_change_qos(struct atm_vcc *vcc,struct atm_qos *qos) | |||
646 | } | 646 | } |
647 | 647 | ||
648 | 648 | ||
649 | static int check_tp(struct atm_trafprm *tp) | 649 | static int check_tp(const struct atm_trafprm *tp) |
650 | { | 650 | { |
651 | /* @@@ Should be merged with adjust_tp */ | 651 | /* @@@ Should be merged with adjust_tp */ |
652 | if (!tp->traffic_class || tp->traffic_class == ATM_ANYCLASS) return 0; | 652 | if (!tp->traffic_class || tp->traffic_class == ATM_ANYCLASS) return 0; |
@@ -663,7 +663,7 @@ static int check_tp(struct atm_trafprm *tp) | |||
663 | } | 663 | } |
664 | 664 | ||
665 | 665 | ||
666 | static int check_qos(struct atm_qos *qos) | 666 | static int check_qos(const struct atm_qos *qos) |
667 | { | 667 | { |
668 | int error; | 668 | int error; |
669 | 669 | ||
diff --git a/net/atm/lec.c b/net/atm/lec.c index 653aca3573ac..5799fb52365a 100644 --- a/net/atm/lec.c +++ b/net/atm/lec.c | |||
@@ -65,36 +65,36 @@ static int lec_close(struct net_device *dev); | |||
65 | static struct net_device_stats *lec_get_stats(struct net_device *dev); | 65 | static struct net_device_stats *lec_get_stats(struct net_device *dev); |
66 | static void lec_init(struct net_device *dev); | 66 | static void lec_init(struct net_device *dev); |
67 | static struct lec_arp_table *lec_arp_find(struct lec_priv *priv, | 67 | static struct lec_arp_table *lec_arp_find(struct lec_priv *priv, |
68 | unsigned char *mac_addr); | 68 | const unsigned char *mac_addr); |
69 | static int lec_arp_remove(struct lec_priv *priv, | 69 | static int lec_arp_remove(struct lec_priv *priv, |
70 | struct lec_arp_table *to_remove); | 70 | struct lec_arp_table *to_remove); |
71 | /* LANE2 functions */ | 71 | /* LANE2 functions */ |
72 | static void lane2_associate_ind(struct net_device *dev, u8 *mac_address, | 72 | static void lane2_associate_ind(struct net_device *dev, const u8 *mac_address, |
73 | u8 *tlvs, u32 sizeoftlvs); | 73 | const u8 *tlvs, u32 sizeoftlvs); |
74 | static int lane2_resolve(struct net_device *dev, u8 *dst_mac, int force, | 74 | static int lane2_resolve(struct net_device *dev, const u8 *dst_mac, int force, |
75 | u8 **tlvs, u32 *sizeoftlvs); | 75 | u8 **tlvs, u32 *sizeoftlvs); |
76 | static int lane2_associate_req(struct net_device *dev, u8 *lan_dst, | 76 | static int lane2_associate_req(struct net_device *dev, const u8 *lan_dst, |
77 | u8 *tlvs, u32 sizeoftlvs); | 77 | const u8 *tlvs, u32 sizeoftlvs); |
78 | 78 | ||
79 | static int lec_addr_delete(struct lec_priv *priv, unsigned char *atm_addr, | 79 | static int lec_addr_delete(struct lec_priv *priv, const unsigned char *atm_addr, |
80 | unsigned long permanent); | 80 | unsigned long permanent); |
81 | static void lec_arp_check_empties(struct lec_priv *priv, | 81 | static void lec_arp_check_empties(struct lec_priv *priv, |
82 | struct atm_vcc *vcc, struct sk_buff *skb); | 82 | struct atm_vcc *vcc, struct sk_buff *skb); |
83 | static void lec_arp_destroy(struct lec_priv *priv); | 83 | static void lec_arp_destroy(struct lec_priv *priv); |
84 | static void lec_arp_init(struct lec_priv *priv); | 84 | static void lec_arp_init(struct lec_priv *priv); |
85 | static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv, | 85 | static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv, |
86 | unsigned char *mac_to_find, | 86 | const unsigned char *mac_to_find, |
87 | int is_rdesc, | 87 | int is_rdesc, |
88 | struct lec_arp_table **ret_entry); | 88 | struct lec_arp_table **ret_entry); |
89 | static void lec_arp_update(struct lec_priv *priv, unsigned char *mac_addr, | 89 | static void lec_arp_update(struct lec_priv *priv, const unsigned char *mac_addr, |
90 | unsigned char *atm_addr, unsigned long remoteflag, | 90 | const unsigned char *atm_addr, unsigned long remoteflag, |
91 | unsigned int targetless_le_arp); | 91 | unsigned int targetless_le_arp); |
92 | static void lec_flush_complete(struct lec_priv *priv, unsigned long tran_id); | 92 | static void lec_flush_complete(struct lec_priv *priv, unsigned long tran_id); |
93 | static int lec_mcast_make(struct lec_priv *priv, struct atm_vcc *vcc); | 93 | static int lec_mcast_make(struct lec_priv *priv, struct atm_vcc *vcc); |
94 | static void lec_set_flush_tran_id(struct lec_priv *priv, | 94 | static void lec_set_flush_tran_id(struct lec_priv *priv, |
95 | unsigned char *atm_addr, | 95 | const unsigned char *atm_addr, |
96 | unsigned long tran_id); | 96 | unsigned long tran_id); |
97 | static void lec_vcc_added(struct lec_priv *priv, struct atmlec_ioc *ioc_data, | 97 | static void lec_vcc_added(struct lec_priv *priv, const struct atmlec_ioc *ioc_data, |
98 | struct atm_vcc *vcc, | 98 | struct atm_vcc *vcc, |
99 | void (*old_push) (struct atm_vcc *vcc, | 99 | void (*old_push) (struct atm_vcc *vcc, |
100 | struct sk_buff *skb)); | 100 | struct sk_buff *skb)); |
@@ -634,7 +634,7 @@ static struct atm_dev lecatm_dev = { | |||
634 | */ | 634 | */ |
635 | static int | 635 | static int |
636 | send_to_lecd(struct lec_priv *priv, atmlec_msg_type type, | 636 | send_to_lecd(struct lec_priv *priv, atmlec_msg_type type, |
637 | unsigned char *mac_addr, unsigned char *atm_addr, | 637 | const unsigned char *mac_addr, const unsigned char *atm_addr, |
638 | struct sk_buff *data) | 638 | struct sk_buff *data) |
639 | { | 639 | { |
640 | struct sock *sk; | 640 | struct sock *sk; |
@@ -705,10 +705,9 @@ static void lec_init(struct net_device *dev) | |||
705 | dev->set_multicast_list = lec_set_multicast_list; | 705 | dev->set_multicast_list = lec_set_multicast_list; |
706 | dev->do_ioctl = NULL; | 706 | dev->do_ioctl = NULL; |
707 | printk("%s: Initialized!\n", dev->name); | 707 | printk("%s: Initialized!\n", dev->name); |
708 | return; | ||
709 | } | 708 | } |
710 | 709 | ||
711 | static unsigned char lec_ctrl_magic[] = { | 710 | static const unsigned char lec_ctrl_magic[] = { |
712 | 0xff, | 711 | 0xff, |
713 | 0x00, | 712 | 0x00, |
714 | 0x01, | 713 | 0x01, |
@@ -1276,7 +1275,7 @@ module_exit(lane_module_cleanup); | |||
1276 | * lec will be used. | 1275 | * lec will be used. |
1277 | * If dst_mac == NULL, targetless LE_ARP will be sent | 1276 | * If dst_mac == NULL, targetless LE_ARP will be sent |
1278 | */ | 1277 | */ |
1279 | static int lane2_resolve(struct net_device *dev, u8 *dst_mac, int force, | 1278 | static int lane2_resolve(struct net_device *dev, const u8 *dst_mac, int force, |
1280 | u8 **tlvs, u32 *sizeoftlvs) | 1279 | u8 **tlvs, u32 *sizeoftlvs) |
1281 | { | 1280 | { |
1282 | unsigned long flags; | 1281 | unsigned long flags; |
@@ -1322,8 +1321,8 @@ static int lane2_resolve(struct net_device *dev, u8 *dst_mac, int force, | |||
1322 | * Returns 1 for success, 0 for failure (out of memory) | 1321 | * Returns 1 for success, 0 for failure (out of memory) |
1323 | * | 1322 | * |
1324 | */ | 1323 | */ |
1325 | static int lane2_associate_req(struct net_device *dev, u8 *lan_dst, | 1324 | static int lane2_associate_req(struct net_device *dev, const u8 *lan_dst, |
1326 | u8 *tlvs, u32 sizeoftlvs) | 1325 | const u8 *tlvs, u32 sizeoftlvs) |
1327 | { | 1326 | { |
1328 | int retval; | 1327 | int retval; |
1329 | struct sk_buff *skb; | 1328 | struct sk_buff *skb; |
@@ -1358,8 +1357,8 @@ static int lane2_associate_req(struct net_device *dev, u8 *lan_dst, | |||
1358 | * LANE2: 3.1.5, LE_ASSOCIATE.indication | 1357 | * LANE2: 3.1.5, LE_ASSOCIATE.indication |
1359 | * | 1358 | * |
1360 | */ | 1359 | */ |
1361 | static void lane2_associate_ind(struct net_device *dev, u8 *mac_addr, | 1360 | static void lane2_associate_ind(struct net_device *dev, const u8 *mac_addr, |
1362 | u8 *tlvs, u32 sizeoftlvs) | 1361 | const u8 *tlvs, u32 sizeoftlvs) |
1363 | { | 1362 | { |
1364 | #if 0 | 1363 | #if 0 |
1365 | int i = 0; | 1364 | int i = 0; |
@@ -1744,7 +1743,7 @@ static void lec_arp_destroy(struct lec_priv *priv) | |||
1744 | * Find entry by mac_address | 1743 | * Find entry by mac_address |
1745 | */ | 1744 | */ |
1746 | static struct lec_arp_table *lec_arp_find(struct lec_priv *priv, | 1745 | static struct lec_arp_table *lec_arp_find(struct lec_priv *priv, |
1747 | unsigned char *mac_addr) | 1746 | const unsigned char *mac_addr) |
1748 | { | 1747 | { |
1749 | struct hlist_node *node; | 1748 | struct hlist_node *node; |
1750 | struct hlist_head *head; | 1749 | struct hlist_head *head; |
@@ -1764,7 +1763,7 @@ static struct lec_arp_table *lec_arp_find(struct lec_priv *priv, | |||
1764 | } | 1763 | } |
1765 | 1764 | ||
1766 | static struct lec_arp_table *make_entry(struct lec_priv *priv, | 1765 | static struct lec_arp_table *make_entry(struct lec_priv *priv, |
1767 | unsigned char *mac_addr) | 1766 | const unsigned char *mac_addr) |
1768 | { | 1767 | { |
1769 | struct lec_arp_table *to_return; | 1768 | struct lec_arp_table *to_return; |
1770 | 1769 | ||
@@ -1921,7 +1920,7 @@ restart: | |||
1921 | * | 1920 | * |
1922 | */ | 1921 | */ |
1923 | static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv, | 1922 | static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv, |
1924 | unsigned char *mac_to_find, int is_rdesc, | 1923 | const unsigned char *mac_to_find, int is_rdesc, |
1925 | struct lec_arp_table **ret_entry) | 1924 | struct lec_arp_table **ret_entry) |
1926 | { | 1925 | { |
1927 | unsigned long flags; | 1926 | unsigned long flags; |
@@ -2017,7 +2016,7 @@ out: | |||
2017 | } | 2016 | } |
2018 | 2017 | ||
2019 | static int | 2018 | static int |
2020 | lec_addr_delete(struct lec_priv *priv, unsigned char *atm_addr, | 2019 | lec_addr_delete(struct lec_priv *priv, const unsigned char *atm_addr, |
2021 | unsigned long permanent) | 2020 | unsigned long permanent) |
2022 | { | 2021 | { |
2023 | unsigned long flags; | 2022 | unsigned long flags; |
@@ -2047,8 +2046,8 @@ lec_addr_delete(struct lec_priv *priv, unsigned char *atm_addr, | |||
2047 | * Notifies: Response to arp_request (atm_addr != NULL) | 2046 | * Notifies: Response to arp_request (atm_addr != NULL) |
2048 | */ | 2047 | */ |
2049 | static void | 2048 | static void |
2050 | lec_arp_update(struct lec_priv *priv, unsigned char *mac_addr, | 2049 | lec_arp_update(struct lec_priv *priv, const unsigned char *mac_addr, |
2051 | unsigned char *atm_addr, unsigned long remoteflag, | 2050 | const unsigned char *atm_addr, unsigned long remoteflag, |
2052 | unsigned int targetless_le_arp) | 2051 | unsigned int targetless_le_arp) |
2053 | { | 2052 | { |
2054 | unsigned long flags; | 2053 | unsigned long flags; |
@@ -2148,7 +2147,7 @@ out: | |||
2148 | * Notifies: Vcc setup ready | 2147 | * Notifies: Vcc setup ready |
2149 | */ | 2148 | */ |
2150 | static void | 2149 | static void |
2151 | lec_vcc_added(struct lec_priv *priv, struct atmlec_ioc *ioc_data, | 2150 | lec_vcc_added(struct lec_priv *priv, const struct atmlec_ioc *ioc_data, |
2152 | struct atm_vcc *vcc, | 2151 | struct atm_vcc *vcc, |
2153 | void (*old_push) (struct atm_vcc *vcc, struct sk_buff *skb)) | 2152 | void (*old_push) (struct atm_vcc *vcc, struct sk_buff *skb)) |
2154 | { | 2153 | { |
@@ -2336,7 +2335,7 @@ restart: | |||
2336 | 2335 | ||
2337 | static void | 2336 | static void |
2338 | lec_set_flush_tran_id(struct lec_priv *priv, | 2337 | lec_set_flush_tran_id(struct lec_priv *priv, |
2339 | unsigned char *atm_addr, unsigned long tran_id) | 2338 | const unsigned char *atm_addr, unsigned long tran_id) |
2340 | { | 2339 | { |
2341 | unsigned long flags; | 2340 | unsigned long flags; |
2342 | struct hlist_node *node; | 2341 | struct hlist_node *node; |
diff --git a/net/atm/lec.h b/net/atm/lec.h index b41cda7ea1e1..0d376682c1a3 100644 --- a/net/atm/lec.h +++ b/net/atm/lec.h | |||
@@ -42,12 +42,12 @@ struct lecdatahdr_8025 { | |||
42 | * | 42 | * |
43 | */ | 43 | */ |
44 | struct lane2_ops { | 44 | struct lane2_ops { |
45 | int (*resolve) (struct net_device *dev, u8 *dst_mac, int force, | 45 | int (*resolve) (struct net_device *dev, const u8 *dst_mac, int force, |
46 | u8 **tlvs, u32 *sizeoftlvs); | 46 | u8 **tlvs, u32 *sizeoftlvs); |
47 | int (*associate_req) (struct net_device *dev, u8 *lan_dst, | 47 | int (*associate_req) (struct net_device *dev, const u8 *lan_dst, |
48 | u8 *tlvs, u32 sizeoftlvs); | 48 | const u8 *tlvs, u32 sizeoftlvs); |
49 | void (*associate_indicator) (struct net_device *dev, u8 *mac_addr, | 49 | void (*associate_indicator) (struct net_device *dev, const u8 *mac_addr, |
50 | u8 *tlvs, u32 sizeoftlvs); | 50 | const u8 *tlvs, u32 sizeoftlvs); |
51 | }; | 51 | }; |
52 | 52 | ||
53 | /* | 53 | /* |
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index 2712544cf0ca..97eaa23ad9ea 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c | |||
@@ -893,13 +893,11 @@ struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev) | |||
893 | 893 | ||
894 | sk->sk_destruct = ax25_free_sock; | 894 | sk->sk_destruct = ax25_free_sock; |
895 | sk->sk_type = osk->sk_type; | 895 | sk->sk_type = osk->sk_type; |
896 | sk->sk_socket = osk->sk_socket; | ||
897 | sk->sk_priority = osk->sk_priority; | 896 | sk->sk_priority = osk->sk_priority; |
898 | sk->sk_protocol = osk->sk_protocol; | 897 | sk->sk_protocol = osk->sk_protocol; |
899 | sk->sk_rcvbuf = osk->sk_rcvbuf; | 898 | sk->sk_rcvbuf = osk->sk_rcvbuf; |
900 | sk->sk_sndbuf = osk->sk_sndbuf; | 899 | sk->sk_sndbuf = osk->sk_sndbuf; |
901 | sk->sk_state = TCP_ESTABLISHED; | 900 | sk->sk_state = TCP_ESTABLISHED; |
902 | sk->sk_sleep = osk->sk_sleep; | ||
903 | sock_copy_flags(sk, osk); | 901 | sock_copy_flags(sk, osk); |
904 | 902 | ||
905 | oax25 = ax25_sk(osk); | 903 | oax25 = ax25_sk(osk); |
@@ -1361,13 +1359,11 @@ static int ax25_accept(struct socket *sock, struct socket *newsock, int flags) | |||
1361 | goto out; | 1359 | goto out; |
1362 | 1360 | ||
1363 | newsk = skb->sk; | 1361 | newsk = skb->sk; |
1364 | newsk->sk_socket = newsock; | 1362 | sock_graft(newsk, newsock); |
1365 | newsk->sk_sleep = &newsock->wait; | ||
1366 | 1363 | ||
1367 | /* Now attach up the new socket */ | 1364 | /* Now attach up the new socket */ |
1368 | kfree_skb(skb); | 1365 | kfree_skb(skb); |
1369 | sk->sk_ack_backlog--; | 1366 | sk->sk_ack_backlog--; |
1370 | newsock->sk = newsk; | ||
1371 | newsock->state = SS_CONNECTED; | 1367 | newsock->state = SS_CONNECTED; |
1372 | 1368 | ||
1373 | out: | 1369 | out: |
diff --git a/net/ax25/ax25_std_timer.c b/net/ax25/ax25_std_timer.c index 96e4b9273250..cdc7e751ef36 100644 --- a/net/ax25/ax25_std_timer.c +++ b/net/ax25/ax25_std_timer.c | |||
@@ -39,11 +39,9 @@ void ax25_std_heartbeat_expiry(ax25_cb *ax25) | |||
39 | 39 | ||
40 | switch (ax25->state) { | 40 | switch (ax25->state) { |
41 | case AX25_STATE_0: | 41 | case AX25_STATE_0: |
42 | /* Magic here: If we listen() and a new link dies before it | 42 | if (!sk || |
43 | is accepted() it isn't 'dead' so doesn't get removed. */ | 43 | sock_flag(sk, SOCK_DESTROY) || |
44 | if (!sk || sock_flag(sk, SOCK_DESTROY) || | 44 | sock_flag(sk, SOCK_DEAD)) { |
45 | (sk->sk_state == TCP_LISTEN && | ||
46 | sock_flag(sk, SOCK_DEAD))) { | ||
47 | if (sk) { | 45 | if (sk) { |
48 | sock_hold(sk); | 46 | sock_hold(sk); |
49 | ax25_destroy_socket(ax25); | 47 | ax25_destroy_socket(ax25); |
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index a6ffc6c2a69f..d9449df7cad5 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c | |||
@@ -87,6 +87,7 @@ static int br_set_mac_address(struct net_device *dev, void *p) | |||
87 | spin_lock_bh(&br->lock); | 87 | spin_lock_bh(&br->lock); |
88 | memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); | 88 | memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); |
89 | br_stp_change_bridge_id(br, addr->sa_data); | 89 | br_stp_change_bridge_id(br, addr->sa_data); |
90 | br->flags |= BR_SET_MAC_ADDR; | ||
90 | spin_unlock_bh(&br->lock); | 91 | spin_unlock_bh(&br->lock); |
91 | 92 | ||
92 | return 0; | 93 | return 0; |
diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c index 512645727f51..bdd9ccea17ce 100644 --- a/net/bridge/br_forward.c +++ b/net/bridge/br_forward.c | |||
@@ -89,7 +89,7 @@ void br_deliver(const struct net_bridge_port *to, struct sk_buff *skb) | |||
89 | /* called with rcu_read_lock */ | 89 | /* called with rcu_read_lock */ |
90 | void br_forward(const struct net_bridge_port *to, struct sk_buff *skb) | 90 | void br_forward(const struct net_bridge_port *to, struct sk_buff *skb) |
91 | { | 91 | { |
92 | if (should_deliver(to, skb)) { | 92 | if (!skb_warn_if_lro(skb) && should_deliver(to, skb)) { |
93 | __br_forward(to, skb); | 93 | __br_forward(to, skb); |
94 | return; | 94 | return; |
95 | } | 95 | } |
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 143c954681b8..832a561500d9 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c | |||
@@ -387,6 +387,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev) | |||
387 | goto err2; | 387 | goto err2; |
388 | 388 | ||
389 | rcu_assign_pointer(dev->br_port, p); | 389 | rcu_assign_pointer(dev->br_port, p); |
390 | dev_disable_lro(dev); | ||
390 | dev_set_promiscuity(dev, 1); | 391 | dev_set_promiscuity(dev, 1); |
391 | 392 | ||
392 | list_add_rcu(&p->list, &br->port_list); | 393 | list_add_rcu(&p->list, &br->port_list); |
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c index 0145e9416714..30b88777c3df 100644 --- a/net/bridge/br_input.c +++ b/net/bridge/br_input.c | |||
@@ -134,14 +134,11 @@ struct sk_buff *br_handle_frame(struct net_bridge_port *p, struct sk_buff *skb) | |||
134 | if (skb->protocol == htons(ETH_P_PAUSE)) | 134 | if (skb->protocol == htons(ETH_P_PAUSE)) |
135 | goto drop; | 135 | goto drop; |
136 | 136 | ||
137 | /* Process STP BPDU's through normal netif_receive_skb() path */ | 137 | if (NF_HOOK(PF_BRIDGE, NF_BR_LOCAL_IN, skb, skb->dev, |
138 | if (p->br->stp_enabled != BR_NO_STP) { | 138 | NULL, br_handle_local_finish)) |
139 | if (NF_HOOK(PF_BRIDGE, NF_BR_LOCAL_IN, skb, skb->dev, | 139 | return NULL; /* frame consumed by filter */ |
140 | NULL, br_handle_local_finish)) | 140 | else |
141 | return NULL; | 141 | return skb; /* continue processing */ |
142 | else | ||
143 | return skb; | ||
144 | } | ||
145 | } | 142 | } |
146 | 143 | ||
147 | switch (p->state) { | 144 | switch (p->state) { |
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 83ff5861c2d2..8593c9f6a302 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h | |||
@@ -92,6 +92,8 @@ struct net_bridge | |||
92 | struct hlist_head hash[BR_HASH_SIZE]; | 92 | struct hlist_head hash[BR_HASH_SIZE]; |
93 | struct list_head age_list; | 93 | struct list_head age_list; |
94 | unsigned long feature_mask; | 94 | unsigned long feature_mask; |
95 | unsigned long flags; | ||
96 | #define BR_SET_MAC_ADDR 0x00000001 | ||
95 | 97 | ||
96 | /* STP */ | 98 | /* STP */ |
97 | bridge_id designated_root; | 99 | bridge_id designated_root; |
diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c index 1a4e5c37a0cf..9a52ac5b4525 100644 --- a/net/bridge/br_stp_if.c +++ b/net/bridge/br_stp_if.c | |||
@@ -214,6 +214,10 @@ void br_stp_recalculate_bridge_id(struct net_bridge *br) | |||
214 | const unsigned char *addr = br_mac_zero; | 214 | const unsigned char *addr = br_mac_zero; |
215 | struct net_bridge_port *p; | 215 | struct net_bridge_port *p; |
216 | 216 | ||
217 | /* user has chosen a value so keep it */ | ||
218 | if (br->flags & BR_SET_MAC_ADDR) | ||
219 | return; | ||
220 | |||
217 | list_for_each_entry(p, &br->port_list, list) { | 221 | list_for_each_entry(p, &br->port_list, list) { |
218 | if (addr == br_mac_zero || | 222 | if (addr == br_mac_zero || |
219 | memcmp(p->dev->dev_addr, addr, ETH_ALEN) < 0) | 223 | memcmp(p->dev->dev_addr, addr, ETH_ALEN) < 0) |
diff --git a/net/bridge/netfilter/Kconfig b/net/bridge/netfilter/Kconfig index fb684c2ff8b6..540df4106bec 100644 --- a/net/bridge/netfilter/Kconfig +++ b/net/bridge/netfilter/Kconfig | |||
@@ -85,7 +85,7 @@ config BRIDGE_EBT_IP | |||
85 | 85 | ||
86 | config BRIDGE_EBT_IP6 | 86 | config BRIDGE_EBT_IP6 |
87 | tristate "ebt: IP6 filter support" | 87 | tristate "ebt: IP6 filter support" |
88 | depends on BRIDGE_NF_EBTABLES | 88 | depends on BRIDGE_NF_EBTABLES && IPV6 |
89 | help | 89 | help |
90 | This option adds the IP6 match, which allows basic IPV6 header field | 90 | This option adds the IP6 match, which allows basic IPV6 header field |
91 | filtering. | 91 | filtering. |
diff --git a/net/bridge/netfilter/Makefile b/net/bridge/netfilter/Makefile index dd960645b413..0718699540b0 100644 --- a/net/bridge/netfilter/Makefile +++ b/net/bridge/netfilter/Makefile | |||
@@ -14,7 +14,7 @@ obj-$(CONFIG_BRIDGE_EBT_802_3) += ebt_802_3.o | |||
14 | obj-$(CONFIG_BRIDGE_EBT_AMONG) += ebt_among.o | 14 | obj-$(CONFIG_BRIDGE_EBT_AMONG) += ebt_among.o |
15 | obj-$(CONFIG_BRIDGE_EBT_ARP) += ebt_arp.o | 15 | obj-$(CONFIG_BRIDGE_EBT_ARP) += ebt_arp.o |
16 | obj-$(CONFIG_BRIDGE_EBT_IP) += ebt_ip.o | 16 | obj-$(CONFIG_BRIDGE_EBT_IP) += ebt_ip.o |
17 | obj-$(CONFIG_BRIDGE_EBT_IP) += ebt_ip6.o | 17 | obj-$(CONFIG_BRIDGE_EBT_IP6) += ebt_ip6.o |
18 | obj-$(CONFIG_BRIDGE_EBT_LIMIT) += ebt_limit.o | 18 | obj-$(CONFIG_BRIDGE_EBT_LIMIT) += ebt_limit.o |
19 | obj-$(CONFIG_BRIDGE_EBT_MARK) += ebt_mark_m.o | 19 | obj-$(CONFIG_BRIDGE_EBT_MARK) += ebt_mark_m.o |
20 | obj-$(CONFIG_BRIDGE_EBT_PKTTYPE) += ebt_pkttype.o | 20 | obj-$(CONFIG_BRIDGE_EBT_PKTTYPE) += ebt_pkttype.o |
diff --git a/net/bridge/netfilter/ebt_log.c b/net/bridge/netfilter/ebt_log.c index c883ec8a28b4..2f430d4ae911 100644 --- a/net/bridge/netfilter/ebt_log.c +++ b/net/bridge/netfilter/ebt_log.c | |||
@@ -123,6 +123,7 @@ ebt_log_packet(unsigned int pf, unsigned int hooknum, | |||
123 | goto out; | 123 | goto out; |
124 | } | 124 | } |
125 | 125 | ||
126 | #if defined(CONFIG_BRIDGE_EBT_IP6) || defined(CONFIG_BRIDGE_EBT_IP6_MODULE) | ||
126 | if ((bitmask & EBT_LOG_IP6) && eth_hdr(skb)->h_proto == | 127 | if ((bitmask & EBT_LOG_IP6) && eth_hdr(skb)->h_proto == |
127 | htons(ETH_P_IPV6)) { | 128 | htons(ETH_P_IPV6)) { |
128 | const struct ipv6hdr *ih; | 129 | const struct ipv6hdr *ih; |
@@ -146,6 +147,7 @@ ebt_log_packet(unsigned int pf, unsigned int hooknum, | |||
146 | print_ports(skb, nexthdr, offset_ph); | 147 | print_ports(skb, nexthdr, offset_ph); |
147 | goto out; | 148 | goto out; |
148 | } | 149 | } |
150 | #endif | ||
149 | 151 | ||
150 | if ((bitmask & EBT_LOG_ARP) && | 152 | if ((bitmask & EBT_LOG_ARP) && |
151 | ((eth_hdr(skb)->h_proto == htons(ETH_P_ARP)) || | 153 | ((eth_hdr(skb)->h_proto == htons(ETH_P_ARP)) || |
diff --git a/net/core/dev.c b/net/core/dev.c index 68d8df0992ab..f6944ecd5b2e 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -90,6 +90,7 @@ | |||
90 | #include <linux/if_ether.h> | 90 | #include <linux/if_ether.h> |
91 | #include <linux/netdevice.h> | 91 | #include <linux/netdevice.h> |
92 | #include <linux/etherdevice.h> | 92 | #include <linux/etherdevice.h> |
93 | #include <linux/ethtool.h> | ||
93 | #include <linux/notifier.h> | 94 | #include <linux/notifier.h> |
94 | #include <linux/skbuff.h> | 95 | #include <linux/skbuff.h> |
95 | #include <net/net_namespace.h> | 96 | #include <net/net_namespace.h> |
@@ -961,6 +962,12 @@ void netdev_state_change(struct net_device *dev) | |||
961 | } | 962 | } |
962 | } | 963 | } |
963 | 964 | ||
965 | void netdev_bonding_change(struct net_device *dev) | ||
966 | { | ||
967 | call_netdevice_notifiers(NETDEV_BONDING_FAILOVER, dev); | ||
968 | } | ||
969 | EXPORT_SYMBOL(netdev_bonding_change); | ||
970 | |||
964 | /** | 971 | /** |
965 | * dev_load - load a network module | 972 | * dev_load - load a network module |
966 | * @net: the applicable net namespace | 973 | * @net: the applicable net namespace |
@@ -1117,6 +1124,29 @@ int dev_close(struct net_device *dev) | |||
1117 | } | 1124 | } |
1118 | 1125 | ||
1119 | 1126 | ||
1127 | /** | ||
1128 | * dev_disable_lro - disable Large Receive Offload on a device | ||
1129 | * @dev: device | ||
1130 | * | ||
1131 | * Disable Large Receive Offload (LRO) on a net device. Must be | ||
1132 | * called under RTNL. This is needed if received packets may be | ||
1133 | * forwarded to another interface. | ||
1134 | */ | ||
1135 | void dev_disable_lro(struct net_device *dev) | ||
1136 | { | ||
1137 | if (dev->ethtool_ops && dev->ethtool_ops->get_flags && | ||
1138 | dev->ethtool_ops->set_flags) { | ||
1139 | u32 flags = dev->ethtool_ops->get_flags(dev); | ||
1140 | if (flags & ETH_FLAG_LRO) { | ||
1141 | flags &= ~ETH_FLAG_LRO; | ||
1142 | dev->ethtool_ops->set_flags(dev, flags); | ||
1143 | } | ||
1144 | } | ||
1145 | WARN_ON(dev->features & NETIF_F_LRO); | ||
1146 | } | ||
1147 | EXPORT_SYMBOL(dev_disable_lro); | ||
1148 | |||
1149 | |||
1120 | static int dev_boot_phase = 1; | 1150 | static int dev_boot_phase = 1; |
1121 | 1151 | ||
1122 | /* | 1152 | /* |
@@ -2765,16 +2795,29 @@ int netdev_set_master(struct net_device *slave, struct net_device *master) | |||
2765 | return 0; | 2795 | return 0; |
2766 | } | 2796 | } |
2767 | 2797 | ||
2768 | static void __dev_set_promiscuity(struct net_device *dev, int inc) | 2798 | static int __dev_set_promiscuity(struct net_device *dev, int inc) |
2769 | { | 2799 | { |
2770 | unsigned short old_flags = dev->flags; | 2800 | unsigned short old_flags = dev->flags; |
2771 | 2801 | ||
2772 | ASSERT_RTNL(); | 2802 | ASSERT_RTNL(); |
2773 | 2803 | ||
2774 | if ((dev->promiscuity += inc) == 0) | 2804 | dev->flags |= IFF_PROMISC; |
2775 | dev->flags &= ~IFF_PROMISC; | 2805 | dev->promiscuity += inc; |
2776 | else | 2806 | if (dev->promiscuity == 0) { |
2777 | dev->flags |= IFF_PROMISC; | 2807 | /* |
2808 | * Avoid overflow. | ||
2809 | * If inc causes overflow, untouch promisc and return error. | ||
2810 | */ | ||
2811 | if (inc < 0) | ||
2812 | dev->flags &= ~IFF_PROMISC; | ||
2813 | else { | ||
2814 | dev->promiscuity -= inc; | ||
2815 | printk(KERN_WARNING "%s: promiscuity touches roof, " | ||
2816 | "set promiscuity failed, promiscuity feature " | ||
2817 | "of device might be broken.\n", dev->name); | ||
2818 | return -EOVERFLOW; | ||
2819 | } | ||
2820 | } | ||
2778 | if (dev->flags != old_flags) { | 2821 | if (dev->flags != old_flags) { |
2779 | printk(KERN_INFO "device %s %s promiscuous mode\n", | 2822 | printk(KERN_INFO "device %s %s promiscuous mode\n", |
2780 | dev->name, (dev->flags & IFF_PROMISC) ? "entered" : | 2823 | dev->name, (dev->flags & IFF_PROMISC) ? "entered" : |
@@ -2792,6 +2835,7 @@ static void __dev_set_promiscuity(struct net_device *dev, int inc) | |||
2792 | if (dev->change_rx_flags) | 2835 | if (dev->change_rx_flags) |
2793 | dev->change_rx_flags(dev, IFF_PROMISC); | 2836 | dev->change_rx_flags(dev, IFF_PROMISC); |
2794 | } | 2837 | } |
2838 | return 0; | ||
2795 | } | 2839 | } |
2796 | 2840 | ||
2797 | /** | 2841 | /** |
@@ -2803,14 +2847,19 @@ static void __dev_set_promiscuity(struct net_device *dev, int inc) | |||
2803 | * remains above zero the interface remains promiscuous. Once it hits zero | 2847 | * remains above zero the interface remains promiscuous. Once it hits zero |
2804 | * the device reverts back to normal filtering operation. A negative inc | 2848 | * the device reverts back to normal filtering operation. A negative inc |
2805 | * value is used to drop promiscuity on the device. | 2849 | * value is used to drop promiscuity on the device. |
2850 | * Return 0 if successful or a negative errno code on error. | ||
2806 | */ | 2851 | */ |
2807 | void dev_set_promiscuity(struct net_device *dev, int inc) | 2852 | int dev_set_promiscuity(struct net_device *dev, int inc) |
2808 | { | 2853 | { |
2809 | unsigned short old_flags = dev->flags; | 2854 | unsigned short old_flags = dev->flags; |
2855 | int err; | ||
2810 | 2856 | ||
2811 | __dev_set_promiscuity(dev, inc); | 2857 | err = __dev_set_promiscuity(dev, inc); |
2858 | if (!err) | ||
2859 | return err; | ||
2812 | if (dev->flags != old_flags) | 2860 | if (dev->flags != old_flags) |
2813 | dev_set_rx_mode(dev); | 2861 | dev_set_rx_mode(dev); |
2862 | return err; | ||
2814 | } | 2863 | } |
2815 | 2864 | ||
2816 | /** | 2865 | /** |
@@ -2823,22 +2872,38 @@ void dev_set_promiscuity(struct net_device *dev, int inc) | |||
2823 | * to all interfaces. Once it hits zero the device reverts back to normal | 2872 | * to all interfaces. Once it hits zero the device reverts back to normal |
2824 | * filtering operation. A negative @inc value is used to drop the counter | 2873 | * filtering operation. A negative @inc value is used to drop the counter |
2825 | * when releasing a resource needing all multicasts. | 2874 | * when releasing a resource needing all multicasts. |
2875 | * Return 0 if successful or a negative errno code on error. | ||
2826 | */ | 2876 | */ |
2827 | 2877 | ||
2828 | void dev_set_allmulti(struct net_device *dev, int inc) | 2878 | int dev_set_allmulti(struct net_device *dev, int inc) |
2829 | { | 2879 | { |
2830 | unsigned short old_flags = dev->flags; | 2880 | unsigned short old_flags = dev->flags; |
2831 | 2881 | ||
2832 | ASSERT_RTNL(); | 2882 | ASSERT_RTNL(); |
2833 | 2883 | ||
2834 | dev->flags |= IFF_ALLMULTI; | 2884 | dev->flags |= IFF_ALLMULTI; |
2835 | if ((dev->allmulti += inc) == 0) | 2885 | dev->allmulti += inc; |
2836 | dev->flags &= ~IFF_ALLMULTI; | 2886 | if (dev->allmulti == 0) { |
2887 | /* | ||
2888 | * Avoid overflow. | ||
2889 | * If inc causes overflow, untouch allmulti and return error. | ||
2890 | */ | ||
2891 | if (inc < 0) | ||
2892 | dev->flags &= ~IFF_ALLMULTI; | ||
2893 | else { | ||
2894 | dev->allmulti -= inc; | ||
2895 | printk(KERN_WARNING "%s: allmulti touches roof, " | ||
2896 | "set allmulti failed, allmulti feature of " | ||
2897 | "device might be broken.\n", dev->name); | ||
2898 | return -EOVERFLOW; | ||
2899 | } | ||
2900 | } | ||
2837 | if (dev->flags ^ old_flags) { | 2901 | if (dev->flags ^ old_flags) { |
2838 | if (dev->change_rx_flags) | 2902 | if (dev->change_rx_flags) |
2839 | dev->change_rx_flags(dev, IFF_ALLMULTI); | 2903 | dev->change_rx_flags(dev, IFF_ALLMULTI); |
2840 | dev_set_rx_mode(dev); | 2904 | dev_set_rx_mode(dev); |
2841 | } | 2905 | } |
2906 | return 0; | ||
2842 | } | 2907 | } |
2843 | 2908 | ||
2844 | /* | 2909 | /* |
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index dccd737ea2e3..3f7941319217 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c | |||
@@ -468,6 +468,19 @@ int netdev_register_kobject(struct net_device *net) | |||
468 | return device_add(dev); | 468 | return device_add(dev); |
469 | } | 469 | } |
470 | 470 | ||
471 | int netdev_class_create_file(struct class_attribute *class_attr) | ||
472 | { | ||
473 | return class_create_file(&net_class, class_attr); | ||
474 | } | ||
475 | |||
476 | void netdev_class_remove_file(struct class_attribute *class_attr) | ||
477 | { | ||
478 | class_remove_file(&net_class, class_attr); | ||
479 | } | ||
480 | |||
481 | EXPORT_SYMBOL(netdev_class_create_file); | ||
482 | EXPORT_SYMBOL(netdev_class_remove_file); | ||
483 | |||
471 | void netdev_initialize_kobject(struct net_device *net) | 484 | void netdev_initialize_kobject(struct net_device *net) |
472 | { | 485 | { |
473 | struct device *device = &(net->dev); | 486 | struct device *device = &(net->dev); |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 3e18f8525e82..2df012be973d 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -2583,6 +2583,13 @@ bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off) | |||
2583 | return true; | 2583 | return true; |
2584 | } | 2584 | } |
2585 | 2585 | ||
2586 | void __skb_warn_lro_forwarding(const struct sk_buff *skb) | ||
2587 | { | ||
2588 | if (net_ratelimit()) | ||
2589 | pr_warning("%s: received packets cannot be forwarded" | ||
2590 | " while LRO is enabled\n", skb->dev->name); | ||
2591 | } | ||
2592 | |||
2586 | EXPORT_SYMBOL(___pskb_trim); | 2593 | EXPORT_SYMBOL(___pskb_trim); |
2587 | EXPORT_SYMBOL(__kfree_skb); | 2594 | EXPORT_SYMBOL(__kfree_skb); |
2588 | EXPORT_SYMBOL(kfree_skb); | 2595 | EXPORT_SYMBOL(kfree_skb); |
@@ -2616,6 +2623,7 @@ EXPORT_SYMBOL(skb_seq_read); | |||
2616 | EXPORT_SYMBOL(skb_abort_seq_read); | 2623 | EXPORT_SYMBOL(skb_abort_seq_read); |
2617 | EXPORT_SYMBOL(skb_find_text); | 2624 | EXPORT_SYMBOL(skb_find_text); |
2618 | EXPORT_SYMBOL(skb_append_datato_frags); | 2625 | EXPORT_SYMBOL(skb_append_datato_frags); |
2626 | EXPORT_SYMBOL(__skb_warn_lro_forwarding); | ||
2619 | 2627 | ||
2620 | EXPORT_SYMBOL_GPL(skb_to_sgvec); | 2628 | EXPORT_SYMBOL_GPL(skb_to_sgvec); |
2621 | EXPORT_SYMBOL_GPL(skb_cow_data); | 2629 | EXPORT_SYMBOL_GPL(skb_cow_data); |
diff --git a/net/core/sock.c b/net/core/sock.c index 3879bf65897e..2c0ba52e5303 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -1066,7 +1066,7 @@ struct sock *sk_clone(const struct sock *sk, const gfp_t priority) | |||
1066 | * to be taken into account in all callers. -acme | 1066 | * to be taken into account in all callers. -acme |
1067 | */ | 1067 | */ |
1068 | sk_refcnt_debug_inc(newsk); | 1068 | sk_refcnt_debug_inc(newsk); |
1069 | newsk->sk_socket = NULL; | 1069 | sk_set_socket(newsk, NULL); |
1070 | newsk->sk_sleep = NULL; | 1070 | newsk->sk_sleep = NULL; |
1071 | 1071 | ||
1072 | if (newsk->sk_prot->sockets_allocated) | 1072 | if (newsk->sk_prot->sockets_allocated) |
@@ -1702,7 +1702,7 @@ void sock_init_data(struct socket *sock, struct sock *sk) | |||
1702 | sk->sk_rcvbuf = sysctl_rmem_default; | 1702 | sk->sk_rcvbuf = sysctl_rmem_default; |
1703 | sk->sk_sndbuf = sysctl_wmem_default; | 1703 | sk->sk_sndbuf = sysctl_wmem_default; |
1704 | sk->sk_state = TCP_CLOSE; | 1704 | sk->sk_state = TCP_CLOSE; |
1705 | sk->sk_socket = sock; | 1705 | sk_set_socket(sk, sock); |
1706 | 1706 | ||
1707 | sock_set_flag(sk, SOCK_ZAPPED); | 1707 | sock_set_flag(sk, SOCK_ZAPPED); |
1708 | 1708 | ||
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c index fc2efe899e91..931bdf9cb756 100644 --- a/net/decnet/af_decnet.c +++ b/net/decnet/af_decnet.c | |||
@@ -1719,6 +1719,8 @@ static int dn_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1719 | * See if there is data ready to read, sleep if there isn't | 1719 | * See if there is data ready to read, sleep if there isn't |
1720 | */ | 1720 | */ |
1721 | for(;;) { | 1721 | for(;;) { |
1722 | DEFINE_WAIT(wait); | ||
1723 | |||
1722 | if (sk->sk_err) | 1724 | if (sk->sk_err) |
1723 | goto out; | 1725 | goto out; |
1724 | 1726 | ||
@@ -1748,14 +1750,11 @@ static int dn_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1748 | goto out; | 1750 | goto out; |
1749 | } | 1751 | } |
1750 | 1752 | ||
1751 | set_bit(SOCK_ASYNC_WAITDATA, &sock->flags); | 1753 | prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); |
1752 | SOCK_SLEEP_PRE(sk) | 1754 | set_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); |
1753 | 1755 | sk_wait_event(sk, &timeo, dn_data_ready(sk, queue, flags, target)); | |
1754 | if (!dn_data_ready(sk, queue, flags, target)) | 1756 | clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); |
1755 | schedule(); | 1757 | finish_wait(sk->sk_sleep, &wait); |
1756 | |||
1757 | SOCK_SLEEP_POST(sk) | ||
1758 | clear_bit(SOCK_ASYNC_WAITDATA, &sock->flags); | ||
1759 | } | 1758 | } |
1760 | 1759 | ||
1761 | for(skb = queue->next; skb != (struct sk_buff *)queue; skb = nskb) { | 1760 | for(skb = queue->next; skb != (struct sk_buff *)queue; skb = nskb) { |
@@ -2002,18 +2001,19 @@ static int dn_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
2002 | * size. | 2001 | * size. |
2003 | */ | 2002 | */ |
2004 | if (dn_queue_too_long(scp, queue, flags)) { | 2003 | if (dn_queue_too_long(scp, queue, flags)) { |
2004 | DEFINE_WAIT(wait); | ||
2005 | |||
2005 | if (flags & MSG_DONTWAIT) { | 2006 | if (flags & MSG_DONTWAIT) { |
2006 | err = -EWOULDBLOCK; | 2007 | err = -EWOULDBLOCK; |
2007 | goto out; | 2008 | goto out; |
2008 | } | 2009 | } |
2009 | 2010 | ||
2010 | SOCK_SLEEP_PRE(sk) | 2011 | prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); |
2011 | 2012 | set_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); | |
2012 | if (dn_queue_too_long(scp, queue, flags)) | 2013 | sk_wait_event(sk, &timeo, |
2013 | schedule(); | 2014 | !dn_queue_too_long(scp, queue, flags)); |
2014 | 2015 | clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); | |
2015 | SOCK_SLEEP_POST(sk) | 2016 | finish_wait(sk->sk_sleep, &wait); |
2016 | |||
2017 | continue; | 2017 | continue; |
2018 | } | 2018 | } |
2019 | 2019 | ||
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c index 7c9bb13b1539..d35127bb84e1 100644 --- a/net/econet/af_econet.c +++ b/net/econet/af_econet.c | |||
@@ -573,9 +573,7 @@ static int econet_release(struct socket *sock) | |||
573 | 573 | ||
574 | sk->sk_state_change(sk); /* It is useless. Just for sanity. */ | 574 | sk->sk_state_change(sk); /* It is useless. Just for sanity. */ |
575 | 575 | ||
576 | sock->sk = NULL; | 576 | sock_orphan(sk); |
577 | sk->sk_socket = NULL; | ||
578 | sock_set_flag(sk, SOCK_DEAD); | ||
579 | 577 | ||
580 | /* Purge queues */ | 578 | /* Purge queues */ |
581 | 579 | ||
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index f8c0b0aea93a..9de2514946ca 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -168,6 +168,8 @@ static struct in_device *inetdev_init(struct net_device *dev) | |||
168 | in_dev->dev = dev; | 168 | in_dev->dev = dev; |
169 | if ((in_dev->arp_parms = neigh_parms_alloc(dev, &arp_tbl)) == NULL) | 169 | if ((in_dev->arp_parms = neigh_parms_alloc(dev, &arp_tbl)) == NULL) |
170 | goto out_kfree; | 170 | goto out_kfree; |
171 | if (IPV4_DEVCONF(in_dev->cnf, FORWARDING)) | ||
172 | dev_disable_lro(dev); | ||
171 | /* Reference in_dev->dev */ | 173 | /* Reference in_dev->dev */ |
172 | dev_hold(dev); | 174 | dev_hold(dev); |
173 | /* Account for reference dev->ip_ptr (below) */ | 175 | /* Account for reference dev->ip_ptr (below) */ |
@@ -1241,6 +1243,8 @@ static void inet_forward_change(struct net *net) | |||
1241 | read_lock(&dev_base_lock); | 1243 | read_lock(&dev_base_lock); |
1242 | for_each_netdev(net, dev) { | 1244 | for_each_netdev(net, dev) { |
1243 | struct in_device *in_dev; | 1245 | struct in_device *in_dev; |
1246 | if (on) | ||
1247 | dev_disable_lro(dev); | ||
1244 | rcu_read_lock(); | 1248 | rcu_read_lock(); |
1245 | in_dev = __in_dev_get_rcu(dev); | 1249 | in_dev = __in_dev_get_rcu(dev); |
1246 | if (in_dev) | 1250 | if (in_dev) |
@@ -1248,8 +1252,6 @@ static void inet_forward_change(struct net *net) | |||
1248 | rcu_read_unlock(); | 1252 | rcu_read_unlock(); |
1249 | } | 1253 | } |
1250 | read_unlock(&dev_base_lock); | 1254 | read_unlock(&dev_base_lock); |
1251 | |||
1252 | rt_cache_flush(0); | ||
1253 | } | 1255 | } |
1254 | 1256 | ||
1255 | static int devinet_conf_proc(ctl_table *ctl, int write, | 1257 | static int devinet_conf_proc(ctl_table *ctl, int write, |
@@ -1335,10 +1337,19 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write, | |||
1335 | if (write && *valp != val) { | 1337 | if (write && *valp != val) { |
1336 | struct net *net = ctl->extra2; | 1338 | struct net *net = ctl->extra2; |
1337 | 1339 | ||
1338 | if (valp == &IPV4_DEVCONF_ALL(net, FORWARDING)) | 1340 | if (valp != &IPV4_DEVCONF_DFLT(net, FORWARDING)) { |
1339 | inet_forward_change(net); | 1341 | rtnl_lock(); |
1340 | else if (valp != &IPV4_DEVCONF_DFLT(net, FORWARDING)) | 1342 | if (valp == &IPV4_DEVCONF_ALL(net, FORWARDING)) { |
1343 | inet_forward_change(net); | ||
1344 | } else if (*valp) { | ||
1345 | struct ipv4_devconf *cnf = ctl->extra1; | ||
1346 | struct in_device *idev = | ||
1347 | container_of(cnf, struct in_device, cnf); | ||
1348 | dev_disable_lro(idev->dev); | ||
1349 | } | ||
1350 | rtnl_unlock(); | ||
1341 | rt_cache_flush(0); | 1351 | rt_cache_flush(0); |
1352 | } | ||
1342 | } | 1353 | } |
1343 | 1354 | ||
1344 | return ret; | 1355 | return ret; |
diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c index 37d36a3f33cd..da14725916d3 100644 --- a/net/ipv4/ip_forward.c +++ b/net/ipv4/ip_forward.c | |||
@@ -56,6 +56,9 @@ int ip_forward(struct sk_buff *skb) | |||
56 | struct rtable *rt; /* Route we use */ | 56 | struct rtable *rt; /* Route we use */ |
57 | struct ip_options * opt = &(IPCB(skb)->opt); | 57 | struct ip_options * opt = &(IPCB(skb)->opt); |
58 | 58 | ||
59 | if (skb_warn_if_lro(skb)) | ||
60 | goto drop; | ||
61 | |||
59 | if (!xfrm4_policy_check(NULL, XFRM_POLICY_FWD, skb)) | 62 | if (!xfrm4_policy_check(NULL, XFRM_POLICY_FWD, skb)) |
60 | goto drop; | 63 | goto drop; |
61 | 64 | ||
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c index 04578593e100..d2a887fc8d9b 100644 --- a/net/ipv4/netfilter/nf_nat_core.c +++ b/net/ipv4/netfilter/nf_nat_core.c | |||
@@ -556,7 +556,6 @@ static void nf_nat_cleanup_conntrack(struct nf_conn *ct) | |||
556 | 556 | ||
557 | spin_lock_bh(&nf_nat_lock); | 557 | spin_lock_bh(&nf_nat_lock); |
558 | hlist_del_rcu(&nat->bysource); | 558 | hlist_del_rcu(&nat->bysource); |
559 | nat->ct = NULL; | ||
560 | spin_unlock_bh(&nf_nat_lock); | 559 | spin_unlock_bh(&nf_nat_lock); |
561 | } | 560 | } |
562 | 561 | ||
@@ -570,8 +569,8 @@ static void nf_nat_move_storage(void *new, void *old) | |||
570 | return; | 569 | return; |
571 | 570 | ||
572 | spin_lock_bh(&nf_nat_lock); | 571 | spin_lock_bh(&nf_nat_lock); |
573 | hlist_replace_rcu(&old_nat->bysource, &new_nat->bysource); | ||
574 | new_nat->ct = ct; | 572 | new_nat->ct = ct; |
573 | hlist_replace_rcu(&old_nat->bysource, &new_nat->bysource); | ||
575 | spin_unlock_bh(&nf_nat_lock); | 574 | spin_unlock_bh(&nf_nat_lock); |
576 | } | 575 | } |
577 | 576 | ||
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 7d449468409e..925fdf18cf92 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -944,7 +944,7 @@ static int raw_seq_show(struct seq_file *seq, void *v) | |||
944 | if (v == SEQ_START_TOKEN) | 944 | if (v == SEQ_START_TOKEN) |
945 | seq_printf(seq, " sl local_address rem_address st tx_queue " | 945 | seq_printf(seq, " sl local_address rem_address st tx_queue " |
946 | "rx_queue tr tm->when retrnsmt uid timeout " | 946 | "rx_queue tr tm->when retrnsmt uid timeout " |
947 | "inode drops\n"); | 947 | "inode ref pointer drops\n"); |
948 | else | 948 | else |
949 | raw_sock_seq_show(seq, v, raw_seq_private(seq)->bucket); | 949 | raw_sock_seq_show(seq, v, raw_seq_private(seq)->bucket); |
950 | return 0; | 950 | return 0; |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 11eabf136144..3bbf6fb6e4f5 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -1040,8 +1040,10 @@ int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb) | |||
1040 | 1040 | ||
1041 | if ((rc = sock_queue_rcv_skb(sk,skb)) < 0) { | 1041 | if ((rc = sock_queue_rcv_skb(sk,skb)) < 0) { |
1042 | /* Note that an ENOMEM error is charged twice */ | 1042 | /* Note that an ENOMEM error is charged twice */ |
1043 | if (rc == -ENOMEM) | 1043 | if (rc == -ENOMEM) { |
1044 | UDP_INC_STATS_BH(UDP_MIB_RCVBUFERRORS, is_udplite); | 1044 | UDP_INC_STATS_BH(UDP_MIB_RCVBUFERRORS, is_udplite); |
1045 | atomic_inc(&sk->sk_drops); | ||
1046 | } | ||
1045 | goto drop; | 1047 | goto drop; |
1046 | } | 1048 | } |
1047 | 1049 | ||
@@ -1629,12 +1631,13 @@ static void udp4_format_sock(struct sock *sp, struct seq_file *f, | |||
1629 | __u16 srcp = ntohs(inet->sport); | 1631 | __u16 srcp = ntohs(inet->sport); |
1630 | 1632 | ||
1631 | seq_printf(f, "%4d: %08X:%04X %08X:%04X" | 1633 | seq_printf(f, "%4d: %08X:%04X %08X:%04X" |
1632 | " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p%n", | 1634 | " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d%n", |
1633 | bucket, src, srcp, dest, destp, sp->sk_state, | 1635 | bucket, src, srcp, dest, destp, sp->sk_state, |
1634 | atomic_read(&sp->sk_wmem_alloc), | 1636 | atomic_read(&sp->sk_wmem_alloc), |
1635 | atomic_read(&sp->sk_rmem_alloc), | 1637 | atomic_read(&sp->sk_rmem_alloc), |
1636 | 0, 0L, 0, sock_i_uid(sp), 0, sock_i_ino(sp), | 1638 | 0, 0L, 0, sock_i_uid(sp), 0, sock_i_ino(sp), |
1637 | atomic_read(&sp->sk_refcnt), sp, len); | 1639 | atomic_read(&sp->sk_refcnt), sp, |
1640 | atomic_read(&sp->sk_drops), len); | ||
1638 | } | 1641 | } |
1639 | 1642 | ||
1640 | int udp4_seq_show(struct seq_file *seq, void *v) | 1643 | int udp4_seq_show(struct seq_file *seq, void *v) |
@@ -1643,7 +1646,7 @@ int udp4_seq_show(struct seq_file *seq, void *v) | |||
1643 | seq_printf(seq, "%-127s\n", | 1646 | seq_printf(seq, "%-127s\n", |
1644 | " sl local_address rem_address st tx_queue " | 1647 | " sl local_address rem_address st tx_queue " |
1645 | "rx_queue tr tm->when retrnsmt uid timeout " | 1648 | "rx_queue tr tm->when retrnsmt uid timeout " |
1646 | "inode"); | 1649 | "inode ref pointer drops"); |
1647 | else { | 1650 | else { |
1648 | struct udp_iter_state *state = seq->private; | 1651 | struct udp_iter_state *state = seq->private; |
1649 | int len; | 1652 | int len; |
diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c index 584e6d74e3a9..7135279f3f84 100644 --- a/net/ipv4/xfrm4_mode_tunnel.c +++ b/net/ipv4/xfrm4_mode_tunnel.c | |||
@@ -52,7 +52,7 @@ static int xfrm4_mode_tunnel_output(struct xfrm_state *x, struct sk_buff *skb) | |||
52 | IP_ECN_clear(top_iph); | 52 | IP_ECN_clear(top_iph); |
53 | 53 | ||
54 | top_iph->frag_off = (flags & XFRM_STATE_NOPMTUDISC) ? | 54 | top_iph->frag_off = (flags & XFRM_STATE_NOPMTUDISC) ? |
55 | 0 : XFRM_MODE_SKB_CB(skb)->frag_off; | 55 | 0 : (XFRM_MODE_SKB_CB(skb)->frag_off & htons(IP_DF)); |
56 | ip_select_ident(top_iph, dst->child, NULL); | 56 | ip_select_ident(top_iph, dst->child, NULL); |
57 | 57 | ||
58 | top_iph->ttl = dst_metric(dst->child, RTAX_HOPLIMIT); | 58 | top_iph->ttl = dst_metric(dst->child, RTAX_HOPLIMIT); |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 9be6be3a7ff3..84127d854cfc 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -348,6 +348,8 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev) | |||
348 | kfree(ndev); | 348 | kfree(ndev); |
349 | return NULL; | 349 | return NULL; |
350 | } | 350 | } |
351 | if (ndev->cnf.forwarding) | ||
352 | dev_disable_lro(dev); | ||
351 | /* We refer to the device */ | 353 | /* We refer to the device */ |
352 | dev_hold(dev); | 354 | dev_hold(dev); |
353 | 355 | ||
@@ -442,6 +444,8 @@ static void dev_forward_change(struct inet6_dev *idev) | |||
442 | if (!idev) | 444 | if (!idev) |
443 | return; | 445 | return; |
444 | dev = idev->dev; | 446 | dev = idev->dev; |
447 | if (idev->cnf.forwarding) | ||
448 | dev_disable_lro(dev); | ||
445 | if (dev && (dev->flags & IFF_MULTICAST)) { | 449 | if (dev && (dev->flags & IFF_MULTICAST)) { |
446 | if (idev->cnf.forwarding) | 450 | if (idev->cnf.forwarding) |
447 | ipv6_dev_mc_inc(dev, &in6addr_linklocal_allrouters); | 451 | ipv6_dev_mc_inc(dev, &in6addr_linklocal_allrouters); |
@@ -487,12 +491,14 @@ static void addrconf_fixup_forwarding(struct ctl_table *table, int *p, int old) | |||
487 | if (p == &net->ipv6.devconf_dflt->forwarding) | 491 | if (p == &net->ipv6.devconf_dflt->forwarding) |
488 | return; | 492 | return; |
489 | 493 | ||
494 | rtnl_lock(); | ||
490 | if (p == &net->ipv6.devconf_all->forwarding) { | 495 | if (p == &net->ipv6.devconf_all->forwarding) { |
491 | __s32 newf = net->ipv6.devconf_all->forwarding; | 496 | __s32 newf = net->ipv6.devconf_all->forwarding; |
492 | net->ipv6.devconf_dflt->forwarding = newf; | 497 | net->ipv6.devconf_dflt->forwarding = newf; |
493 | addrconf_forward_change(net, newf); | 498 | addrconf_forward_change(net, newf); |
494 | } else if ((!*p) ^ (!old)) | 499 | } else if ((!*p) ^ (!old)) |
495 | dev_forward_change((struct inet6_dev *)table->extra1); | 500 | dev_forward_change((struct inet6_dev *)table->extra1); |
501 | rtnl_unlock(); | ||
496 | 502 | ||
497 | if (*p) | 503 | if (*p) |
498 | rt6_purge_dflt_routers(net); | 504 | rt6_purge_dflt_routers(net); |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 40a2813a63d1..fd7cd1bfe151 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -407,6 +407,9 @@ int ip6_forward(struct sk_buff *skb) | |||
407 | if (ipv6_devconf.forwarding == 0) | 407 | if (ipv6_devconf.forwarding == 0) |
408 | goto error; | 408 | goto error; |
409 | 409 | ||
410 | if (skb_warn_if_lro(skb)) | ||
411 | goto drop; | ||
412 | |||
410 | if (!xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) { | 413 | if (!xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) { |
411 | IP6_INC_STATS(ip6_dst_idev(dst), IPSTATS_MIB_INDISCARDS); | 414 | IP6_INC_STATS(ip6_dst_idev(dst), IPSTATS_MIB_INDISCARDS); |
412 | goto drop; | 415 | goto drop; |
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 456777d7a407..34cfb3f41c2c 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -1251,7 +1251,7 @@ static int raw6_seq_show(struct seq_file *seq, void *v) | |||
1251 | "local_address " | 1251 | "local_address " |
1252 | "remote_address " | 1252 | "remote_address " |
1253 | "st tx_queue rx_queue tr tm->when retrnsmt" | 1253 | "st tx_queue rx_queue tr tm->when retrnsmt" |
1254 | " uid timeout inode drops\n"); | 1254 | " uid timeout inode ref pointer drops\n"); |
1255 | else | 1255 | else |
1256 | raw6_sock_seq_show(seq, v, raw_seq_private(seq)->bucket); | 1256 | raw6_sock_seq_show(seq, v, raw_seq_private(seq)->bucket); |
1257 | return 0; | 1257 | return 0; |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index daefc18d50a0..09be09cc1aa6 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -70,8 +70,6 @@ | |||
70 | 70 | ||
71 | static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb); | 71 | static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb); |
72 | static void tcp_v6_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req); | 72 | static void tcp_v6_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req); |
73 | static void tcp_v6_send_check(struct sock *sk, int len, | ||
74 | struct sk_buff *skb); | ||
75 | 73 | ||
76 | static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb); | 74 | static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb); |
77 | 75 | ||
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 432edaa882f6..f91e1df0d25e 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -297,8 +297,10 @@ int udpv6_queue_rcv_skb(struct sock * sk, struct sk_buff *skb) | |||
297 | 297 | ||
298 | if ((rc = sock_queue_rcv_skb(sk,skb)) < 0) { | 298 | if ((rc = sock_queue_rcv_skb(sk,skb)) < 0) { |
299 | /* Note that an ENOMEM error is charged twice */ | 299 | /* Note that an ENOMEM error is charged twice */ |
300 | if (rc == -ENOMEM) | 300 | if (rc == -ENOMEM) { |
301 | UDP6_INC_STATS_BH(UDP_MIB_RCVBUFERRORS, is_udplite); | 301 | UDP6_INC_STATS_BH(UDP_MIB_RCVBUFERRORS, is_udplite); |
302 | atomic_inc(&sk->sk_drops); | ||
303 | } | ||
302 | goto drop; | 304 | goto drop; |
303 | } | 305 | } |
304 | 306 | ||
@@ -955,7 +957,7 @@ static void udp6_sock_seq_show(struct seq_file *seq, struct sock *sp, int bucket | |||
955 | srcp = ntohs(inet->sport); | 957 | srcp = ntohs(inet->sport); |
956 | seq_printf(seq, | 958 | seq_printf(seq, |
957 | "%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X " | 959 | "%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X " |
958 | "%02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p\n", | 960 | "%02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d\n", |
959 | bucket, | 961 | bucket, |
960 | src->s6_addr32[0], src->s6_addr32[1], | 962 | src->s6_addr32[0], src->s6_addr32[1], |
961 | src->s6_addr32[2], src->s6_addr32[3], srcp, | 963 | src->s6_addr32[2], src->s6_addr32[3], srcp, |
@@ -967,7 +969,8 @@ static void udp6_sock_seq_show(struct seq_file *seq, struct sock *sp, int bucket | |||
967 | 0, 0L, 0, | 969 | 0, 0L, 0, |
968 | sock_i_uid(sp), 0, | 970 | sock_i_uid(sp), 0, |
969 | sock_i_ino(sp), | 971 | sock_i_ino(sp), |
970 | atomic_read(&sp->sk_refcnt), sp); | 972 | atomic_read(&sp->sk_refcnt), sp, |
973 | atomic_read(&sp->sk_drops)); | ||
971 | } | 974 | } |
972 | 975 | ||
973 | int udp6_seq_show(struct seq_file *seq, void *v) | 976 | int udp6_seq_show(struct seq_file *seq, void *v) |
@@ -978,7 +981,7 @@ int udp6_seq_show(struct seq_file *seq, void *v) | |||
978 | "local_address " | 981 | "local_address " |
979 | "remote_address " | 982 | "remote_address " |
980 | "st tx_queue rx_queue tr tm->when retrnsmt" | 983 | "st tx_queue rx_queue tr tm->when retrnsmt" |
981 | " uid timeout inode\n"); | 984 | " uid timeout inode ref pointer drops\n"); |
982 | else | 985 | else |
983 | udp6_sock_seq_show(seq, v, ((struct udp_iter_state *)seq->private)->bucket); | 986 | udp6_sock_seq_show(seq, v, ((struct udp_iter_state *)seq->private)->bucket); |
984 | return 0; | 987 | return 0; |
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c index 97101dcde4c0..5bcc452a247f 100644 --- a/net/llc/af_llc.c +++ b/net/llc/af_llc.c | |||
@@ -128,10 +128,8 @@ static int llc_ui_send_data(struct sock* sk, struct sk_buff *skb, int noblock) | |||
128 | 128 | ||
129 | static void llc_ui_sk_init(struct socket *sock, struct sock *sk) | 129 | static void llc_ui_sk_init(struct socket *sock, struct sock *sk) |
130 | { | 130 | { |
131 | sock_graft(sk, sock); | ||
131 | sk->sk_type = sock->type; | 132 | sk->sk_type = sock->type; |
132 | sk->sk_sleep = &sock->wait; | ||
133 | sk->sk_socket = sock; | ||
134 | sock->sk = sk; | ||
135 | sock->ops = &llc_ui_ops; | 133 | sock->ops = &llc_ui_ops; |
136 | } | 134 | } |
137 | 135 | ||
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 195cb6dd02a0..ce06e791bf43 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -1567,7 +1567,7 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1567 | * make it big enough for everything we may ever need. | 1567 | * make it big enough for everything we may ever need. |
1568 | */ | 1568 | */ |
1569 | 1569 | ||
1570 | if (head_need > 0 || skb_header_cloned(skb)) { | 1570 | if (head_need > 0 || skb_cloned(skb)) { |
1571 | head_need += IEEE80211_ENCRYPT_HEADROOM; | 1571 | head_need += IEEE80211_ENCRYPT_HEADROOM; |
1572 | head_need += local->tx_headroom; | 1572 | head_need += local->tx_headroom; |
1573 | head_need = max_t(int, 0, head_need); | 1573 | head_need = max_t(int, 0, head_need); |
diff --git a/net/netfilter/nf_conntrack_extend.c b/net/netfilter/nf_conntrack_extend.c index ba1c4915e9eb..3469bc71a385 100644 --- a/net/netfilter/nf_conntrack_extend.c +++ b/net/netfilter/nf_conntrack_extend.c | |||
@@ -59,12 +59,19 @@ nf_ct_ext_create(struct nf_ct_ext **ext, enum nf_ct_ext_id id, gfp_t gfp) | |||
59 | if (!*ext) | 59 | if (!*ext) |
60 | return NULL; | 60 | return NULL; |
61 | 61 | ||
62 | INIT_RCU_HEAD(&(*ext)->rcu); | ||
62 | (*ext)->offset[id] = off; | 63 | (*ext)->offset[id] = off; |
63 | (*ext)->len = len; | 64 | (*ext)->len = len; |
64 | 65 | ||
65 | return (void *)(*ext) + off; | 66 | return (void *)(*ext) + off; |
66 | } | 67 | } |
67 | 68 | ||
69 | static void __nf_ct_ext_free_rcu(struct rcu_head *head) | ||
70 | { | ||
71 | struct nf_ct_ext *ext = container_of(head, struct nf_ct_ext, rcu); | ||
72 | kfree(ext); | ||
73 | } | ||
74 | |||
68 | void *__nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp) | 75 | void *__nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp) |
69 | { | 76 | { |
70 | struct nf_ct_ext *new; | 77 | struct nf_ct_ext *new; |
@@ -104,7 +111,7 @@ void *__nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp) | |||
104 | (void *)ct->ext + ct->ext->offset[i]); | 111 | (void *)ct->ext + ct->ext->offset[i]); |
105 | rcu_read_unlock(); | 112 | rcu_read_unlock(); |
106 | } | 113 | } |
107 | kfree(ct->ext); | 114 | call_rcu(&ct->ext->rcu, __nf_ct_ext_free_rcu); |
108 | ct->ext = new; | 115 | ct->ext = new; |
109 | } | 116 | } |
110 | 117 | ||
diff --git a/net/netfilter/nf_conntrack_h323_main.c b/net/netfilter/nf_conntrack_h323_main.c index 95da1a24aab7..2f83c158934d 100644 --- a/net/netfilter/nf_conntrack_h323_main.c +++ b/net/netfilter/nf_conntrack_h323_main.c | |||
@@ -619,6 +619,7 @@ static const struct nf_conntrack_expect_policy h245_exp_policy = { | |||
619 | static struct nf_conntrack_helper nf_conntrack_helper_h245 __read_mostly = { | 619 | static struct nf_conntrack_helper nf_conntrack_helper_h245 __read_mostly = { |
620 | .name = "H.245", | 620 | .name = "H.245", |
621 | .me = THIS_MODULE, | 621 | .me = THIS_MODULE, |
622 | .tuple.src.l3num = AF_UNSPEC, | ||
622 | .tuple.dst.protonum = IPPROTO_UDP, | 623 | .tuple.dst.protonum = IPPROTO_UDP, |
623 | .help = h245_help, | 624 | .help = h245_help, |
624 | .expect_policy = &h245_exp_policy, | 625 | .expect_policy = &h245_exp_policy, |
@@ -1765,6 +1766,7 @@ static void __exit nf_conntrack_h323_fini(void) | |||
1765 | nf_conntrack_helper_unregister(&nf_conntrack_helper_ras[0]); | 1766 | nf_conntrack_helper_unregister(&nf_conntrack_helper_ras[0]); |
1766 | nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[1]); | 1767 | nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[1]); |
1767 | nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[0]); | 1768 | nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[0]); |
1769 | nf_conntrack_helper_unregister(&nf_conntrack_helper_h245); | ||
1768 | kfree(h323_buffer); | 1770 | kfree(h323_buffer); |
1769 | pr_debug("nf_ct_h323: fini\n"); | 1771 | pr_debug("nf_ct_h323: fini\n"); |
1770 | } | 1772 | } |
@@ -1777,28 +1779,34 @@ static int __init nf_conntrack_h323_init(void) | |||
1777 | h323_buffer = kmalloc(65536, GFP_KERNEL); | 1779 | h323_buffer = kmalloc(65536, GFP_KERNEL); |
1778 | if (!h323_buffer) | 1780 | if (!h323_buffer) |
1779 | return -ENOMEM; | 1781 | return -ENOMEM; |
1780 | ret = nf_conntrack_helper_register(&nf_conntrack_helper_q931[0]); | 1782 | ret = nf_conntrack_helper_register(&nf_conntrack_helper_h245); |
1781 | if (ret < 0) | 1783 | if (ret < 0) |
1782 | goto err1; | 1784 | goto err1; |
1783 | ret = nf_conntrack_helper_register(&nf_conntrack_helper_q931[1]); | 1785 | ret = nf_conntrack_helper_register(&nf_conntrack_helper_q931[0]); |
1784 | if (ret < 0) | 1786 | if (ret < 0) |
1785 | goto err2; | 1787 | goto err2; |
1786 | ret = nf_conntrack_helper_register(&nf_conntrack_helper_ras[0]); | 1788 | ret = nf_conntrack_helper_register(&nf_conntrack_helper_q931[1]); |
1787 | if (ret < 0) | 1789 | if (ret < 0) |
1788 | goto err3; | 1790 | goto err3; |
1789 | ret = nf_conntrack_helper_register(&nf_conntrack_helper_ras[1]); | 1791 | ret = nf_conntrack_helper_register(&nf_conntrack_helper_ras[0]); |
1790 | if (ret < 0) | 1792 | if (ret < 0) |
1791 | goto err4; | 1793 | goto err4; |
1794 | ret = nf_conntrack_helper_register(&nf_conntrack_helper_ras[1]); | ||
1795 | if (ret < 0) | ||
1796 | goto err5; | ||
1792 | pr_debug("nf_ct_h323: init success\n"); | 1797 | pr_debug("nf_ct_h323: init success\n"); |
1793 | return 0; | 1798 | return 0; |
1794 | 1799 | ||
1795 | err4: | 1800 | err5: |
1796 | nf_conntrack_helper_unregister(&nf_conntrack_helper_ras[0]); | 1801 | nf_conntrack_helper_unregister(&nf_conntrack_helper_ras[0]); |
1797 | err3: | 1802 | err4: |
1798 | nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[1]); | 1803 | nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[1]); |
1799 | err2: | 1804 | err3: |
1800 | nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[0]); | 1805 | nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[0]); |
1806 | err2: | ||
1807 | nf_conntrack_helper_unregister(&nf_conntrack_helper_h245); | ||
1801 | err1: | 1808 | err1: |
1809 | kfree(h323_buffer); | ||
1802 | return ret; | 1810 | return ret; |
1803 | } | 1811 | } |
1804 | 1812 | ||
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index f5aa23c3e886..3e1191cecaf0 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c | |||
@@ -444,8 +444,11 @@ static int genl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
444 | if (ops->dumpit == NULL) | 444 | if (ops->dumpit == NULL) |
445 | return -EOPNOTSUPP; | 445 | return -EOPNOTSUPP; |
446 | 446 | ||
447 | return netlink_dump_start(genl_sock, skb, nlh, | 447 | genl_unlock(); |
448 | ops->dumpit, ops->done); | 448 | err = netlink_dump_start(genl_sock, skb, nlh, |
449 | ops->dumpit, ops->done); | ||
450 | genl_lock(); | ||
451 | return err; | ||
449 | } | 452 | } |
450 | 453 | ||
451 | if (ops->doit == NULL) | 454 | if (ops->doit == NULL) |
@@ -603,9 +606,6 @@ static int ctrl_dumpfamily(struct sk_buff *skb, struct netlink_callback *cb) | |||
603 | int chains_to_skip = cb->args[0]; | 606 | int chains_to_skip = cb->args[0]; |
604 | int fams_to_skip = cb->args[1]; | 607 | int fams_to_skip = cb->args[1]; |
605 | 608 | ||
606 | if (chains_to_skip != 0) | ||
607 | genl_lock(); | ||
608 | |||
609 | for (i = 0; i < GENL_FAM_TAB_SIZE; i++) { | 609 | for (i = 0; i < GENL_FAM_TAB_SIZE; i++) { |
610 | if (i < chains_to_skip) | 610 | if (i < chains_to_skip) |
611 | continue; | 611 | continue; |
@@ -623,9 +623,6 @@ static int ctrl_dumpfamily(struct sk_buff *skb, struct netlink_callback *cb) | |||
623 | } | 623 | } |
624 | 624 | ||
625 | errout: | 625 | errout: |
626 | if (chains_to_skip != 0) | ||
627 | genl_unlock(); | ||
628 | |||
629 | cb->args[0] = i; | 626 | cb->args[0] = i; |
630 | cb->args[1] = n; | 627 | cb->args[1] = n; |
631 | 628 | ||
@@ -770,7 +767,7 @@ static int __init genl_init(void) | |||
770 | 767 | ||
771 | /* we'll bump the group number right afterwards */ | 768 | /* we'll bump the group number right afterwards */ |
772 | genl_sock = netlink_kernel_create(&init_net, NETLINK_GENERIC, 0, | 769 | genl_sock = netlink_kernel_create(&init_net, NETLINK_GENERIC, 0, |
773 | genl_rcv, NULL, THIS_MODULE); | 770 | genl_rcv, &genl_mutex, THIS_MODULE); |
774 | if (genl_sock == NULL) | 771 | if (genl_sock == NULL) |
775 | panic("GENL: Cannot initialize generic netlink\n"); | 772 | panic("GENL: Cannot initialize generic netlink\n"); |
776 | 773 | ||
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index 4bae8b998cab..74884f4a6255 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c | |||
@@ -475,13 +475,11 @@ static struct sock *nr_make_new(struct sock *osk) | |||
475 | sock_init_data(NULL, sk); | 475 | sock_init_data(NULL, sk); |
476 | 476 | ||
477 | sk->sk_type = osk->sk_type; | 477 | sk->sk_type = osk->sk_type; |
478 | sk->sk_socket = osk->sk_socket; | ||
479 | sk->sk_priority = osk->sk_priority; | 478 | sk->sk_priority = osk->sk_priority; |
480 | sk->sk_protocol = osk->sk_protocol; | 479 | sk->sk_protocol = osk->sk_protocol; |
481 | sk->sk_rcvbuf = osk->sk_rcvbuf; | 480 | sk->sk_rcvbuf = osk->sk_rcvbuf; |
482 | sk->sk_sndbuf = osk->sk_sndbuf; | 481 | sk->sk_sndbuf = osk->sk_sndbuf; |
483 | sk->sk_state = TCP_ESTABLISHED; | 482 | sk->sk_state = TCP_ESTABLISHED; |
484 | sk->sk_sleep = osk->sk_sleep; | ||
485 | sock_copy_flags(sk, osk); | 483 | sock_copy_flags(sk, osk); |
486 | 484 | ||
487 | skb_queue_head_init(&nr->ack_queue); | 485 | skb_queue_head_init(&nr->ack_queue); |
@@ -538,11 +536,9 @@ static int nr_release(struct socket *sock) | |||
538 | sk->sk_state_change(sk); | 536 | sk->sk_state_change(sk); |
539 | sock_orphan(sk); | 537 | sock_orphan(sk); |
540 | sock_set_flag(sk, SOCK_DESTROY); | 538 | sock_set_flag(sk, SOCK_DESTROY); |
541 | sk->sk_socket = NULL; | ||
542 | break; | 539 | break; |
543 | 540 | ||
544 | default: | 541 | default: |
545 | sk->sk_socket = NULL; | ||
546 | break; | 542 | break; |
547 | } | 543 | } |
548 | 544 | ||
@@ -810,13 +806,11 @@ static int nr_accept(struct socket *sock, struct socket *newsock, int flags) | |||
810 | goto out_release; | 806 | goto out_release; |
811 | 807 | ||
812 | newsk = skb->sk; | 808 | newsk = skb->sk; |
813 | newsk->sk_socket = newsock; | 809 | sock_graft(newsk, newsock); |
814 | newsk->sk_sleep = &newsock->wait; | ||
815 | 810 | ||
816 | /* Now attach up the new socket */ | 811 | /* Now attach up the new socket */ |
817 | kfree_skb(skb); | 812 | kfree_skb(skb); |
818 | sk_acceptq_removed(sk); | 813 | sk_acceptq_removed(sk); |
819 | newsock->sk = newsk; | ||
820 | 814 | ||
821 | out_release: | 815 | out_release: |
822 | release_sock(sk); | 816 | release_sock(sk); |
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index 1ebf65294405..46461a69cd0f 100644 --- a/net/rose/af_rose.c +++ b/net/rose/af_rose.c | |||
@@ -566,13 +566,11 @@ static struct sock *rose_make_new(struct sock *osk) | |||
566 | #endif | 566 | #endif |
567 | 567 | ||
568 | sk->sk_type = osk->sk_type; | 568 | sk->sk_type = osk->sk_type; |
569 | sk->sk_socket = osk->sk_socket; | ||
570 | sk->sk_priority = osk->sk_priority; | 569 | sk->sk_priority = osk->sk_priority; |
571 | sk->sk_protocol = osk->sk_protocol; | 570 | sk->sk_protocol = osk->sk_protocol; |
572 | sk->sk_rcvbuf = osk->sk_rcvbuf; | 571 | sk->sk_rcvbuf = osk->sk_rcvbuf; |
573 | sk->sk_sndbuf = osk->sk_sndbuf; | 572 | sk->sk_sndbuf = osk->sk_sndbuf; |
574 | sk->sk_state = TCP_ESTABLISHED; | 573 | sk->sk_state = TCP_ESTABLISHED; |
575 | sk->sk_sleep = osk->sk_sleep; | ||
576 | sock_copy_flags(sk, osk); | 574 | sock_copy_flags(sk, osk); |
577 | 575 | ||
578 | init_timer(&rose->timer); | 576 | init_timer(&rose->timer); |
@@ -759,7 +757,7 @@ static int rose_connect(struct socket *sock, struct sockaddr *uaddr, int addr_le | |||
759 | sock->state = SS_UNCONNECTED; | 757 | sock->state = SS_UNCONNECTED; |
760 | 758 | ||
761 | rose->neighbour = rose_get_neigh(&addr->srose_addr, &cause, | 759 | rose->neighbour = rose_get_neigh(&addr->srose_addr, &cause, |
762 | &diagnostic); | 760 | &diagnostic, 0); |
763 | if (!rose->neighbour) { | 761 | if (!rose->neighbour) { |
764 | err = -ENETUNREACH; | 762 | err = -ENETUNREACH; |
765 | goto out_release; | 763 | goto out_release; |
@@ -855,7 +853,7 @@ rose_try_next_neigh: | |||
855 | 853 | ||
856 | if (sk->sk_state != TCP_ESTABLISHED) { | 854 | if (sk->sk_state != TCP_ESTABLISHED) { |
857 | /* Try next neighbour */ | 855 | /* Try next neighbour */ |
858 | rose->neighbour = rose_get_neigh(&addr->srose_addr, &cause, &diagnostic); | 856 | rose->neighbour = rose_get_neigh(&addr->srose_addr, &cause, &diagnostic, 0); |
859 | if (rose->neighbour) | 857 | if (rose->neighbour) |
860 | goto rose_try_next_neigh; | 858 | goto rose_try_next_neigh; |
861 | 859 | ||
@@ -924,14 +922,12 @@ static int rose_accept(struct socket *sock, struct socket *newsock, int flags) | |||
924 | goto out_release; | 922 | goto out_release; |
925 | 923 | ||
926 | newsk = skb->sk; | 924 | newsk = skb->sk; |
927 | newsk->sk_socket = newsock; | 925 | sock_graft(newsk, newsock); |
928 | newsk->sk_sleep = &newsock->wait; | ||
929 | 926 | ||
930 | /* Now attach up the new socket */ | 927 | /* Now attach up the new socket */ |
931 | skb->sk = NULL; | 928 | skb->sk = NULL; |
932 | kfree_skb(skb); | 929 | kfree_skb(skb); |
933 | sk->sk_ack_backlog--; | 930 | sk->sk_ack_backlog--; |
934 | newsock->sk = newsk; | ||
935 | 931 | ||
936 | out_release: | 932 | out_release: |
937 | release_sock(sk); | 933 | release_sock(sk); |
diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c index bd593871c81e..a81066a1010a 100644 --- a/net/rose/rose_route.c +++ b/net/rose/rose_route.c | |||
@@ -662,27 +662,34 @@ struct rose_route *rose_route_free_lci(unsigned int lci, struct rose_neigh *neig | |||
662 | } | 662 | } |
663 | 663 | ||
664 | /* | 664 | /* |
665 | * Find a neighbour given a ROSE address. | 665 | * Find a neighbour or a route given a ROSE address. |
666 | */ | 666 | */ |
667 | struct rose_neigh *rose_get_neigh(rose_address *addr, unsigned char *cause, | 667 | struct rose_neigh *rose_get_neigh(rose_address *addr, unsigned char *cause, |
668 | unsigned char *diagnostic) | 668 | unsigned char *diagnostic, int new) |
669 | { | 669 | { |
670 | struct rose_neigh *res = NULL; | 670 | struct rose_neigh *res = NULL; |
671 | struct rose_node *node; | 671 | struct rose_node *node; |
672 | int failed = 0; | 672 | int failed = 0; |
673 | int i; | 673 | int i; |
674 | 674 | ||
675 | spin_lock_bh(&rose_node_list_lock); | 675 | if (!new) spin_lock_bh(&rose_node_list_lock); |
676 | for (node = rose_node_list; node != NULL; node = node->next) { | 676 | for (node = rose_node_list; node != NULL; node = node->next) { |
677 | if (rosecmpm(addr, &node->address, node->mask) == 0) { | 677 | if (rosecmpm(addr, &node->address, node->mask) == 0) { |
678 | for (i = 0; i < node->count; i++) { | 678 | for (i = 0; i < node->count; i++) { |
679 | if (!rose_ftimer_running(node->neighbour[i])) { | 679 | if (new) { |
680 | res = node->neighbour[i]; | 680 | if (node->neighbour[i]->restarted) { |
681 | goto out; | 681 | res = node->neighbour[i]; |
682 | } else | 682 | goto out; |
683 | failed = 1; | 683 | } |
684 | } | ||
685 | else { | ||
686 | if (!rose_ftimer_running(node->neighbour[i])) { | ||
687 | res = node->neighbour[i]; | ||
688 | goto out; | ||
689 | } else | ||
690 | failed = 1; | ||
691 | } | ||
684 | } | 692 | } |
685 | break; | ||
686 | } | 693 | } |
687 | } | 694 | } |
688 | 695 | ||
@@ -695,7 +702,7 @@ struct rose_neigh *rose_get_neigh(rose_address *addr, unsigned char *cause, | |||
695 | } | 702 | } |
696 | 703 | ||
697 | out: | 704 | out: |
698 | spin_unlock_bh(&rose_node_list_lock); | 705 | if (!new) spin_unlock_bh(&rose_node_list_lock); |
699 | 706 | ||
700 | return res; | 707 | return res; |
701 | } | 708 | } |
@@ -1018,7 +1025,7 @@ int rose_route_frame(struct sk_buff *skb, ax25_cb *ax25) | |||
1018 | rose_route = rose_route->next; | 1025 | rose_route = rose_route->next; |
1019 | } | 1026 | } |
1020 | 1027 | ||
1021 | if ((new_neigh = rose_get_neigh(dest_addr, &cause, &diagnostic)) == NULL) { | 1028 | if ((new_neigh = rose_get_neigh(dest_addr, &cause, &diagnostic, 1)) == NULL) { |
1022 | rose_transmit_clear_request(rose_neigh, lci, cause, diagnostic); | 1029 | rose_transmit_clear_request(rose_neigh, lci, cause, diagnostic); |
1023 | goto out; | 1030 | goto out; |
1024 | } | 1031 | } |
diff --git a/net/sctp/input.c b/net/sctp/input.c index ca6b022b1df2..d354a23972d4 100644 --- a/net/sctp/input.c +++ b/net/sctp/input.c | |||
@@ -430,6 +430,9 @@ struct sock *sctp_err_lookup(int family, struct sk_buff *skb, | |||
430 | struct sock *sk = NULL; | 430 | struct sock *sk = NULL; |
431 | struct sctp_association *asoc; | 431 | struct sctp_association *asoc; |
432 | struct sctp_transport *transport = NULL; | 432 | struct sctp_transport *transport = NULL; |
433 | struct sctp_init_chunk *chunkhdr; | ||
434 | __u32 vtag = ntohl(sctphdr->vtag); | ||
435 | int len = skb->len - ((void *)sctphdr - (void *)skb->data); | ||
433 | 436 | ||
434 | *app = NULL; *tpp = NULL; | 437 | *app = NULL; *tpp = NULL; |
435 | 438 | ||
@@ -451,8 +454,28 @@ struct sock *sctp_err_lookup(int family, struct sk_buff *skb, | |||
451 | 454 | ||
452 | sk = asoc->base.sk; | 455 | sk = asoc->base.sk; |
453 | 456 | ||
454 | if (ntohl(sctphdr->vtag) != asoc->c.peer_vtag) { | 457 | /* RFC 4960, Appendix C. ICMP Handling |
455 | ICMP_INC_STATS_BH(ICMP_MIB_INERRORS); | 458 | * |
459 | * ICMP6) An implementation MUST validate that the Verification Tag | ||
460 | * contained in the ICMP message matches the Verification Tag of | ||
461 | * the peer. If the Verification Tag is not 0 and does NOT | ||
462 | * match, discard the ICMP message. If it is 0 and the ICMP | ||
463 | * message contains enough bytes to verify that the chunk type is | ||
464 | * an INIT chunk and that the Initiate Tag matches the tag of the | ||
465 | * peer, continue with ICMP7. If the ICMP message is too short | ||
466 | * or the chunk type or the Initiate Tag does not match, silently | ||
467 | * discard the packet. | ||
468 | */ | ||
469 | if (vtag == 0) { | ||
470 | chunkhdr = (struct sctp_init_chunk *)((void *)sctphdr | ||
471 | + sizeof(struct sctphdr)); | ||
472 | if (len < sizeof(struct sctphdr) + sizeof(sctp_chunkhdr_t) | ||
473 | + sizeof(__be32) || | ||
474 | chunkhdr->chunk_hdr.type != SCTP_CID_INIT || | ||
475 | ntohl(chunkhdr->init_hdr.init_tag) != asoc->c.my_vtag) { | ||
476 | goto out; | ||
477 | } | ||
478 | } else if (vtag != asoc->c.peer_vtag) { | ||
456 | goto out; | 479 | goto out; |
457 | } | 480 | } |
458 | 481 | ||
diff --git a/net/sctp/output.c b/net/sctp/output.c index 6d45bae93b46..abcd00dc05eb 100644 --- a/net/sctp/output.c +++ b/net/sctp/output.c | |||
@@ -157,7 +157,8 @@ void sctp_packet_free(struct sctp_packet *packet) | |||
157 | * packet can be sent only after receiving the COOKIE_ACK. | 157 | * packet can be sent only after receiving the COOKIE_ACK. |
158 | */ | 158 | */ |
159 | sctp_xmit_t sctp_packet_transmit_chunk(struct sctp_packet *packet, | 159 | sctp_xmit_t sctp_packet_transmit_chunk(struct sctp_packet *packet, |
160 | struct sctp_chunk *chunk) | 160 | struct sctp_chunk *chunk, |
161 | int one_packet) | ||
161 | { | 162 | { |
162 | sctp_xmit_t retval; | 163 | sctp_xmit_t retval; |
163 | int error = 0; | 164 | int error = 0; |
@@ -175,7 +176,9 @@ sctp_xmit_t sctp_packet_transmit_chunk(struct sctp_packet *packet, | |||
175 | /* If we have an empty packet, then we can NOT ever | 176 | /* If we have an empty packet, then we can NOT ever |
176 | * return PMTU_FULL. | 177 | * return PMTU_FULL. |
177 | */ | 178 | */ |
178 | retval = sctp_packet_append_chunk(packet, chunk); | 179 | if (!one_packet) |
180 | retval = sctp_packet_append_chunk(packet, | ||
181 | chunk); | ||
179 | } | 182 | } |
180 | break; | 183 | break; |
181 | 184 | ||
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c index ace6770e9048..70ead8dc3485 100644 --- a/net/sctp/outqueue.c +++ b/net/sctp/outqueue.c | |||
@@ -702,6 +702,7 @@ int sctp_outq_uncork(struct sctp_outq *q) | |||
702 | return error; | 702 | return error; |
703 | } | 703 | } |
704 | 704 | ||
705 | |||
705 | /* | 706 | /* |
706 | * Try to flush an outqueue. | 707 | * Try to flush an outqueue. |
707 | * | 708 | * |
@@ -725,6 +726,7 @@ int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout) | |||
725 | sctp_xmit_t status; | 726 | sctp_xmit_t status; |
726 | int error = 0; | 727 | int error = 0; |
727 | int start_timer = 0; | 728 | int start_timer = 0; |
729 | int one_packet = 0; | ||
728 | 730 | ||
729 | /* These transports have chunks to send. */ | 731 | /* These transports have chunks to send. */ |
730 | struct list_head transport_list; | 732 | struct list_head transport_list; |
@@ -830,20 +832,33 @@ int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout) | |||
830 | if (sctp_test_T_bit(chunk)) { | 832 | if (sctp_test_T_bit(chunk)) { |
831 | packet->vtag = asoc->c.my_vtag; | 833 | packet->vtag = asoc->c.my_vtag; |
832 | } | 834 | } |
833 | case SCTP_CID_SACK: | 835 | /* The following chunks are "response" chunks, i.e. |
834 | case SCTP_CID_HEARTBEAT: | 836 | * they are generated in response to something we |
837 | * received. If we are sending these, then we can | ||
838 | * send only 1 packet containing these chunks. | ||
839 | */ | ||
835 | case SCTP_CID_HEARTBEAT_ACK: | 840 | case SCTP_CID_HEARTBEAT_ACK: |
836 | case SCTP_CID_SHUTDOWN: | ||
837 | case SCTP_CID_SHUTDOWN_ACK: | 841 | case SCTP_CID_SHUTDOWN_ACK: |
838 | case SCTP_CID_ERROR: | ||
839 | case SCTP_CID_COOKIE_ECHO: | ||
840 | case SCTP_CID_COOKIE_ACK: | 842 | case SCTP_CID_COOKIE_ACK: |
841 | case SCTP_CID_ECN_ECNE: | 843 | case SCTP_CID_COOKIE_ECHO: |
844 | case SCTP_CID_ERROR: | ||
842 | case SCTP_CID_ECN_CWR: | 845 | case SCTP_CID_ECN_CWR: |
843 | case SCTP_CID_ASCONF: | ||
844 | case SCTP_CID_ASCONF_ACK: | 846 | case SCTP_CID_ASCONF_ACK: |
847 | one_packet = 1; | ||
848 | /* Fall throught */ | ||
849 | |||
850 | case SCTP_CID_SACK: | ||
851 | case SCTP_CID_HEARTBEAT: | ||
852 | case SCTP_CID_SHUTDOWN: | ||
853 | case SCTP_CID_ECN_ECNE: | ||
854 | case SCTP_CID_ASCONF: | ||
845 | case SCTP_CID_FWD_TSN: | 855 | case SCTP_CID_FWD_TSN: |
846 | sctp_packet_transmit_chunk(packet, chunk); | 856 | status = sctp_packet_transmit_chunk(packet, chunk, |
857 | one_packet); | ||
858 | if (status != SCTP_XMIT_OK) { | ||
859 | /* put the chunk back */ | ||
860 | list_add(&chunk->list, &q->control_chunk_list); | ||
861 | } | ||
847 | break; | 862 | break; |
848 | 863 | ||
849 | default: | 864 | default: |
@@ -974,7 +989,7 @@ int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout) | |||
974 | atomic_read(&chunk->skb->users) : -1); | 989 | atomic_read(&chunk->skb->users) : -1); |
975 | 990 | ||
976 | /* Add the chunk to the packet. */ | 991 | /* Add the chunk to the packet. */ |
977 | status = sctp_packet_transmit_chunk(packet, chunk); | 992 | status = sctp_packet_transmit_chunk(packet, chunk, 0); |
978 | 993 | ||
979 | switch (status) { | 994 | switch (status) { |
980 | case SCTP_XMIT_PMTU_FULL: | 995 | case SCTP_XMIT_PMTU_FULL: |
@@ -1239,7 +1254,6 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_sackhdr *sack) | |||
1239 | * Make sure the empty queue handler will get run later. | 1254 | * Make sure the empty queue handler will get run later. |
1240 | */ | 1255 | */ |
1241 | q->empty = (list_empty(&q->out_chunk_list) && | 1256 | q->empty = (list_empty(&q->out_chunk_list) && |
1242 | list_empty(&q->control_chunk_list) && | ||
1243 | list_empty(&q->retransmit)); | 1257 | list_empty(&q->retransmit)); |
1244 | if (!q->empty) | 1258 | if (!q->empty) |
1245 | goto finish; | 1259 | goto finish; |
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 23aaffb97ca3..98c6a882016a 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -119,7 +119,7 @@ static __init int sctp_proc_init(void) | |||
119 | return 0; | 119 | return 0; |
120 | 120 | ||
121 | out_remaddr_proc_init: | 121 | out_remaddr_proc_init: |
122 | sctp_remaddr_proc_exit(); | 122 | sctp_assocs_proc_exit(); |
123 | out_assocs_proc_init: | 123 | out_assocs_proc_init: |
124 | sctp_eps_proc_exit(); | 124 | sctp_eps_proc_exit(); |
125 | out_eps_proc_init: | 125 | out_eps_proc_init: |
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c index b083312c725a..9732c797e8ed 100644 --- a/net/sctp/sm_sideeffect.c +++ b/net/sctp/sm_sideeffect.c | |||
@@ -664,7 +664,7 @@ static int sctp_cmd_process_sack(sctp_cmd_seq_t *cmds, | |||
664 | struct sctp_association *asoc, | 664 | struct sctp_association *asoc, |
665 | struct sctp_sackhdr *sackh) | 665 | struct sctp_sackhdr *sackh) |
666 | { | 666 | { |
667 | int err; | 667 | int err = 0; |
668 | 668 | ||
669 | if (sctp_outq_sack(&asoc->outqueue, sackh)) { | 669 | if (sctp_outq_sack(&asoc->outqueue, sackh)) { |
670 | /* There are no more TSNs awaiting SACK. */ | 670 | /* There are no more TSNs awaiting SACK. */ |
@@ -672,11 +672,6 @@ static int sctp_cmd_process_sack(sctp_cmd_seq_t *cmds, | |||
672 | SCTP_ST_OTHER(SCTP_EVENT_NO_PENDING_TSN), | 672 | SCTP_ST_OTHER(SCTP_EVENT_NO_PENDING_TSN), |
673 | asoc->state, asoc->ep, asoc, NULL, | 673 | asoc->state, asoc->ep, asoc, NULL, |
674 | GFP_ATOMIC); | 674 | GFP_ATOMIC); |
675 | } else { | ||
676 | /* Windows may have opened, so we need | ||
677 | * to check if we have DATA to transmit | ||
678 | */ | ||
679 | err = sctp_outq_flush(&asoc->outqueue, 0); | ||
680 | } | 675 | } |
681 | 676 | ||
682 | return err; | 677 | return err; |
@@ -1481,8 +1476,15 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, | |||
1481 | break; | 1476 | break; |
1482 | 1477 | ||
1483 | case SCTP_CMD_DISCARD_PACKET: | 1478 | case SCTP_CMD_DISCARD_PACKET: |
1484 | /* We need to discard the whole packet. */ | 1479 | /* We need to discard the whole packet. |
1480 | * Uncork the queue since there might be | ||
1481 | * responses pending | ||
1482 | */ | ||
1485 | chunk->pdiscard = 1; | 1483 | chunk->pdiscard = 1; |
1484 | if (asoc) { | ||
1485 | sctp_outq_uncork(&asoc->outqueue); | ||
1486 | local_cork = 0; | ||
1487 | } | ||
1486 | break; | 1488 | break; |
1487 | 1489 | ||
1488 | case SCTP_CMD_RTO_PENDING: | 1490 | case SCTP_CMD_RTO_PENDING: |
@@ -1553,8 +1555,15 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, | |||
1553 | } | 1555 | } |
1554 | 1556 | ||
1555 | out: | 1557 | out: |
1556 | if (local_cork) | 1558 | /* If this is in response to a received chunk, wait until |
1557 | sctp_outq_uncork(&asoc->outqueue); | 1559 | * we are done with the packet to open the queue so that we don't |
1560 | * send multiple packets in response to a single request. | ||
1561 | */ | ||
1562 | if (asoc && SCTP_EVENT_T_CHUNK == event_type && chunk) { | ||
1563 | if (chunk->end_of_packet || chunk->singleton) | ||
1564 | sctp_outq_uncork(&asoc->outqueue); | ||
1565 | } else if (local_cork) | ||
1566 | sctp_outq_uncork(&asoc->outqueue); | ||
1558 | return error; | 1567 | return error; |
1559 | nomem: | 1568 | nomem: |
1560 | error = -ENOMEM; | 1569 | error = -ENOMEM; |
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index 0c9d5a6950fe..b66a41d03c0d 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
@@ -795,8 +795,6 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(const struct sctp_endpoint *ep, | |||
795 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_START, | 795 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_START, |
796 | SCTP_TO(SCTP_EVENT_TIMEOUT_AUTOCLOSE)); | 796 | SCTP_TO(SCTP_EVENT_TIMEOUT_AUTOCLOSE)); |
797 | 797 | ||
798 | sctp_add_cmd_sf(commands, SCTP_CMD_TRANSMIT, SCTP_NULL()); | ||
799 | |||
800 | /* This will send the COOKIE ACK */ | 798 | /* This will send the COOKIE ACK */ |
801 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl)); | 799 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl)); |
802 | 800 | ||
@@ -883,7 +881,6 @@ sctp_disposition_t sctp_sf_do_5_1E_ca(const struct sctp_endpoint *ep, | |||
883 | if (asoc->autoclose) | 881 | if (asoc->autoclose) |
884 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_START, | 882 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_START, |
885 | SCTP_TO(SCTP_EVENT_TIMEOUT_AUTOCLOSE)); | 883 | SCTP_TO(SCTP_EVENT_TIMEOUT_AUTOCLOSE)); |
886 | sctp_add_cmd_sf(commands, SCTP_CMD_TRANSMIT, SCTP_NULL()); | ||
887 | 884 | ||
888 | /* It may also notify its ULP about the successful | 885 | /* It may also notify its ULP about the successful |
889 | * establishment of the association with a Communication Up | 886 | * establishment of the association with a Communication Up |
@@ -1781,7 +1778,6 @@ static sctp_disposition_t sctp_sf_do_dupcook_b(const struct sctp_endpoint *ep, | |||
1781 | goto nomem; | 1778 | goto nomem; |
1782 | 1779 | ||
1783 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl)); | 1780 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl)); |
1784 | sctp_add_cmd_sf(commands, SCTP_CMD_TRANSMIT, SCTP_NULL()); | ||
1785 | 1781 | ||
1786 | /* RFC 2960 5.1 Normal Establishment of an Association | 1782 | /* RFC 2960 5.1 Normal Establishment of an Association |
1787 | * | 1783 | * |
@@ -1898,12 +1894,13 @@ static sctp_disposition_t sctp_sf_do_dupcook_d(const struct sctp_endpoint *ep, | |||
1898 | 1894 | ||
1899 | } | 1895 | } |
1900 | } | 1896 | } |
1901 | sctp_add_cmd_sf(commands, SCTP_CMD_TRANSMIT, SCTP_NULL()); | ||
1902 | 1897 | ||
1903 | repl = sctp_make_cookie_ack(new_asoc, chunk); | 1898 | repl = sctp_make_cookie_ack(new_asoc, chunk); |
1904 | if (!repl) | 1899 | if (!repl) |
1905 | goto nomem; | 1900 | goto nomem; |
1906 | 1901 | ||
1902 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl)); | ||
1903 | |||
1907 | if (ev) | 1904 | if (ev) |
1908 | sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, | 1905 | sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, |
1909 | SCTP_ULPEVENT(ev)); | 1906 | SCTP_ULPEVENT(ev)); |
@@ -1911,9 +1908,6 @@ static sctp_disposition_t sctp_sf_do_dupcook_d(const struct sctp_endpoint *ep, | |||
1911 | sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, | 1908 | sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, |
1912 | SCTP_ULPEVENT(ai_ev)); | 1909 | SCTP_ULPEVENT(ai_ev)); |
1913 | 1910 | ||
1914 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl)); | ||
1915 | sctp_add_cmd_sf(commands, SCTP_CMD_TRANSMIT, SCTP_NULL()); | ||
1916 | |||
1917 | return SCTP_DISPOSITION_CONSUME; | 1911 | return SCTP_DISPOSITION_CONSUME; |
1918 | 1912 | ||
1919 | nomem: | 1913 | nomem: |
@@ -3970,9 +3964,6 @@ sctp_disposition_t sctp_sf_unk_chunk(const struct sctp_endpoint *ep, | |||
3970 | return sctp_sf_pdiscard(ep, asoc, type, arg, commands); | 3964 | return sctp_sf_pdiscard(ep, asoc, type, arg, commands); |
3971 | break; | 3965 | break; |
3972 | case SCTP_CID_ACTION_DISCARD_ERR: | 3966 | case SCTP_CID_ACTION_DISCARD_ERR: |
3973 | /* Discard the packet. */ | ||
3974 | sctp_sf_pdiscard(ep, asoc, type, arg, commands); | ||
3975 | |||
3976 | /* Generate an ERROR chunk as response. */ | 3967 | /* Generate an ERROR chunk as response. */ |
3977 | hdr = unk_chunk->chunk_hdr; | 3968 | hdr = unk_chunk->chunk_hdr; |
3978 | err_chunk = sctp_make_op_error(asoc, unk_chunk, | 3969 | err_chunk = sctp_make_op_error(asoc, unk_chunk, |
@@ -3982,6 +3973,9 @@ sctp_disposition_t sctp_sf_unk_chunk(const struct sctp_endpoint *ep, | |||
3982 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, | 3973 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, |
3983 | SCTP_CHUNK(err_chunk)); | 3974 | SCTP_CHUNK(err_chunk)); |
3984 | } | 3975 | } |
3976 | |||
3977 | /* Discard the packet. */ | ||
3978 | sctp_sf_pdiscard(ep, asoc, type, arg, commands); | ||
3985 | return SCTP_DISPOSITION_CONSUME; | 3979 | return SCTP_DISPOSITION_CONSUME; |
3986 | break; | 3980 | break; |
3987 | case SCTP_CID_ACTION_SKIP: | 3981 | case SCTP_CID_ACTION_SKIP: |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 392e80e3268d..b4280490cf6e 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -167,6 +167,11 @@ static inline int unix_may_send(struct sock *sk, struct sock *osk) | |||
167 | return (unix_peer(osk) == NULL || unix_our_peer(sk, osk)); | 167 | return (unix_peer(osk) == NULL || unix_our_peer(sk, osk)); |
168 | } | 168 | } |
169 | 169 | ||
170 | static inline int unix_recvq_full(struct sock const *sk) | ||
171 | { | ||
172 | return skb_queue_len(&sk->sk_receive_queue) > sk->sk_max_ack_backlog; | ||
173 | } | ||
174 | |||
170 | static struct sock *unix_peer_get(struct sock *s) | 175 | static struct sock *unix_peer_get(struct sock *s) |
171 | { | 176 | { |
172 | struct sock *peer; | 177 | struct sock *peer; |
@@ -480,6 +485,8 @@ static int unix_socketpair(struct socket *, struct socket *); | |||
480 | static int unix_accept(struct socket *, struct socket *, int); | 485 | static int unix_accept(struct socket *, struct socket *, int); |
481 | static int unix_getname(struct socket *, struct sockaddr *, int *, int); | 486 | static int unix_getname(struct socket *, struct sockaddr *, int *, int); |
482 | static unsigned int unix_poll(struct file *, struct socket *, poll_table *); | 487 | static unsigned int unix_poll(struct file *, struct socket *, poll_table *); |
488 | static unsigned int unix_datagram_poll(struct file *, struct socket *, | ||
489 | poll_table *); | ||
483 | static int unix_ioctl(struct socket *, unsigned int, unsigned long); | 490 | static int unix_ioctl(struct socket *, unsigned int, unsigned long); |
484 | static int unix_shutdown(struct socket *, int); | 491 | static int unix_shutdown(struct socket *, int); |
485 | static int unix_stream_sendmsg(struct kiocb *, struct socket *, | 492 | static int unix_stream_sendmsg(struct kiocb *, struct socket *, |
@@ -525,7 +532,7 @@ static const struct proto_ops unix_dgram_ops = { | |||
525 | .socketpair = unix_socketpair, | 532 | .socketpair = unix_socketpair, |
526 | .accept = sock_no_accept, | 533 | .accept = sock_no_accept, |
527 | .getname = unix_getname, | 534 | .getname = unix_getname, |
528 | .poll = datagram_poll, | 535 | .poll = unix_datagram_poll, |
529 | .ioctl = unix_ioctl, | 536 | .ioctl = unix_ioctl, |
530 | .listen = sock_no_listen, | 537 | .listen = sock_no_listen, |
531 | .shutdown = unix_shutdown, | 538 | .shutdown = unix_shutdown, |
@@ -546,7 +553,7 @@ static const struct proto_ops unix_seqpacket_ops = { | |||
546 | .socketpair = unix_socketpair, | 553 | .socketpair = unix_socketpair, |
547 | .accept = unix_accept, | 554 | .accept = unix_accept, |
548 | .getname = unix_getname, | 555 | .getname = unix_getname, |
549 | .poll = datagram_poll, | 556 | .poll = unix_datagram_poll, |
550 | .ioctl = unix_ioctl, | 557 | .ioctl = unix_ioctl, |
551 | .listen = unix_listen, | 558 | .listen = unix_listen, |
552 | .shutdown = unix_shutdown, | 559 | .shutdown = unix_shutdown, |
@@ -981,8 +988,7 @@ static long unix_wait_for_peer(struct sock *other, long timeo) | |||
981 | 988 | ||
982 | sched = !sock_flag(other, SOCK_DEAD) && | 989 | sched = !sock_flag(other, SOCK_DEAD) && |
983 | !(other->sk_shutdown & RCV_SHUTDOWN) && | 990 | !(other->sk_shutdown & RCV_SHUTDOWN) && |
984 | (skb_queue_len(&other->sk_receive_queue) > | 991 | unix_recvq_full(other); |
985 | other->sk_max_ack_backlog); | ||
986 | 992 | ||
987 | unix_state_unlock(other); | 993 | unix_state_unlock(other); |
988 | 994 | ||
@@ -1056,8 +1062,7 @@ restart: | |||
1056 | if (other->sk_state != TCP_LISTEN) | 1062 | if (other->sk_state != TCP_LISTEN) |
1057 | goto out_unlock; | 1063 | goto out_unlock; |
1058 | 1064 | ||
1059 | if (skb_queue_len(&other->sk_receive_queue) > | 1065 | if (unix_recvq_full(other)) { |
1060 | other->sk_max_ack_backlog) { | ||
1061 | err = -EAGAIN; | 1066 | err = -EAGAIN; |
1062 | if (!timeo) | 1067 | if (!timeo) |
1063 | goto out_unlock; | 1068 | goto out_unlock; |
@@ -1426,9 +1431,7 @@ restart: | |||
1426 | goto out_unlock; | 1431 | goto out_unlock; |
1427 | } | 1432 | } |
1428 | 1433 | ||
1429 | if (unix_peer(other) != sk && | 1434 | if (unix_peer(other) != sk && unix_recvq_full(other)) { |
1430 | (skb_queue_len(&other->sk_receive_queue) > | ||
1431 | other->sk_max_ack_backlog)) { | ||
1432 | if (!timeo) { | 1435 | if (!timeo) { |
1433 | err = -EAGAIN; | 1436 | err = -EAGAIN; |
1434 | goto out_unlock; | 1437 | goto out_unlock; |
@@ -1989,6 +1992,64 @@ static unsigned int unix_poll(struct file * file, struct socket *sock, poll_tabl | |||
1989 | return mask; | 1992 | return mask; |
1990 | } | 1993 | } |
1991 | 1994 | ||
1995 | static unsigned int unix_datagram_poll(struct file *file, struct socket *sock, | ||
1996 | poll_table *wait) | ||
1997 | { | ||
1998 | struct sock *sk = sock->sk, *peer; | ||
1999 | unsigned int mask; | ||
2000 | |||
2001 | poll_wait(file, sk->sk_sleep, wait); | ||
2002 | |||
2003 | peer = unix_peer_get(sk); | ||
2004 | if (peer) { | ||
2005 | if (peer != sk) { | ||
2006 | /* | ||
2007 | * Writability of a connected socket additionally | ||
2008 | * depends on the state of the receive queue of the | ||
2009 | * peer. | ||
2010 | */ | ||
2011 | poll_wait(file, &unix_sk(peer)->peer_wait, wait); | ||
2012 | } else { | ||
2013 | sock_put(peer); | ||
2014 | peer = NULL; | ||
2015 | } | ||
2016 | } | ||
2017 | |||
2018 | mask = 0; | ||
2019 | |||
2020 | /* exceptional events? */ | ||
2021 | if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) | ||
2022 | mask |= POLLERR; | ||
2023 | if (sk->sk_shutdown & RCV_SHUTDOWN) | ||
2024 | mask |= POLLRDHUP; | ||
2025 | if (sk->sk_shutdown == SHUTDOWN_MASK) | ||
2026 | mask |= POLLHUP; | ||
2027 | |||
2028 | /* readable? */ | ||
2029 | if (!skb_queue_empty(&sk->sk_receive_queue) || | ||
2030 | (sk->sk_shutdown & RCV_SHUTDOWN)) | ||
2031 | mask |= POLLIN | POLLRDNORM; | ||
2032 | |||
2033 | /* Connection-based need to check for termination and startup */ | ||
2034 | if (sk->sk_type == SOCK_SEQPACKET) { | ||
2035 | if (sk->sk_state == TCP_CLOSE) | ||
2036 | mask |= POLLHUP; | ||
2037 | /* connection hasn't started yet? */ | ||
2038 | if (sk->sk_state == TCP_SYN_SENT) | ||
2039 | return mask; | ||
2040 | } | ||
2041 | |||
2042 | /* writable? */ | ||
2043 | if (unix_writable(sk) && !(peer && unix_recvq_full(peer))) | ||
2044 | mask |= POLLOUT | POLLWRNORM | POLLWRBAND; | ||
2045 | else | ||
2046 | set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags); | ||
2047 | |||
2048 | if (peer) | ||
2049 | sock_put(peer); | ||
2050 | |||
2051 | return mask; | ||
2052 | } | ||
1992 | 2053 | ||
1993 | #ifdef CONFIG_PROC_FS | 2054 | #ifdef CONFIG_PROC_FS |
1994 | static struct sock *first_unix_socket(int *i) | 2055 | static struct sock *first_unix_socket(int *i) |
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index 6ba67c523c16..7b1c6ef04553 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c | |||
@@ -555,13 +555,11 @@ static struct sock *x25_make_new(struct sock *osk) | |||
555 | x25 = x25_sk(sk); | 555 | x25 = x25_sk(sk); |
556 | 556 | ||
557 | sk->sk_type = osk->sk_type; | 557 | sk->sk_type = osk->sk_type; |
558 | sk->sk_socket = osk->sk_socket; | ||
559 | sk->sk_priority = osk->sk_priority; | 558 | sk->sk_priority = osk->sk_priority; |
560 | sk->sk_protocol = osk->sk_protocol; | 559 | sk->sk_protocol = osk->sk_protocol; |
561 | sk->sk_rcvbuf = osk->sk_rcvbuf; | 560 | sk->sk_rcvbuf = osk->sk_rcvbuf; |
562 | sk->sk_sndbuf = osk->sk_sndbuf; | 561 | sk->sk_sndbuf = osk->sk_sndbuf; |
563 | sk->sk_state = TCP_ESTABLISHED; | 562 | sk->sk_state = TCP_ESTABLISHED; |
564 | sk->sk_sleep = osk->sk_sleep; | ||
565 | sk->sk_backlog_rcv = osk->sk_backlog_rcv; | 563 | sk->sk_backlog_rcv = osk->sk_backlog_rcv; |
566 | sock_copy_flags(sk, osk); | 564 | sock_copy_flags(sk, osk); |
567 | 565 | ||
@@ -614,8 +612,7 @@ static int x25_release(struct socket *sock) | |||
614 | break; | 612 | break; |
615 | } | 613 | } |
616 | 614 | ||
617 | sock->sk = NULL; | 615 | sock_orphan(sk); |
618 | sk->sk_socket = NULL; /* Not used, but we should do this */ | ||
619 | out: | 616 | out: |
620 | return 0; | 617 | return 0; |
621 | } | 618 | } |
@@ -808,14 +805,12 @@ static int x25_accept(struct socket *sock, struct socket *newsock, int flags) | |||
808 | if (!skb->sk) | 805 | if (!skb->sk) |
809 | goto out2; | 806 | goto out2; |
810 | newsk = skb->sk; | 807 | newsk = skb->sk; |
811 | newsk->sk_socket = newsock; | 808 | sock_graft(newsk, newsock); |
812 | newsk->sk_sleep = &newsock->wait; | ||
813 | 809 | ||
814 | /* Now attach up the new socket */ | 810 | /* Now attach up the new socket */ |
815 | skb->sk = NULL; | 811 | skb->sk = NULL; |
816 | kfree_skb(skb); | 812 | kfree_skb(skb); |
817 | sk->sk_ack_backlog--; | 813 | sk->sk_ack_backlog--; |
818 | newsock->sk = newsk; | ||
819 | newsock->state = SS_CONNECTED; | 814 | newsock->state = SS_CONNECTED; |
820 | rc = 0; | 815 | rc = 0; |
821 | out2: | 816 | out2: |