diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-31 18:51:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-31 18:51:00 -0400 |
commit | 0d6caa1795090bd22ede96b84daa4600b63eee37 (patch) | |
tree | 7b69aa68f7f812bd1a13b0c5e73573a01e671ef8 /net | |
parent | 88c8199b9d2f5ec0a8468a0495ba4c9656846500 (diff) | |
parent | 8072f085d79a0a73cc5a0333ffa7f0c5d35f76e0 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (41 commits)
[RTNETLINK]: Fix warning for !CONFIG_KMOD
[IPV4] ip_options.c: kmalloc + memset conversion to kzalloc
[DECNET]: kmalloc + memset conversion to kzalloc
[NET]: ethtool_perm_addr only has one implementation
[NET]: ethtool ops are the only way
[PPPOE]: Improve hashing function in hash_item().
[XFRM]: State selection update to use inner addresses.
[IPSEC]: Ensure that state inner family is set
[TCP]: Bidir flow must not disregard SACK blocks for lost marking
[TCP]: Fix ratehalving with bidirectional flows
[PPPOL2TP]: Add CONFIG_INET Kconfig dependency.
[NET]: Page offsets and lengths need to be __u32.
[AF_UNIX]: Make code static.
[NETFILTER]: Make nf_ct_ipv6_skip_exthdr() static.
[PKTGEN]: make get_ipsec_sa() static and non-inline
[PPPoE]: move lock_sock() in pppoe_sendmsg() to the right location
[PPPoX/E]: return ENOTTY on unknown ioctl requests
[IPV6]: ipv6_addr_type() doesn't know about RFC4193 addresses.
[NET]: Fix prio_tune() handling of root qdisc.
[NET]: Fix sch_api to properly set sch->parent on the root.
...
Diffstat (limited to 'net')
35 files changed, 363 insertions, 288 deletions
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 4d2aa4dd42ac..4bab322c9f8f 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c | |||
@@ -668,9 +668,6 @@ int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
668 | if (real_dev->do_ioctl && netif_device_present(real_dev)) | 668 | if (real_dev->do_ioctl && netif_device_present(real_dev)) |
669 | err = real_dev->do_ioctl(real_dev, &ifrr, cmd); | 669 | err = real_dev->do_ioctl(real_dev, &ifrr, cmd); |
670 | break; | 670 | break; |
671 | |||
672 | case SIOCETHTOOL: | ||
673 | err = dev_ethtool(&ifrr); | ||
674 | } | 671 | } |
675 | 672 | ||
676 | if (!err) | 673 | if (!err) |
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 670ff95ca64b..c4e4ce4ebb2b 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
@@ -353,7 +353,7 @@ static inline int l2cap_send_cmd(struct l2cap_conn *conn, u8 ident, u8 code, u16 | |||
353 | } | 353 | } |
354 | 354 | ||
355 | /* ---- Socket interface ---- */ | 355 | /* ---- Socket interface ---- */ |
356 | static struct sock *__l2cap_get_sock_by_addr(u16 psm, bdaddr_t *src) | 356 | static struct sock *__l2cap_get_sock_by_addr(__le16 psm, bdaddr_t *src) |
357 | { | 357 | { |
358 | struct sock *sk; | 358 | struct sock *sk; |
359 | struct hlist_node *node; | 359 | struct hlist_node *node; |
@@ -368,7 +368,7 @@ found: | |||
368 | /* Find socket with psm and source bdaddr. | 368 | /* Find socket with psm and source bdaddr. |
369 | * Returns closest match. | 369 | * Returns closest match. |
370 | */ | 370 | */ |
371 | static struct sock *__l2cap_get_sock_by_psm(int state, u16 psm, bdaddr_t *src) | 371 | static struct sock *__l2cap_get_sock_by_psm(int state, __le16 psm, bdaddr_t *src) |
372 | { | 372 | { |
373 | struct sock *sk = NULL, *sk1 = NULL; | 373 | struct sock *sk = NULL, *sk1 = NULL; |
374 | struct hlist_node *node; | 374 | struct hlist_node *node; |
@@ -392,7 +392,7 @@ static struct sock *__l2cap_get_sock_by_psm(int state, u16 psm, bdaddr_t *src) | |||
392 | 392 | ||
393 | /* Find socket with given address (psm, src). | 393 | /* Find socket with given address (psm, src). |
394 | * Returns locked socket */ | 394 | * Returns locked socket */ |
395 | static inline struct sock *l2cap_get_sock_by_psm(int state, u16 psm, bdaddr_t *src) | 395 | static inline struct sock *l2cap_get_sock_by_psm(int state, __le16 psm, bdaddr_t *src) |
396 | { | 396 | { |
397 | struct sock *s; | 397 | struct sock *s; |
398 | read_lock(&l2cap_sk_list.lock); | 398 | read_lock(&l2cap_sk_list.lock); |
@@ -586,7 +586,7 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_ | |||
586 | goto done; | 586 | goto done; |
587 | } | 587 | } |
588 | 588 | ||
589 | if (la->l2_psm > 0 && btohs(la->l2_psm) < 0x1001 && | 589 | if (la->l2_psm && btohs(la->l2_psm) < 0x1001 && |
590 | !capable(CAP_NET_BIND_SERVICE)) { | 590 | !capable(CAP_NET_BIND_SERVICE)) { |
591 | err = -EACCES; | 591 | err = -EACCES; |
592 | goto done; | 592 | goto done; |
@@ -748,7 +748,7 @@ static int l2cap_sock_listen(struct socket *sock, int backlog) | |||
748 | write_lock_bh(&l2cap_sk_list.lock); | 748 | write_lock_bh(&l2cap_sk_list.lock); |
749 | 749 | ||
750 | for (psm = 0x1001; psm < 0x1100; psm += 2) | 750 | for (psm = 0x1001; psm < 0x1100; psm += 2) |
751 | if (!__l2cap_get_sock_by_addr(psm, src)) { | 751 | if (!__l2cap_get_sock_by_addr(htobs(psm), src)) { |
752 | l2cap_pi(sk)->psm = htobs(psm); | 752 | l2cap_pi(sk)->psm = htobs(psm); |
753 | l2cap_pi(sk)->sport = htobs(psm); | 753 | l2cap_pi(sk)->sport = htobs(psm); |
754 | err = 0; | 754 | err = 0; |
@@ -873,7 +873,7 @@ static inline int l2cap_do_send(struct sock *sk, struct msghdr *msg, int len) | |||
873 | lh->len = cpu_to_le16(len + (hlen - L2CAP_HDR_SIZE)); | 873 | lh->len = cpu_to_le16(len + (hlen - L2CAP_HDR_SIZE)); |
874 | 874 | ||
875 | if (sk->sk_type == SOCK_DGRAM) | 875 | if (sk->sk_type == SOCK_DGRAM) |
876 | put_unaligned(l2cap_pi(sk)->psm, (u16 *) skb_put(skb, 2)); | 876 | put_unaligned(l2cap_pi(sk)->psm, (__le16 *) skb_put(skb, 2)); |
877 | 877 | ||
878 | if (memcpy_fromiovec(skb_put(skb, count), msg->msg_iov, count)) { | 878 | if (memcpy_fromiovec(skb_put(skb, count), msg->msg_iov, count)) { |
879 | err = -EFAULT; | 879 | err = -EFAULT; |
@@ -1256,11 +1256,11 @@ static inline int l2cap_get_conf_opt(void **ptr, int *type, int *olen, unsigned | |||
1256 | break; | 1256 | break; |
1257 | 1257 | ||
1258 | case 2: | 1258 | case 2: |
1259 | *val = __le16_to_cpu(*((u16 *)opt->val)); | 1259 | *val = __le16_to_cpu(*((__le16 *)opt->val)); |
1260 | break; | 1260 | break; |
1261 | 1261 | ||
1262 | case 4: | 1262 | case 4: |
1263 | *val = __le32_to_cpu(*((u32 *)opt->val)); | 1263 | *val = __le32_to_cpu(*((__le32 *)opt->val)); |
1264 | break; | 1264 | break; |
1265 | 1265 | ||
1266 | default: | 1266 | default: |
@@ -1287,11 +1287,11 @@ static void l2cap_add_conf_opt(void **ptr, u8 type, u8 len, unsigned long val) | |||
1287 | break; | 1287 | break; |
1288 | 1288 | ||
1289 | case 2: | 1289 | case 2: |
1290 | *((u16 *) opt->val) = cpu_to_le16(val); | 1290 | *((__le16 *) opt->val) = cpu_to_le16(val); |
1291 | break; | 1291 | break; |
1292 | 1292 | ||
1293 | case 4: | 1293 | case 4: |
1294 | *((u32 *) opt->val) = cpu_to_le32(val); | 1294 | *((__le32 *) opt->val) = cpu_to_le32(val); |
1295 | break; | 1295 | break; |
1296 | 1296 | ||
1297 | default: | 1297 | default: |
@@ -1406,7 +1406,7 @@ static inline int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hd | |||
1406 | int result = 0, status = 0; | 1406 | int result = 0, status = 0; |
1407 | 1407 | ||
1408 | u16 dcid = 0, scid = __le16_to_cpu(req->scid); | 1408 | u16 dcid = 0, scid = __le16_to_cpu(req->scid); |
1409 | u16 psm = req->psm; | 1409 | __le16 psm = req->psm; |
1410 | 1410 | ||
1411 | BT_DBG("psm 0x%2.2x scid 0x%4.4x", psm, scid); | 1411 | BT_DBG("psm 0x%2.2x scid 0x%4.4x", psm, scid); |
1412 | 1412 | ||
@@ -1530,7 +1530,7 @@ static inline int l2cap_connect_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hd | |||
1530 | return 0; | 1530 | return 0; |
1531 | } | 1531 | } |
1532 | 1532 | ||
1533 | static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data) | 1533 | static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u16 cmd_len, u8 *data) |
1534 | { | 1534 | { |
1535 | struct l2cap_conf_req *req = (struct l2cap_conf_req *) data; | 1535 | struct l2cap_conf_req *req = (struct l2cap_conf_req *) data; |
1536 | u16 dcid, flags; | 1536 | u16 dcid, flags; |
@@ -1550,7 +1550,7 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr | |||
1550 | goto unlock; | 1550 | goto unlock; |
1551 | 1551 | ||
1552 | /* Reject if config buffer is too small. */ | 1552 | /* Reject if config buffer is too small. */ |
1553 | len = cmd->len - sizeof(*req); | 1553 | len = cmd_len - sizeof(*req); |
1554 | if (l2cap_pi(sk)->conf_len + len > sizeof(l2cap_pi(sk)->conf_req)) { | 1554 | if (l2cap_pi(sk)->conf_len + len > sizeof(l2cap_pi(sk)->conf_req)) { |
1555 | l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP, | 1555 | l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP, |
1556 | l2cap_build_conf_rsp(sk, rsp, | 1556 | l2cap_build_conf_rsp(sk, rsp, |
@@ -1748,15 +1748,16 @@ static inline void l2cap_sig_channel(struct l2cap_conn *conn, struct sk_buff *sk | |||
1748 | l2cap_raw_recv(conn, skb); | 1748 | l2cap_raw_recv(conn, skb); |
1749 | 1749 | ||
1750 | while (len >= L2CAP_CMD_HDR_SIZE) { | 1750 | while (len >= L2CAP_CMD_HDR_SIZE) { |
1751 | u16 cmd_len; | ||
1751 | memcpy(&cmd, data, L2CAP_CMD_HDR_SIZE); | 1752 | memcpy(&cmd, data, L2CAP_CMD_HDR_SIZE); |
1752 | data += L2CAP_CMD_HDR_SIZE; | 1753 | data += L2CAP_CMD_HDR_SIZE; |
1753 | len -= L2CAP_CMD_HDR_SIZE; | 1754 | len -= L2CAP_CMD_HDR_SIZE; |
1754 | 1755 | ||
1755 | cmd.len = __le16_to_cpu(cmd.len); | 1756 | cmd_len = le16_to_cpu(cmd.len); |
1756 | 1757 | ||
1757 | BT_DBG("code 0x%2.2x len %d id 0x%2.2x", cmd.code, cmd.len, cmd.ident); | 1758 | BT_DBG("code 0x%2.2x len %d id 0x%2.2x", cmd.code, cmd_len, cmd.ident); |
1758 | 1759 | ||
1759 | if (cmd.len > len || !cmd.ident) { | 1760 | if (cmd_len > len || !cmd.ident) { |
1760 | BT_DBG("corrupted command"); | 1761 | BT_DBG("corrupted command"); |
1761 | break; | 1762 | break; |
1762 | } | 1763 | } |
@@ -1775,7 +1776,7 @@ static inline void l2cap_sig_channel(struct l2cap_conn *conn, struct sk_buff *sk | |||
1775 | break; | 1776 | break; |
1776 | 1777 | ||
1777 | case L2CAP_CONF_REQ: | 1778 | case L2CAP_CONF_REQ: |
1778 | err = l2cap_config_req(conn, &cmd, data); | 1779 | err = l2cap_config_req(conn, &cmd, cmd_len, data); |
1779 | break; | 1780 | break; |
1780 | 1781 | ||
1781 | case L2CAP_CONF_RSP: | 1782 | case L2CAP_CONF_RSP: |
@@ -1791,7 +1792,7 @@ static inline void l2cap_sig_channel(struct l2cap_conn *conn, struct sk_buff *sk | |||
1791 | break; | 1792 | break; |
1792 | 1793 | ||
1793 | case L2CAP_ECHO_REQ: | 1794 | case L2CAP_ECHO_REQ: |
1794 | l2cap_send_cmd(conn, cmd.ident, L2CAP_ECHO_RSP, cmd.len, data); | 1795 | l2cap_send_cmd(conn, cmd.ident, L2CAP_ECHO_RSP, cmd_len, data); |
1795 | break; | 1796 | break; |
1796 | 1797 | ||
1797 | case L2CAP_ECHO_RSP: | 1798 | case L2CAP_ECHO_RSP: |
@@ -1820,8 +1821,8 @@ static inline void l2cap_sig_channel(struct l2cap_conn *conn, struct sk_buff *sk | |||
1820 | l2cap_send_cmd(conn, cmd.ident, L2CAP_COMMAND_REJ, sizeof(rej), &rej); | 1821 | l2cap_send_cmd(conn, cmd.ident, L2CAP_COMMAND_REJ, sizeof(rej), &rej); |
1821 | } | 1822 | } |
1822 | 1823 | ||
1823 | data += cmd.len; | 1824 | data += cmd_len; |
1824 | len -= cmd.len; | 1825 | len -= cmd_len; |
1825 | } | 1826 | } |
1826 | 1827 | ||
1827 | kfree_skb(skb); | 1828 | kfree_skb(skb); |
@@ -1863,7 +1864,7 @@ done: | |||
1863 | return 0; | 1864 | return 0; |
1864 | } | 1865 | } |
1865 | 1866 | ||
1866 | static inline int l2cap_conless_channel(struct l2cap_conn *conn, u16 psm, struct sk_buff *skb) | 1867 | static inline int l2cap_conless_channel(struct l2cap_conn *conn, __le16 psm, struct sk_buff *skb) |
1867 | { | 1868 | { |
1868 | struct sock *sk; | 1869 | struct sock *sk; |
1869 | 1870 | ||
@@ -1893,7 +1894,8 @@ done: | |||
1893 | static void l2cap_recv_frame(struct l2cap_conn *conn, struct sk_buff *skb) | 1894 | static void l2cap_recv_frame(struct l2cap_conn *conn, struct sk_buff *skb) |
1894 | { | 1895 | { |
1895 | struct l2cap_hdr *lh = (void *) skb->data; | 1896 | struct l2cap_hdr *lh = (void *) skb->data; |
1896 | u16 cid, psm, len; | 1897 | u16 cid, len; |
1898 | __le16 psm; | ||
1897 | 1899 | ||
1898 | skb_pull(skb, L2CAP_HDR_SIZE); | 1900 | skb_pull(skb, L2CAP_HDR_SIZE); |
1899 | cid = __le16_to_cpu(lh->cid); | 1901 | cid = __le16_to_cpu(lh->cid); |
@@ -1907,7 +1909,7 @@ static void l2cap_recv_frame(struct l2cap_conn *conn, struct sk_buff *skb) | |||
1907 | break; | 1909 | break; |
1908 | 1910 | ||
1909 | case 0x0002: | 1911 | case 0x0002: |
1910 | psm = get_unaligned((u16 *) skb->data); | 1912 | psm = get_unaligned((__le16 *) skb->data); |
1911 | skb_pull(skb, 2); | 1913 | skb_pull(skb, 2); |
1912 | l2cap_conless_channel(conn, psm, skb); | 1914 | l2cap_conless_channel(conn, psm, skb); |
1913 | break; | 1915 | break; |
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index 23ba61a13bdd..22a832098d44 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c | |||
@@ -267,7 +267,7 @@ static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc) | |||
267 | out: | 267 | out: |
268 | write_unlock_bh(&rfcomm_dev_lock); | 268 | write_unlock_bh(&rfcomm_dev_lock); |
269 | 269 | ||
270 | if (err) { | 270 | if (err < 0) { |
271 | kfree(dev); | 271 | kfree(dev); |
272 | return err; | 272 | return err; |
273 | } | 273 | } |
@@ -275,9 +275,10 @@ out: | |||
275 | dev->tty_dev = tty_register_device(rfcomm_tty_driver, dev->id, NULL); | 275 | dev->tty_dev = tty_register_device(rfcomm_tty_driver, dev->id, NULL); |
276 | 276 | ||
277 | if (IS_ERR(dev->tty_dev)) { | 277 | if (IS_ERR(dev->tty_dev)) { |
278 | err = PTR_ERR(dev->tty_dev); | ||
278 | list_del(&dev->list); | 279 | list_del(&dev->list); |
279 | kfree(dev); | 280 | kfree(dev); |
280 | return PTR_ERR(dev->tty_dev); | 281 | return err; |
281 | } | 282 | } |
282 | 283 | ||
283 | return dev->id; | 284 | return dev->id; |
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 7b4ce9113be2..b40dada002bf 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c | |||
@@ -29,35 +29,24 @@ | |||
29 | * Determine initial path cost based on speed. | 29 | * Determine initial path cost based on speed. |
30 | * using recommendations from 802.1d standard | 30 | * using recommendations from 802.1d standard |
31 | * | 31 | * |
32 | * Need to simulate user ioctl because not all device's that support | 32 | * Since driver might sleep need to not be holding any locks. |
33 | * ethtool, use ethtool_ops. Also, since driver might sleep need to | ||
34 | * not be holding any locks. | ||
35 | */ | 33 | */ |
36 | static int port_cost(struct net_device *dev) | 34 | static int port_cost(struct net_device *dev) |
37 | { | 35 | { |
38 | struct ethtool_cmd ecmd = { ETHTOOL_GSET }; | 36 | if (dev->ethtool_ops->get_settings) { |
39 | struct ifreq ifr; | 37 | struct ethtool_cmd ecmd = { ETHTOOL_GSET }; |
40 | mm_segment_t old_fs; | 38 | int err = dev->ethtool_ops->get_settings(dev, &ecmd); |
41 | int err; | 39 | if (!err) { |
42 | 40 | switch(ecmd.speed) { | |
43 | strncpy(ifr.ifr_name, dev->name, IFNAMSIZ); | 41 | case SPEED_100: |
44 | ifr.ifr_data = (void __user *) &ecmd; | 42 | return 19; |
45 | 43 | case SPEED_1000: | |
46 | old_fs = get_fs(); | 44 | return 4; |
47 | set_fs(KERNEL_DS); | 45 | case SPEED_10000: |
48 | err = dev_ethtool(&ifr); | 46 | return 2; |
49 | set_fs(old_fs); | 47 | case SPEED_10: |
50 | 48 | return 100; | |
51 | if (!err) { | 49 | } |
52 | switch(ecmd.speed) { | ||
53 | case SPEED_100: | ||
54 | return 19; | ||
55 | case SPEED_1000: | ||
56 | return 4; | ||
57 | case SPEED_10000: | ||
58 | return 2; | ||
59 | case SPEED_10: | ||
60 | return 100; | ||
61 | } | 50 | } |
62 | } | 51 | } |
63 | 52 | ||
diff --git a/net/core/dev.c b/net/core/dev.c index ee4035571c21..6cc8a70350ac 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -817,7 +817,9 @@ int dev_alloc_name(struct net_device *dev, const char *name) | |||
817 | */ | 817 | */ |
818 | int dev_change_name(struct net_device *dev, char *newname) | 818 | int dev_change_name(struct net_device *dev, char *newname) |
819 | { | 819 | { |
820 | char oldname[IFNAMSIZ]; | ||
820 | int err = 0; | 821 | int err = 0; |
822 | int ret; | ||
821 | 823 | ||
822 | ASSERT_RTNL(); | 824 | ASSERT_RTNL(); |
823 | 825 | ||
@@ -827,6 +829,8 @@ int dev_change_name(struct net_device *dev, char *newname) | |||
827 | if (!dev_valid_name(newname)) | 829 | if (!dev_valid_name(newname)) |
828 | return -EINVAL; | 830 | return -EINVAL; |
829 | 831 | ||
832 | memcpy(oldname, dev->name, IFNAMSIZ); | ||
833 | |||
830 | if (strchr(newname, '%')) { | 834 | if (strchr(newname, '%')) { |
831 | err = dev_alloc_name(dev, newname); | 835 | err = dev_alloc_name(dev, newname); |
832 | if (err < 0) | 836 | if (err < 0) |
@@ -838,10 +842,28 @@ int dev_change_name(struct net_device *dev, char *newname) | |||
838 | else | 842 | else |
839 | strlcpy(dev->name, newname, IFNAMSIZ); | 843 | strlcpy(dev->name, newname, IFNAMSIZ); |
840 | 844 | ||
845 | rollback: | ||
841 | device_rename(&dev->dev, dev->name); | 846 | device_rename(&dev->dev, dev->name); |
847 | |||
848 | write_lock_bh(&dev_base_lock); | ||
842 | hlist_del(&dev->name_hlist); | 849 | hlist_del(&dev->name_hlist); |
843 | hlist_add_head(&dev->name_hlist, dev_name_hash(dev->name)); | 850 | hlist_add_head(&dev->name_hlist, dev_name_hash(dev->name)); |
844 | raw_notifier_call_chain(&netdev_chain, NETDEV_CHANGENAME, dev); | 851 | write_unlock_bh(&dev_base_lock); |
852 | |||
853 | ret = raw_notifier_call_chain(&netdev_chain, NETDEV_CHANGENAME, dev); | ||
854 | ret = notifier_to_errno(ret); | ||
855 | |||
856 | if (ret) { | ||
857 | if (err) { | ||
858 | printk(KERN_ERR | ||
859 | "%s: name change rollback failed: %d.\n", | ||
860 | dev->name, ret); | ||
861 | } else { | ||
862 | err = ret; | ||
863 | memcpy(dev->name, oldname, IFNAMSIZ); | ||
864 | goto rollback; | ||
865 | } | ||
866 | } | ||
845 | 867 | ||
846 | return err; | 868 | return err; |
847 | } | 869 | } |
@@ -1054,20 +1076,43 @@ int dev_close(struct net_device *dev) | |||
1054 | int register_netdevice_notifier(struct notifier_block *nb) | 1076 | int register_netdevice_notifier(struct notifier_block *nb) |
1055 | { | 1077 | { |
1056 | struct net_device *dev; | 1078 | struct net_device *dev; |
1079 | struct net_device *last; | ||
1057 | int err; | 1080 | int err; |
1058 | 1081 | ||
1059 | rtnl_lock(); | 1082 | rtnl_lock(); |
1060 | err = raw_notifier_chain_register(&netdev_chain, nb); | 1083 | err = raw_notifier_chain_register(&netdev_chain, nb); |
1061 | if (!err) { | 1084 | if (err) |
1062 | for_each_netdev(dev) { | 1085 | goto unlock; |
1063 | nb->notifier_call(nb, NETDEV_REGISTER, dev); | ||
1064 | 1086 | ||
1065 | if (dev->flags & IFF_UP) | 1087 | for_each_netdev(dev) { |
1066 | nb->notifier_call(nb, NETDEV_UP, dev); | 1088 | err = nb->notifier_call(nb, NETDEV_REGISTER, dev); |
1067 | } | 1089 | err = notifier_to_errno(err); |
1090 | if (err) | ||
1091 | goto rollback; | ||
1092 | |||
1093 | if (!(dev->flags & IFF_UP)) | ||
1094 | continue; | ||
1095 | |||
1096 | nb->notifier_call(nb, NETDEV_UP, dev); | ||
1068 | } | 1097 | } |
1098 | |||
1099 | unlock: | ||
1069 | rtnl_unlock(); | 1100 | rtnl_unlock(); |
1070 | return err; | 1101 | return err; |
1102 | |||
1103 | rollback: | ||
1104 | last = dev; | ||
1105 | for_each_netdev(dev) { | ||
1106 | if (dev == last) | ||
1107 | break; | ||
1108 | |||
1109 | if (dev->flags & IFF_UP) { | ||
1110 | nb->notifier_call(nb, NETDEV_GOING_DOWN, dev); | ||
1111 | nb->notifier_call(nb, NETDEV_DOWN, dev); | ||
1112 | } | ||
1113 | nb->notifier_call(nb, NETDEV_UNREGISTER, dev); | ||
1114 | } | ||
1115 | goto unlock; | ||
1071 | } | 1116 | } |
1072 | 1117 | ||
1073 | /** | 1118 | /** |
@@ -2718,9 +2763,11 @@ int __dev_addr_add(struct dev_addr_list **list, int *count, | |||
2718 | /** | 2763 | /** |
2719 | * dev_unicast_delete - Release secondary unicast address. | 2764 | * dev_unicast_delete - Release secondary unicast address. |
2720 | * @dev: device | 2765 | * @dev: device |
2766 | * @addr: address to delete | ||
2767 | * @alen: length of @addr | ||
2721 | * | 2768 | * |
2722 | * Release reference to a secondary unicast address and remove it | 2769 | * Release reference to a secondary unicast address and remove it |
2723 | * from the device if the reference count drop to zero. | 2770 | * from the device if the reference count drops to zero. |
2724 | * | 2771 | * |
2725 | * The caller must hold the rtnl_mutex. | 2772 | * The caller must hold the rtnl_mutex. |
2726 | */ | 2773 | */ |
@@ -2742,6 +2789,8 @@ EXPORT_SYMBOL(dev_unicast_delete); | |||
2742 | /** | 2789 | /** |
2743 | * dev_unicast_add - add a secondary unicast address | 2790 | * dev_unicast_add - add a secondary unicast address |
2744 | * @dev: device | 2791 | * @dev: device |
2792 | * @addr: address to delete | ||
2793 | * @alen: length of @addr | ||
2745 | * | 2794 | * |
2746 | * Add a secondary unicast address to the device or increase | 2795 | * Add a secondary unicast address to the device or increase |
2747 | * the reference count if it already exists. | 2796 | * the reference count if it already exists. |
@@ -3333,7 +3382,7 @@ int register_netdevice(struct net_device *dev) | |||
3333 | 3382 | ||
3334 | if (!dev_valid_name(dev->name)) { | 3383 | if (!dev_valid_name(dev->name)) { |
3335 | ret = -EINVAL; | 3384 | ret = -EINVAL; |
3336 | goto out; | 3385 | goto err_uninit; |
3337 | } | 3386 | } |
3338 | 3387 | ||
3339 | dev->ifindex = dev_new_index(); | 3388 | dev->ifindex = dev_new_index(); |
@@ -3347,7 +3396,7 @@ int register_netdevice(struct net_device *dev) | |||
3347 | = hlist_entry(p, struct net_device, name_hlist); | 3396 | = hlist_entry(p, struct net_device, name_hlist); |
3348 | if (!strncmp(d->name, dev->name, IFNAMSIZ)) { | 3397 | if (!strncmp(d->name, dev->name, IFNAMSIZ)) { |
3349 | ret = -EEXIST; | 3398 | ret = -EEXIST; |
3350 | goto out; | 3399 | goto err_uninit; |
3351 | } | 3400 | } |
3352 | } | 3401 | } |
3353 | 3402 | ||
@@ -3407,7 +3456,7 @@ int register_netdevice(struct net_device *dev) | |||
3407 | 3456 | ||
3408 | ret = netdev_register_sysfs(dev); | 3457 | ret = netdev_register_sysfs(dev); |
3409 | if (ret) | 3458 | if (ret) |
3410 | goto out; | 3459 | goto err_uninit; |
3411 | dev->reg_state = NETREG_REGISTERED; | 3460 | dev->reg_state = NETREG_REGISTERED; |
3412 | 3461 | ||
3413 | /* | 3462 | /* |
@@ -3426,12 +3475,18 @@ int register_netdevice(struct net_device *dev) | |||
3426 | write_unlock_bh(&dev_base_lock); | 3475 | write_unlock_bh(&dev_base_lock); |
3427 | 3476 | ||
3428 | /* Notify protocols, that a new device appeared. */ | 3477 | /* Notify protocols, that a new device appeared. */ |
3429 | raw_notifier_call_chain(&netdev_chain, NETDEV_REGISTER, dev); | 3478 | ret = raw_notifier_call_chain(&netdev_chain, NETDEV_REGISTER, dev); |
3430 | 3479 | ret = notifier_to_errno(ret); | |
3431 | ret = 0; | 3480 | if (ret) |
3481 | unregister_netdevice(dev); | ||
3432 | 3482 | ||
3433 | out: | 3483 | out: |
3434 | return ret; | 3484 | return ret; |
3485 | |||
3486 | err_uninit: | ||
3487 | if (dev->uninit) | ||
3488 | dev->uninit(dev); | ||
3489 | goto out; | ||
3435 | } | 3490 | } |
3436 | 3491 | ||
3437 | /** | 3492 | /** |
@@ -3830,9 +3885,11 @@ static int dev_cpu_callback(struct notifier_block *nfb, | |||
3830 | 3885 | ||
3831 | #ifdef CONFIG_NET_DMA | 3886 | #ifdef CONFIG_NET_DMA |
3832 | /** | 3887 | /** |
3833 | * net_dma_rebalance - | 3888 | * net_dma_rebalance - try to maintain one DMA channel per CPU |
3834 | * This is called when the number of channels allocated to the net_dma_client | 3889 | * @net_dma: DMA client and associated data (lock, channels, channel_mask) |
3835 | * changes. The net_dma_client tries to have one DMA channel per CPU. | 3890 | * |
3891 | * This is called when the number of channels allocated to the net_dma client | ||
3892 | * changes. The net_dma client tries to have one DMA channel per CPU. | ||
3836 | */ | 3893 | */ |
3837 | 3894 | ||
3838 | static void net_dma_rebalance(struct net_dma *net_dma) | 3895 | static void net_dma_rebalance(struct net_dma *net_dma) |
@@ -3869,7 +3926,7 @@ static void net_dma_rebalance(struct net_dma *net_dma) | |||
3869 | * netdev_dma_event - event callback for the net_dma_client | 3926 | * netdev_dma_event - event callback for the net_dma_client |
3870 | * @client: should always be net_dma_client | 3927 | * @client: should always be net_dma_client |
3871 | * @chan: DMA channel for the event | 3928 | * @chan: DMA channel for the event |
3872 | * @event: event type | 3929 | * @state: DMA state to be handled |
3873 | */ | 3930 | */ |
3874 | static enum dma_state_client | 3931 | static enum dma_state_client |
3875 | netdev_dma_event(struct dma_client *client, struct dma_chan *chan, | 3932 | netdev_dma_event(struct dma_client *client, struct dma_chan *chan, |
diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 0b531e98ec33..2ab0a60046a5 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c | |||
@@ -3,10 +3,12 @@ | |||
3 | * Copyright (c) 2003 Matthew Wilcox <matthew@wil.cx> | 3 | * Copyright (c) 2003 Matthew Wilcox <matthew@wil.cx> |
4 | * | 4 | * |
5 | * This file is where we call all the ethtool_ops commands to get | 5 | * This file is where we call all the ethtool_ops commands to get |
6 | * the information ethtool needs. We fall back to calling do_ioctl() | 6 | * the information ethtool needs. |
7 | * for drivers which haven't been converted to ethtool_ops yet. | ||
8 | * | 7 | * |
9 | * It's GPL, stupid. | 8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
10 | */ | 12 | */ |
11 | 13 | ||
12 | #include <linux/module.h> | 14 | #include <linux/module.h> |
@@ -93,18 +95,6 @@ int ethtool_op_set_tso(struct net_device *dev, u32 data) | |||
93 | return 0; | 95 | return 0; |
94 | } | 96 | } |
95 | 97 | ||
96 | int ethtool_op_get_perm_addr(struct net_device *dev, struct ethtool_perm_addr *addr, u8 *data) | ||
97 | { | ||
98 | unsigned char len = dev->addr_len; | ||
99 | if ( addr->size < len ) | ||
100 | return -ETOOSMALL; | ||
101 | |||
102 | addr->size = len; | ||
103 | memcpy(data, dev->perm_addr, len); | ||
104 | return 0; | ||
105 | } | ||
106 | |||
107 | |||
108 | u32 ethtool_op_get_ufo(struct net_device *dev) | 98 | u32 ethtool_op_get_ufo(struct net_device *dev) |
109 | { | 99 | { |
110 | return (dev->features & NETIF_F_UFO) != 0; | 100 | return (dev->features & NETIF_F_UFO) != 0; |
@@ -777,34 +767,20 @@ static int ethtool_get_stats(struct net_device *dev, void __user *useraddr) | |||
777 | static int ethtool_get_perm_addr(struct net_device *dev, void __user *useraddr) | 767 | static int ethtool_get_perm_addr(struct net_device *dev, void __user *useraddr) |
778 | { | 768 | { |
779 | struct ethtool_perm_addr epaddr; | 769 | struct ethtool_perm_addr epaddr; |
780 | u8 *data; | ||
781 | int ret; | ||
782 | |||
783 | if (!dev->ethtool_ops->get_perm_addr) | ||
784 | return -EOPNOTSUPP; | ||
785 | 770 | ||
786 | if (copy_from_user(&epaddr,useraddr,sizeof(epaddr))) | 771 | if (copy_from_user(&epaddr, useraddr, sizeof(epaddr))) |
787 | return -EFAULT; | 772 | return -EFAULT; |
788 | 773 | ||
789 | data = kmalloc(epaddr.size, GFP_USER); | 774 | if (epaddr.size < dev->addr_len) |
790 | if (!data) | 775 | return -ETOOSMALL; |
791 | return -ENOMEM; | 776 | epaddr.size = dev->addr_len; |
792 | |||
793 | ret = dev->ethtool_ops->get_perm_addr(dev,&epaddr,data); | ||
794 | if (ret) | ||
795 | return ret; | ||
796 | 777 | ||
797 | ret = -EFAULT; | ||
798 | if (copy_to_user(useraddr, &epaddr, sizeof(epaddr))) | 778 | if (copy_to_user(useraddr, &epaddr, sizeof(epaddr))) |
799 | goto out; | 779 | return -EFAULT; |
800 | useraddr += sizeof(epaddr); | 780 | useraddr += sizeof(epaddr); |
801 | if (copy_to_user(useraddr, data, epaddr.size)) | 781 | if (copy_to_user(useraddr, dev->perm_addr, epaddr.size)) |
802 | goto out; | 782 | return -EFAULT; |
803 | ret = 0; | 783 | return 0; |
804 | |||
805 | out: | ||
806 | kfree(data); | ||
807 | return ret; | ||
808 | } | 784 | } |
809 | 785 | ||
810 | /* The main entry point in this file. Called from net/core/dev.c */ | 786 | /* The main entry point in this file. Called from net/core/dev.c */ |
@@ -821,7 +797,7 @@ int dev_ethtool(struct ifreq *ifr) | |||
821 | return -ENODEV; | 797 | return -ENODEV; |
822 | 798 | ||
823 | if (!dev->ethtool_ops) | 799 | if (!dev->ethtool_ops) |
824 | goto ioctl; | 800 | return -EOPNOTSUPP; |
825 | 801 | ||
826 | if (copy_from_user(ðcmd, useraddr, sizeof (ethcmd))) | 802 | if (copy_from_user(ðcmd, useraddr, sizeof (ethcmd))) |
827 | return -EFAULT; | 803 | return -EFAULT; |
@@ -960,7 +936,7 @@ int dev_ethtool(struct ifreq *ifr) | |||
960 | rc = ethtool_set_gso(dev, useraddr); | 936 | rc = ethtool_set_gso(dev, useraddr); |
961 | break; | 937 | break; |
962 | default: | 938 | default: |
963 | rc = -EOPNOTSUPP; | 939 | rc = -EOPNOTSUPP; |
964 | } | 940 | } |
965 | 941 | ||
966 | if (dev->ethtool_ops->complete) | 942 | if (dev->ethtool_ops->complete) |
@@ -970,20 +946,10 @@ int dev_ethtool(struct ifreq *ifr) | |||
970 | netdev_features_change(dev); | 946 | netdev_features_change(dev); |
971 | 947 | ||
972 | return rc; | 948 | return rc; |
973 | |||
974 | ioctl: | ||
975 | /* Keep existing behaviour for the moment. */ | ||
976 | if (!capable(CAP_NET_ADMIN)) | ||
977 | return -EPERM; | ||
978 | |||
979 | if (dev->do_ioctl) | ||
980 | return dev->do_ioctl(dev, ifr, SIOCETHTOOL); | ||
981 | return -EOPNOTSUPP; | ||
982 | } | 949 | } |
983 | 950 | ||
984 | EXPORT_SYMBOL(dev_ethtool); | 951 | EXPORT_SYMBOL(dev_ethtool); |
985 | EXPORT_SYMBOL(ethtool_op_get_link); | 952 | EXPORT_SYMBOL(ethtool_op_get_link); |
986 | EXPORT_SYMBOL_GPL(ethtool_op_get_perm_addr); | ||
987 | EXPORT_SYMBOL(ethtool_op_get_sg); | 953 | EXPORT_SYMBOL(ethtool_op_get_sg); |
988 | EXPORT_SYMBOL(ethtool_op_get_tso); | 954 | EXPORT_SYMBOL(ethtool_op_get_tso); |
989 | EXPORT_SYMBOL(ethtool_op_get_tx_csum); | 955 | EXPORT_SYMBOL(ethtool_op_get_tx_csum); |
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index bca787fdbc51..7bae576ac115 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -567,7 +567,7 @@ static ssize_t pgctrl_write(struct file *file, const char __user * buf, | |||
567 | pktgen_run_all_threads(); | 567 | pktgen_run_all_threads(); |
568 | 568 | ||
569 | else | 569 | else |
570 | printk("pktgen: Unknown command: %s\n", data); | 570 | printk(KERN_WARNING "pktgen: Unknown command: %s\n", data); |
571 | 571 | ||
572 | err = count; | 572 | err = count; |
573 | 573 | ||
@@ -908,14 +908,14 @@ static ssize_t pktgen_if_write(struct file *file, | |||
908 | pg_result = &(pkt_dev->result[0]); | 908 | pg_result = &(pkt_dev->result[0]); |
909 | 909 | ||
910 | if (count < 1) { | 910 | if (count < 1) { |
911 | printk("pktgen: wrong command format\n"); | 911 | printk(KERN_WARNING "pktgen: wrong command format\n"); |
912 | return -EINVAL; | 912 | return -EINVAL; |
913 | } | 913 | } |
914 | 914 | ||
915 | max = count - i; | 915 | max = count - i; |
916 | tmp = count_trail_chars(&user_buffer[i], max); | 916 | tmp = count_trail_chars(&user_buffer[i], max); |
917 | if (tmp < 0) { | 917 | if (tmp < 0) { |
918 | printk("pktgen: illegal format\n"); | 918 | printk(KERN_WARNING "pktgen: illegal format\n"); |
919 | return tmp; | 919 | return tmp; |
920 | } | 920 | } |
921 | i += tmp; | 921 | i += tmp; |
@@ -943,7 +943,7 @@ static ssize_t pktgen_if_write(struct file *file, | |||
943 | if (copy_from_user(tb, user_buffer, count)) | 943 | if (copy_from_user(tb, user_buffer, count)) |
944 | return -EFAULT; | 944 | return -EFAULT; |
945 | tb[count] = 0; | 945 | tb[count] = 0; |
946 | printk("pktgen: %s,%lu buffer -:%s:-\n", name, | 946 | printk(KERN_DEBUG "pktgen: %s,%lu buffer -:%s:-\n", name, |
947 | (unsigned long)count, tb); | 947 | (unsigned long)count, tb); |
948 | } | 948 | } |
949 | 949 | ||
@@ -1248,7 +1248,7 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1248 | pkt_dev->cur_daddr = pkt_dev->daddr_min; | 1248 | pkt_dev->cur_daddr = pkt_dev->daddr_min; |
1249 | } | 1249 | } |
1250 | if (debug) | 1250 | if (debug) |
1251 | printk("pktgen: dst_min set to: %s\n", | 1251 | printk(KERN_DEBUG "pktgen: dst_min set to: %s\n", |
1252 | pkt_dev->dst_min); | 1252 | pkt_dev->dst_min); |
1253 | i += len; | 1253 | i += len; |
1254 | sprintf(pg_result, "OK: dst_min=%s", pkt_dev->dst_min); | 1254 | sprintf(pg_result, "OK: dst_min=%s", pkt_dev->dst_min); |
@@ -1271,7 +1271,7 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1271 | pkt_dev->cur_daddr = pkt_dev->daddr_max; | 1271 | pkt_dev->cur_daddr = pkt_dev->daddr_max; |
1272 | } | 1272 | } |
1273 | if (debug) | 1273 | if (debug) |
1274 | printk("pktgen: dst_max set to: %s\n", | 1274 | printk(KERN_DEBUG "pktgen: dst_max set to: %s\n", |
1275 | pkt_dev->dst_max); | 1275 | pkt_dev->dst_max); |
1276 | i += len; | 1276 | i += len; |
1277 | sprintf(pg_result, "OK: dst_max=%s", pkt_dev->dst_max); | 1277 | sprintf(pg_result, "OK: dst_max=%s", pkt_dev->dst_max); |
@@ -1294,7 +1294,7 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1294 | ipv6_addr_copy(&pkt_dev->cur_in6_daddr, &pkt_dev->in6_daddr); | 1294 | ipv6_addr_copy(&pkt_dev->cur_in6_daddr, &pkt_dev->in6_daddr); |
1295 | 1295 | ||
1296 | if (debug) | 1296 | if (debug) |
1297 | printk("pktgen: dst6 set to: %s\n", buf); | 1297 | printk(KERN_DEBUG "pktgen: dst6 set to: %s\n", buf); |
1298 | 1298 | ||
1299 | i += len; | 1299 | i += len; |
1300 | sprintf(pg_result, "OK: dst6=%s", buf); | 1300 | sprintf(pg_result, "OK: dst6=%s", buf); |
@@ -1317,7 +1317,7 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1317 | ipv6_addr_copy(&pkt_dev->cur_in6_daddr, | 1317 | ipv6_addr_copy(&pkt_dev->cur_in6_daddr, |
1318 | &pkt_dev->min_in6_daddr); | 1318 | &pkt_dev->min_in6_daddr); |
1319 | if (debug) | 1319 | if (debug) |
1320 | printk("pktgen: dst6_min set to: %s\n", buf); | 1320 | printk(KERN_DEBUG "pktgen: dst6_min set to: %s\n", buf); |
1321 | 1321 | ||
1322 | i += len; | 1322 | i += len; |
1323 | sprintf(pg_result, "OK: dst6_min=%s", buf); | 1323 | sprintf(pg_result, "OK: dst6_min=%s", buf); |
@@ -1338,7 +1338,7 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1338 | fmt_ip6(buf, pkt_dev->max_in6_daddr.s6_addr); | 1338 | fmt_ip6(buf, pkt_dev->max_in6_daddr.s6_addr); |
1339 | 1339 | ||
1340 | if (debug) | 1340 | if (debug) |
1341 | printk("pktgen: dst6_max set to: %s\n", buf); | 1341 | printk(KERN_DEBUG "pktgen: dst6_max set to: %s\n", buf); |
1342 | 1342 | ||
1343 | i += len; | 1343 | i += len; |
1344 | sprintf(pg_result, "OK: dst6_max=%s", buf); | 1344 | sprintf(pg_result, "OK: dst6_max=%s", buf); |
@@ -1361,7 +1361,7 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1361 | ipv6_addr_copy(&pkt_dev->cur_in6_saddr, &pkt_dev->in6_saddr); | 1361 | ipv6_addr_copy(&pkt_dev->cur_in6_saddr, &pkt_dev->in6_saddr); |
1362 | 1362 | ||
1363 | if (debug) | 1363 | if (debug) |
1364 | printk("pktgen: src6 set to: %s\n", buf); | 1364 | printk(KERN_DEBUG "pktgen: src6 set to: %s\n", buf); |
1365 | 1365 | ||
1366 | i += len; | 1366 | i += len; |
1367 | sprintf(pg_result, "OK: src6=%s", buf); | 1367 | sprintf(pg_result, "OK: src6=%s", buf); |
@@ -1382,7 +1382,7 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1382 | pkt_dev->cur_saddr = pkt_dev->saddr_min; | 1382 | pkt_dev->cur_saddr = pkt_dev->saddr_min; |
1383 | } | 1383 | } |
1384 | if (debug) | 1384 | if (debug) |
1385 | printk("pktgen: src_min set to: %s\n", | 1385 | printk(KERN_DEBUG "pktgen: src_min set to: %s\n", |
1386 | pkt_dev->src_min); | 1386 | pkt_dev->src_min); |
1387 | i += len; | 1387 | i += len; |
1388 | sprintf(pg_result, "OK: src_min=%s", pkt_dev->src_min); | 1388 | sprintf(pg_result, "OK: src_min=%s", pkt_dev->src_min); |
@@ -1403,7 +1403,7 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1403 | pkt_dev->cur_saddr = pkt_dev->saddr_max; | 1403 | pkt_dev->cur_saddr = pkt_dev->saddr_max; |
1404 | } | 1404 | } |
1405 | if (debug) | 1405 | if (debug) |
1406 | printk("pktgen: src_max set to: %s\n", | 1406 | printk(KERN_DEBUG "pktgen: src_max set to: %s\n", |
1407 | pkt_dev->src_max); | 1407 | pkt_dev->src_max); |
1408 | i += len; | 1408 | i += len; |
1409 | sprintf(pg_result, "OK: src_max=%s", pkt_dev->src_max); | 1409 | sprintf(pg_result, "OK: src_max=%s", pkt_dev->src_max); |
@@ -1533,7 +1533,7 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1533 | pkt_dev->svlan_id = 0xffff; | 1533 | pkt_dev->svlan_id = 0xffff; |
1534 | 1534 | ||
1535 | if (debug) | 1535 | if (debug) |
1536 | printk("pktgen: VLAN/SVLAN auto turned off\n"); | 1536 | printk(KERN_DEBUG "pktgen: VLAN/SVLAN auto turned off\n"); |
1537 | } | 1537 | } |
1538 | return count; | 1538 | return count; |
1539 | } | 1539 | } |
@@ -1548,10 +1548,10 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1548 | pkt_dev->vlan_id = value; /* turn on VLAN */ | 1548 | pkt_dev->vlan_id = value; /* turn on VLAN */ |
1549 | 1549 | ||
1550 | if (debug) | 1550 | if (debug) |
1551 | printk("pktgen: VLAN turned on\n"); | 1551 | printk(KERN_DEBUG "pktgen: VLAN turned on\n"); |
1552 | 1552 | ||
1553 | if (debug && pkt_dev->nr_labels) | 1553 | if (debug && pkt_dev->nr_labels) |
1554 | printk("pktgen: MPLS auto turned off\n"); | 1554 | printk(KERN_DEBUG "pktgen: MPLS auto turned off\n"); |
1555 | 1555 | ||
1556 | pkt_dev->nr_labels = 0; /* turn off MPLS */ | 1556 | pkt_dev->nr_labels = 0; /* turn off MPLS */ |
1557 | sprintf(pg_result, "OK: vlan_id=%u", pkt_dev->vlan_id); | 1557 | sprintf(pg_result, "OK: vlan_id=%u", pkt_dev->vlan_id); |
@@ -1560,7 +1560,7 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1560 | pkt_dev->svlan_id = 0xffff; | 1560 | pkt_dev->svlan_id = 0xffff; |
1561 | 1561 | ||
1562 | if (debug) | 1562 | if (debug) |
1563 | printk("pktgen: VLAN/SVLAN turned off\n"); | 1563 | printk(KERN_DEBUG "pktgen: VLAN/SVLAN turned off\n"); |
1564 | } | 1564 | } |
1565 | return count; | 1565 | return count; |
1566 | } | 1566 | } |
@@ -1605,10 +1605,10 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1605 | pkt_dev->svlan_id = value; /* turn on SVLAN */ | 1605 | pkt_dev->svlan_id = value; /* turn on SVLAN */ |
1606 | 1606 | ||
1607 | if (debug) | 1607 | if (debug) |
1608 | printk("pktgen: SVLAN turned on\n"); | 1608 | printk(KERN_DEBUG "pktgen: SVLAN turned on\n"); |
1609 | 1609 | ||
1610 | if (debug && pkt_dev->nr_labels) | 1610 | if (debug && pkt_dev->nr_labels) |
1611 | printk("pktgen: MPLS auto turned off\n"); | 1611 | printk(KERN_DEBUG "pktgen: MPLS auto turned off\n"); |
1612 | 1612 | ||
1613 | pkt_dev->nr_labels = 0; /* turn off MPLS */ | 1613 | pkt_dev->nr_labels = 0; /* turn off MPLS */ |
1614 | sprintf(pg_result, "OK: svlan_id=%u", pkt_dev->svlan_id); | 1614 | sprintf(pg_result, "OK: svlan_id=%u", pkt_dev->svlan_id); |
@@ -1617,7 +1617,7 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1617 | pkt_dev->svlan_id = 0xffff; | 1617 | pkt_dev->svlan_id = 0xffff; |
1618 | 1618 | ||
1619 | if (debug) | 1619 | if (debug) |
1620 | printk("pktgen: VLAN/SVLAN turned off\n"); | 1620 | printk(KERN_DEBUG "pktgen: VLAN/SVLAN turned off\n"); |
1621 | } | 1621 | } |
1622 | return count; | 1622 | return count; |
1623 | } | 1623 | } |
@@ -1777,10 +1777,11 @@ static ssize_t pktgen_thread_write(struct file *file, | |||
1777 | i += len; | 1777 | i += len; |
1778 | 1778 | ||
1779 | if (debug) | 1779 | if (debug) |
1780 | printk("pktgen: t=%s, count=%lu\n", name, (unsigned long)count); | 1780 | printk(KERN_DEBUG "pktgen: t=%s, count=%lu\n", |
1781 | name, (unsigned long)count); | ||
1781 | 1782 | ||
1782 | if (!t) { | 1783 | if (!t) { |
1783 | printk("pktgen: ERROR: No thread\n"); | 1784 | printk(KERN_ERR "pktgen: ERROR: No thread\n"); |
1784 | ret = -EINVAL; | 1785 | ret = -EINVAL; |
1785 | goto out; | 1786 | goto out; |
1786 | } | 1787 | } |
@@ -1891,8 +1892,8 @@ static void pktgen_mark_device(const char *ifname) | |||
1891 | mutex_lock(&pktgen_thread_lock); | 1892 | mutex_lock(&pktgen_thread_lock); |
1892 | 1893 | ||
1893 | if (++i >= max_tries) { | 1894 | if (++i >= max_tries) { |
1894 | printk("pktgen_mark_device: timed out after waiting " | 1895 | printk(KERN_ERR "pktgen_mark_device: timed out after " |
1895 | "%d msec for device %s to be removed\n", | 1896 | "waiting %d msec for device %s to be removed\n", |
1896 | msec_per_try * i, ifname); | 1897 | msec_per_try * i, ifname); |
1897 | break; | 1898 | break; |
1898 | } | 1899 | } |
@@ -1962,15 +1963,15 @@ static int pktgen_setup_dev(struct pktgen_dev *pkt_dev, const char *ifname) | |||
1962 | 1963 | ||
1963 | odev = dev_get_by_name(ifname); | 1964 | odev = dev_get_by_name(ifname); |
1964 | if (!odev) { | 1965 | if (!odev) { |
1965 | printk("pktgen: no such netdevice: \"%s\"\n", ifname); | 1966 | printk(KERN_ERR "pktgen: no such netdevice: \"%s\"\n", ifname); |
1966 | return -ENODEV; | 1967 | return -ENODEV; |
1967 | } | 1968 | } |
1968 | 1969 | ||
1969 | if (odev->type != ARPHRD_ETHER) { | 1970 | if (odev->type != ARPHRD_ETHER) { |
1970 | printk("pktgen: not an ethernet device: \"%s\"\n", ifname); | 1971 | printk(KERN_ERR "pktgen: not an ethernet device: \"%s\"\n", ifname); |
1971 | err = -EINVAL; | 1972 | err = -EINVAL; |
1972 | } else if (!netif_running(odev)) { | 1973 | } else if (!netif_running(odev)) { |
1973 | printk("pktgen: device is down: \"%s\"\n", ifname); | 1974 | printk(KERN_ERR "pktgen: device is down: \"%s\"\n", ifname); |
1974 | err = -ENETDOWN; | 1975 | err = -ENETDOWN; |
1975 | } else { | 1976 | } else { |
1976 | pkt_dev->odev = odev; | 1977 | pkt_dev->odev = odev; |
@@ -1987,7 +1988,8 @@ static int pktgen_setup_dev(struct pktgen_dev *pkt_dev, const char *ifname) | |||
1987 | static void pktgen_setup_inject(struct pktgen_dev *pkt_dev) | 1988 | static void pktgen_setup_inject(struct pktgen_dev *pkt_dev) |
1988 | { | 1989 | { |
1989 | if (!pkt_dev->odev) { | 1990 | if (!pkt_dev->odev) { |
1990 | printk("pktgen: ERROR: pkt_dev->odev == NULL in setup_inject.\n"); | 1991 | printk(KERN_ERR "pktgen: ERROR: pkt_dev->odev == NULL in " |
1992 | "setup_inject.\n"); | ||
1991 | sprintf(pkt_dev->result, | 1993 | sprintf(pkt_dev->result, |
1992 | "ERROR: pkt_dev->odev == NULL in setup_inject.\n"); | 1994 | "ERROR: pkt_dev->odev == NULL in setup_inject.\n"); |
1993 | return; | 1995 | return; |
@@ -2049,7 +2051,8 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev) | |||
2049 | } | 2051 | } |
2050 | rcu_read_unlock(); | 2052 | rcu_read_unlock(); |
2051 | if (err) | 2053 | if (err) |
2052 | printk("pktgen: ERROR: IPv6 link address not availble.\n"); | 2054 | printk(KERN_ERR "pktgen: ERROR: IPv6 link " |
2055 | "address not availble.\n"); | ||
2053 | } | 2056 | } |
2054 | #endif | 2057 | #endif |
2055 | } else { | 2058 | } else { |
@@ -2156,8 +2159,7 @@ static inline int f_pick(struct pktgen_dev *pkt_dev) | |||
2156 | /* If there was already an IPSEC SA, we keep it as is, else | 2159 | /* If there was already an IPSEC SA, we keep it as is, else |
2157 | * we go look for it ... | 2160 | * we go look for it ... |
2158 | */ | 2161 | */ |
2159 | inline | 2162 | static void get_ipsec_sa(struct pktgen_dev *pkt_dev, int flow) |
2160 | void get_ipsec_sa(struct pktgen_dev *pkt_dev, int flow) | ||
2161 | { | 2163 | { |
2162 | struct xfrm_state *x = pkt_dev->flows[flow].x; | 2164 | struct xfrm_state *x = pkt_dev->flows[flow].x; |
2163 | if (!x) { | 2165 | if (!x) { |
@@ -2441,7 +2443,8 @@ static inline int process_ipsec(struct pktgen_dev *pkt_dev, | |||
2441 | if (nhead >0) { | 2443 | if (nhead >0) { |
2442 | ret = pskb_expand_head(skb, nhead, 0, GFP_ATOMIC); | 2444 | ret = pskb_expand_head(skb, nhead, 0, GFP_ATOMIC); |
2443 | if (ret < 0) { | 2445 | if (ret < 0) { |
2444 | printk("Error expanding ipsec packet %d\n",ret); | 2446 | printk(KERN_ERR "Error expanding " |
2447 | "ipsec packet %d\n",ret); | ||
2445 | return 0; | 2448 | return 0; |
2446 | } | 2449 | } |
2447 | } | 2450 | } |
@@ -2450,7 +2453,8 @@ static inline int process_ipsec(struct pktgen_dev *pkt_dev, | |||
2450 | skb_pull(skb, ETH_HLEN); | 2453 | skb_pull(skb, ETH_HLEN); |
2451 | ret = pktgen_output_ipsec(skb, pkt_dev); | 2454 | ret = pktgen_output_ipsec(skb, pkt_dev); |
2452 | if (ret) { | 2455 | if (ret) { |
2453 | printk("Error creating ipsec packet %d\n",ret); | 2456 | printk(KERN_ERR "Error creating ipsec " |
2457 | "packet %d\n",ret); | ||
2454 | kfree_skb(skb); | 2458 | kfree_skb(skb); |
2455 | return 0; | 2459 | return 0; |
2456 | } | 2460 | } |
@@ -3184,8 +3188,8 @@ static int pktgen_stop_device(struct pktgen_dev *pkt_dev) | |||
3184 | int nr_frags = pkt_dev->skb ? skb_shinfo(pkt_dev->skb)->nr_frags : -1; | 3188 | int nr_frags = pkt_dev->skb ? skb_shinfo(pkt_dev->skb)->nr_frags : -1; |
3185 | 3189 | ||
3186 | if (!pkt_dev->running) { | 3190 | if (!pkt_dev->running) { |
3187 | printk("pktgen: interface: %s is already stopped\n", | 3191 | printk(KERN_WARNING "pktgen: interface: %s is already " |
3188 | pkt_dev->odev->name); | 3192 | "stopped\n", pkt_dev->odev->name); |
3189 | return -EINVAL; | 3193 | return -EINVAL; |
3190 | } | 3194 | } |
3191 | 3195 | ||
@@ -3360,7 +3364,8 @@ static __inline__ void pktgen_xmit(struct pktgen_dev *pkt_dev) | |||
3360 | 3364 | ||
3361 | pkt_dev->skb = fill_packet(odev, pkt_dev); | 3365 | pkt_dev->skb = fill_packet(odev, pkt_dev); |
3362 | if (pkt_dev->skb == NULL) { | 3366 | if (pkt_dev->skb == NULL) { |
3363 | printk("pktgen: ERROR: couldn't allocate skb in fill_packet.\n"); | 3367 | printk(KERN_ERR "pktgen: ERROR: couldn't " |
3368 | "allocate skb in fill_packet.\n"); | ||
3364 | schedule(); | 3369 | schedule(); |
3365 | pkt_dev->clone_count--; /* back out increment, OOM */ | 3370 | pkt_dev->clone_count--; /* back out increment, OOM */ |
3366 | goto out; | 3371 | goto out; |
@@ -3565,7 +3570,8 @@ static int add_dev_to_thread(struct pktgen_thread *t, | |||
3565 | if_lock(t); | 3570 | if_lock(t); |
3566 | 3571 | ||
3567 | if (pkt_dev->pg_thread) { | 3572 | if (pkt_dev->pg_thread) { |
3568 | printk("pktgen: ERROR: already assigned to a thread.\n"); | 3573 | printk(KERN_ERR "pktgen: ERROR: already assigned " |
3574 | "to a thread.\n"); | ||
3569 | rv = -EBUSY; | 3575 | rv = -EBUSY; |
3570 | goto out; | 3576 | goto out; |
3571 | } | 3577 | } |
@@ -3590,7 +3596,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname) | |||
3590 | 3596 | ||
3591 | pkt_dev = __pktgen_NN_threads(ifname, FIND); | 3597 | pkt_dev = __pktgen_NN_threads(ifname, FIND); |
3592 | if (pkt_dev) { | 3598 | if (pkt_dev) { |
3593 | printk("pktgen: ERROR: interface already used.\n"); | 3599 | printk(KERN_ERR "pktgen: ERROR: interface already used.\n"); |
3594 | return -EBUSY; | 3600 | return -EBUSY; |
3595 | } | 3601 | } |
3596 | 3602 | ||
@@ -3632,7 +3638,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname) | |||
3632 | 3638 | ||
3633 | pkt_dev->entry = create_proc_entry(ifname, 0600, pg_proc_dir); | 3639 | pkt_dev->entry = create_proc_entry(ifname, 0600, pg_proc_dir); |
3634 | if (!pkt_dev->entry) { | 3640 | if (!pkt_dev->entry) { |
3635 | printk("pktgen: cannot create %s/%s procfs entry.\n", | 3641 | printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n", |
3636 | PG_PROC_DIR, ifname); | 3642 | PG_PROC_DIR, ifname); |
3637 | err = -EINVAL; | 3643 | err = -EINVAL; |
3638 | goto out2; | 3644 | goto out2; |
@@ -3665,7 +3671,8 @@ static int __init pktgen_create_thread(int cpu) | |||
3665 | 3671 | ||
3666 | t = kzalloc(sizeof(struct pktgen_thread), GFP_KERNEL); | 3672 | t = kzalloc(sizeof(struct pktgen_thread), GFP_KERNEL); |
3667 | if (!t) { | 3673 | if (!t) { |
3668 | printk("pktgen: ERROR: out of memory, can't create new thread.\n"); | 3674 | printk(KERN_ERR "pktgen: ERROR: out of memory, can't " |
3675 | "create new thread.\n"); | ||
3669 | return -ENOMEM; | 3676 | return -ENOMEM; |
3670 | } | 3677 | } |
3671 | 3678 | ||
@@ -3678,7 +3685,8 @@ static int __init pktgen_create_thread(int cpu) | |||
3678 | 3685 | ||
3679 | p = kthread_create(pktgen_thread_worker, t, "kpktgend_%d", cpu); | 3686 | p = kthread_create(pktgen_thread_worker, t, "kpktgend_%d", cpu); |
3680 | if (IS_ERR(p)) { | 3687 | if (IS_ERR(p)) { |
3681 | printk("pktgen: kernel_thread() failed for cpu %d\n", t->cpu); | 3688 | printk(KERN_ERR "pktgen: kernel_thread() failed " |
3689 | "for cpu %d\n", t->cpu); | ||
3682 | list_del(&t->th_list); | 3690 | list_del(&t->th_list); |
3683 | kfree(t); | 3691 | kfree(t); |
3684 | return PTR_ERR(p); | 3692 | return PTR_ERR(p); |
@@ -3688,7 +3696,7 @@ static int __init pktgen_create_thread(int cpu) | |||
3688 | 3696 | ||
3689 | pe = create_proc_entry(t->tsk->comm, 0600, pg_proc_dir); | 3697 | pe = create_proc_entry(t->tsk->comm, 0600, pg_proc_dir); |
3690 | if (!pe) { | 3698 | if (!pe) { |
3691 | printk("pktgen: cannot create %s/%s procfs entry.\n", | 3699 | printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n", |
3692 | PG_PROC_DIR, t->tsk->comm); | 3700 | PG_PROC_DIR, t->tsk->comm); |
3693 | kthread_stop(p); | 3701 | kthread_stop(p); |
3694 | list_del(&t->th_list); | 3702 | list_del(&t->th_list); |
@@ -3727,7 +3735,8 @@ static int pktgen_remove_device(struct pktgen_thread *t, | |||
3727 | pr_debug("pktgen: remove_device pkt_dev=%p\n", pkt_dev); | 3735 | pr_debug("pktgen: remove_device pkt_dev=%p\n", pkt_dev); |
3728 | 3736 | ||
3729 | if (pkt_dev->running) { | 3737 | if (pkt_dev->running) { |
3730 | printk("pktgen:WARNING: trying to remove a running interface, stopping it now.\n"); | 3738 | printk(KERN_WARNING "pktgen: WARNING: trying to remove a " |
3739 | "running interface, stopping it now.\n"); | ||
3731 | pktgen_stop_device(pkt_dev); | 3740 | pktgen_stop_device(pkt_dev); |
3732 | } | 3741 | } |
3733 | 3742 | ||
@@ -3759,7 +3768,7 @@ static int __init pg_init(void) | |||
3759 | int cpu; | 3768 | int cpu; |
3760 | struct proc_dir_entry *pe; | 3769 | struct proc_dir_entry *pe; |
3761 | 3770 | ||
3762 | printk(version); | 3771 | printk(KERN_INFO "%s", version); |
3763 | 3772 | ||
3764 | pg_proc_dir = proc_mkdir(PG_PROC_DIR, proc_net); | 3773 | pg_proc_dir = proc_mkdir(PG_PROC_DIR, proc_net); |
3765 | if (!pg_proc_dir) | 3774 | if (!pg_proc_dir) |
@@ -3768,8 +3777,8 @@ static int __init pg_init(void) | |||
3768 | 3777 | ||
3769 | pe = create_proc_entry(PGCTRL, 0600, pg_proc_dir); | 3778 | pe = create_proc_entry(PGCTRL, 0600, pg_proc_dir); |
3770 | if (pe == NULL) { | 3779 | if (pe == NULL) { |
3771 | printk("pktgen: ERROR: cannot create %s procfs entry.\n", | 3780 | printk(KERN_ERR "pktgen: ERROR: cannot create %s " |
3772 | PGCTRL); | 3781 | "procfs entry.\n", PGCTRL); |
3773 | proc_net_remove(PG_PROC_DIR); | 3782 | proc_net_remove(PG_PROC_DIR); |
3774 | return -EINVAL; | 3783 | return -EINVAL; |
3775 | } | 3784 | } |
@@ -3785,12 +3794,13 @@ static int __init pg_init(void) | |||
3785 | 3794 | ||
3786 | err = pktgen_create_thread(cpu); | 3795 | err = pktgen_create_thread(cpu); |
3787 | if (err) | 3796 | if (err) |
3788 | printk("pktgen: WARNING: Cannot create thread for cpu %d (%d)\n", | 3797 | printk(KERN_WARNING "pktgen: WARNING: Cannot create " |
3789 | cpu, err); | 3798 | "thread for cpu %d (%d)\n", cpu, err); |
3790 | } | 3799 | } |
3791 | 3800 | ||
3792 | if (list_empty(&pktgen_threads)) { | 3801 | if (list_empty(&pktgen_threads)) { |
3793 | printk("pktgen: ERROR: Initialization failed for all threads\n"); | 3802 | printk(KERN_ERR "pktgen: ERROR: Initialization failed for " |
3803 | "all threads\n"); | ||
3794 | unregister_netdevice_notifier(&pktgen_notifier_block); | 3804 | unregister_netdevice_notifier(&pktgen_notifier_block); |
3795 | remove_proc_entry(PGCTRL, pg_proc_dir); | 3805 | remove_proc_entry(PGCTRL, pg_proc_dir); |
3796 | proc_net_remove(PG_PROC_DIR); | 3806 | proc_net_remove(PG_PROC_DIR); |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 06eccca8cb5d..4756d5857abf 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -952,7 +952,9 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | |||
952 | struct nlattr *linkinfo[IFLA_INFO_MAX+1]; | 952 | struct nlattr *linkinfo[IFLA_INFO_MAX+1]; |
953 | int err; | 953 | int err; |
954 | 954 | ||
955 | #ifdef CONFIG_KMOD | ||
955 | replay: | 956 | replay: |
957 | #endif | ||
956 | err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy); | 958 | err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy); |
957 | if (err < 0) | 959 | if (err < 0) |
958 | return err; | 960 | return err; |
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index f2a61ef2af9c..a4a620971ef0 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c | |||
@@ -1737,8 +1737,9 @@ static int dn_rt_cache_seq_open(struct inode *inode, struct file *file) | |||
1737 | { | 1737 | { |
1738 | struct seq_file *seq; | 1738 | struct seq_file *seq; |
1739 | int rc = -ENOMEM; | 1739 | int rc = -ENOMEM; |
1740 | struct dn_rt_cache_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL); | 1740 | struct dn_rt_cache_iter_state *s; |
1741 | 1741 | ||
1742 | s = kzalloc(sizeof(*s), GFP_KERNEL); | ||
1742 | if (!s) | 1743 | if (!s) |
1743 | goto out; | 1744 | goto out; |
1744 | rc = seq_open(file, &dn_rt_cache_seq_ops); | 1745 | rc = seq_open(file, &dn_rt_cache_seq_ops); |
@@ -1746,7 +1747,6 @@ static int dn_rt_cache_seq_open(struct inode *inode, struct file *file) | |||
1746 | goto out_kfree; | 1747 | goto out_kfree; |
1747 | seq = file->private_data; | 1748 | seq = file->private_data; |
1748 | seq->private = s; | 1749 | seq->private = s; |
1749 | memset(s, 0, sizeof(*s)); | ||
1750 | out: | 1750 | out: |
1751 | return rc; | 1751 | return rc; |
1752 | out_kfree: | 1752 | out_kfree: |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index abf6352f990f..5b77bdaa57dd 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -1056,10 +1056,9 @@ static int inetdev_event(struct notifier_block *this, unsigned long event, | |||
1056 | if (!in_dev) { | 1056 | if (!in_dev) { |
1057 | if (event == NETDEV_REGISTER) { | 1057 | if (event == NETDEV_REGISTER) { |
1058 | in_dev = inetdev_init(dev); | 1058 | in_dev = inetdev_init(dev); |
1059 | if (!in_dev) | ||
1060 | return notifier_from_errno(-ENOMEM); | ||
1059 | if (dev == &loopback_dev) { | 1061 | if (dev == &loopback_dev) { |
1060 | if (!in_dev) | ||
1061 | panic("devinet: " | ||
1062 | "Failed to create loopback\n"); | ||
1063 | IN_DEV_CONF_SET(in_dev, NOXFRM, 1); | 1062 | IN_DEV_CONF_SET(in_dev, NOXFRM, 1); |
1064 | IN_DEV_CONF_SET(in_dev, NOPOLICY, 1); | 1063 | IN_DEV_CONF_SET(in_dev, NOPOLICY, 1); |
1065 | } | 1064 | } |
diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c index 251346828cb4..2f14745a9e1f 100644 --- a/net/ipv4/ip_options.c +++ b/net/ipv4/ip_options.c | |||
@@ -513,11 +513,8 @@ void ip_options_undo(struct ip_options * opt) | |||
513 | 513 | ||
514 | static struct ip_options *ip_options_get_alloc(const int optlen) | 514 | static struct ip_options *ip_options_get_alloc(const int optlen) |
515 | { | 515 | { |
516 | struct ip_options *opt = kmalloc(sizeof(*opt) + ((optlen + 3) & ~3), | 516 | return kzalloc(sizeof(struct ip_options) + ((optlen + 3) & ~3), |
517 | GFP_KERNEL); | 517 | GFP_KERNEL); |
518 | if (opt) | ||
519 | memset(opt, 0, sizeof(*opt)); | ||
520 | return opt; | ||
521 | } | 518 | } |
522 | 519 | ||
523 | static int ip_options_get_finish(struct ip_options **optp, | 520 | static int ip_options_get_finish(struct ip_options **optp, |
diff --git a/net/ipv4/ipvs/ip_vs_xmit.c b/net/ipv4/ipvs/ip_vs_xmit.c index 900ce29db382..666e080a74a3 100644 --- a/net/ipv4/ipvs/ip_vs_xmit.c +++ b/net/ipv4/ipvs/ip_vs_xmit.c | |||
@@ -128,7 +128,7 @@ ip_vs_dst_reset(struct ip_vs_dest *dest) | |||
128 | #define IP_VS_XMIT(skb, rt) \ | 128 | #define IP_VS_XMIT(skb, rt) \ |
129 | do { \ | 129 | do { \ |
130 | (skb)->ipvs_property = 1; \ | 130 | (skb)->ipvs_property = 1; \ |
131 | (skb)->ip_summed = CHECKSUM_NONE; \ | 131 | skb_forward_csum(skb); \ |
132 | NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, (skb), NULL, \ | 132 | NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, (skb), NULL, \ |
133 | (rt)->u.dst.dev, dst_output); \ | 133 | (rt)->u.dst.dev, dst_output); \ |
134 | } while (0) | 134 | } while (0) |
diff --git a/net/ipv4/tcp_bic.c b/net/ipv4/tcp_bic.c index 519de091a94d..4586211e3757 100644 --- a/net/ipv4/tcp_bic.c +++ b/net/ipv4/tcp_bic.c | |||
@@ -206,7 +206,7 @@ static void bictcp_state(struct sock *sk, u8 new_state) | |||
206 | /* Track delayed acknowledgment ratio using sliding window | 206 | /* Track delayed acknowledgment ratio using sliding window |
207 | * ratio = (15*ratio + sample) / 16 | 207 | * ratio = (15*ratio + sample) / 16 |
208 | */ | 208 | */ |
209 | static void bictcp_acked(struct sock *sk, u32 cnt, ktime_t last) | 209 | static void bictcp_acked(struct sock *sk, u32 cnt, s32 rtt) |
210 | { | 210 | { |
211 | const struct inet_connection_sock *icsk = inet_csk(sk); | 211 | const struct inet_connection_sock *icsk = inet_csk(sk); |
212 | 212 | ||
diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c index d17da30d82d6..485d7ea35f75 100644 --- a/net/ipv4/tcp_cubic.c +++ b/net/ipv4/tcp_cubic.c | |||
@@ -246,38 +246,12 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd) | |||
246 | ca->cnt = 1; | 246 | ca->cnt = 1; |
247 | } | 247 | } |
248 | 248 | ||
249 | |||
250 | /* Keep track of minimum rtt */ | ||
251 | static inline void measure_delay(struct sock *sk) | ||
252 | { | ||
253 | const struct tcp_sock *tp = tcp_sk(sk); | ||
254 | struct bictcp *ca = inet_csk_ca(sk); | ||
255 | u32 delay; | ||
256 | |||
257 | /* No time stamp */ | ||
258 | if (!(tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr) || | ||
259 | /* Discard delay samples right after fast recovery */ | ||
260 | (s32)(tcp_time_stamp - ca->epoch_start) < HZ) | ||
261 | return; | ||
262 | |||
263 | delay = (tcp_time_stamp - tp->rx_opt.rcv_tsecr)<<3; | ||
264 | if (delay == 0) | ||
265 | delay = 1; | ||
266 | |||
267 | /* first time call or link delay decreases */ | ||
268 | if (ca->delay_min == 0 || ca->delay_min > delay) | ||
269 | ca->delay_min = delay; | ||
270 | } | ||
271 | |||
272 | static void bictcp_cong_avoid(struct sock *sk, u32 ack, | 249 | static void bictcp_cong_avoid(struct sock *sk, u32 ack, |
273 | u32 in_flight, int data_acked) | 250 | u32 in_flight, int data_acked) |
274 | { | 251 | { |
275 | struct tcp_sock *tp = tcp_sk(sk); | 252 | struct tcp_sock *tp = tcp_sk(sk); |
276 | struct bictcp *ca = inet_csk_ca(sk); | 253 | struct bictcp *ca = inet_csk_ca(sk); |
277 | 254 | ||
278 | if (data_acked) | ||
279 | measure_delay(sk); | ||
280 | |||
281 | if (!tcp_is_cwnd_limited(sk, in_flight)) | 255 | if (!tcp_is_cwnd_limited(sk, in_flight)) |
282 | return; | 256 | return; |
283 | 257 | ||
@@ -334,17 +308,33 @@ static void bictcp_state(struct sock *sk, u8 new_state) | |||
334 | /* Track delayed acknowledgment ratio using sliding window | 308 | /* Track delayed acknowledgment ratio using sliding window |
335 | * ratio = (15*ratio + sample) / 16 | 309 | * ratio = (15*ratio + sample) / 16 |
336 | */ | 310 | */ |
337 | static void bictcp_acked(struct sock *sk, u32 cnt, ktime_t last) | 311 | static void bictcp_acked(struct sock *sk, u32 cnt, s32 rtt_us) |
338 | { | 312 | { |
339 | const struct inet_connection_sock *icsk = inet_csk(sk); | 313 | const struct inet_connection_sock *icsk = inet_csk(sk); |
314 | struct bictcp *ca = inet_csk_ca(sk); | ||
315 | u32 delay; | ||
340 | 316 | ||
341 | if (cnt > 0 && icsk->icsk_ca_state == TCP_CA_Open) { | 317 | if (cnt > 0 && icsk->icsk_ca_state == TCP_CA_Open) { |
342 | struct bictcp *ca = inet_csk_ca(sk); | ||
343 | cnt -= ca->delayed_ack >> ACK_RATIO_SHIFT; | 318 | cnt -= ca->delayed_ack >> ACK_RATIO_SHIFT; |
344 | ca->delayed_ack += cnt; | 319 | ca->delayed_ack += cnt; |
345 | } | 320 | } |
346 | } | ||
347 | 321 | ||
322 | /* Some calls are for duplicates without timetamps */ | ||
323 | if (rtt_us < 0) | ||
324 | return; | ||
325 | |||
326 | /* Discard delay samples right after fast recovery */ | ||
327 | if ((s32)(tcp_time_stamp - ca->epoch_start) < HZ) | ||
328 | return; | ||
329 | |||
330 | delay = usecs_to_jiffies(rtt_us) << 3; | ||
331 | if (delay == 0) | ||
332 | delay = 1; | ||
333 | |||
334 | /* first time call or link delay decreases */ | ||
335 | if (ca->delay_min == 0 || ca->delay_min > delay) | ||
336 | ca->delay_min = delay; | ||
337 | } | ||
348 | 338 | ||
349 | static struct tcp_congestion_ops cubictcp = { | 339 | static struct tcp_congestion_ops cubictcp = { |
350 | .init = bictcp_init, | 340 | .init = bictcp_init, |
diff --git a/net/ipv4/tcp_htcp.c b/net/ipv4/tcp_htcp.c index 08a02e6045c9..b66556c0a5bd 100644 --- a/net/ipv4/tcp_htcp.c +++ b/net/ipv4/tcp_htcp.c | |||
@@ -76,12 +76,11 @@ static u32 htcp_cwnd_undo(struct sock *sk) | |||
76 | return max(tp->snd_cwnd, (tp->snd_ssthresh << 7) / ca->beta); | 76 | return max(tp->snd_cwnd, (tp->snd_ssthresh << 7) / ca->beta); |
77 | } | 77 | } |
78 | 78 | ||
79 | static inline void measure_rtt(struct sock *sk) | 79 | static inline void measure_rtt(struct sock *sk, u32 srtt) |
80 | { | 80 | { |
81 | const struct inet_connection_sock *icsk = inet_csk(sk); | 81 | const struct inet_connection_sock *icsk = inet_csk(sk); |
82 | const struct tcp_sock *tp = tcp_sk(sk); | 82 | const struct tcp_sock *tp = tcp_sk(sk); |
83 | struct htcp *ca = inet_csk_ca(sk); | 83 | struct htcp *ca = inet_csk_ca(sk); |
84 | u32 srtt = tp->srtt >> 3; | ||
85 | 84 | ||
86 | /* keep track of minimum RTT seen so far, minRTT is zero at first */ | 85 | /* keep track of minimum RTT seen so far, minRTT is zero at first */ |
87 | if (ca->minRTT > srtt || !ca->minRTT) | 86 | if (ca->minRTT > srtt || !ca->minRTT) |
@@ -98,7 +97,7 @@ static inline void measure_rtt(struct sock *sk) | |||
98 | } | 97 | } |
99 | } | 98 | } |
100 | 99 | ||
101 | static void measure_achieved_throughput(struct sock *sk, u32 pkts_acked, ktime_t last) | 100 | static void measure_achieved_throughput(struct sock *sk, u32 pkts_acked, s32 rtt) |
102 | { | 101 | { |
103 | const struct inet_connection_sock *icsk = inet_csk(sk); | 102 | const struct inet_connection_sock *icsk = inet_csk(sk); |
104 | const struct tcp_sock *tp = tcp_sk(sk); | 103 | const struct tcp_sock *tp = tcp_sk(sk); |
@@ -108,6 +107,9 @@ static void measure_achieved_throughput(struct sock *sk, u32 pkts_acked, ktime_t | |||
108 | if (icsk->icsk_ca_state == TCP_CA_Open) | 107 | if (icsk->icsk_ca_state == TCP_CA_Open) |
109 | ca->pkts_acked = pkts_acked; | 108 | ca->pkts_acked = pkts_acked; |
110 | 109 | ||
110 | if (rtt > 0) | ||
111 | measure_rtt(sk, usecs_to_jiffies(rtt)); | ||
112 | |||
111 | if (!use_bandwidth_switch) | 113 | if (!use_bandwidth_switch) |
112 | return; | 114 | return; |
113 | 115 | ||
@@ -237,8 +239,6 @@ static void htcp_cong_avoid(struct sock *sk, u32 ack, | |||
237 | if (tp->snd_cwnd <= tp->snd_ssthresh) | 239 | if (tp->snd_cwnd <= tp->snd_ssthresh) |
238 | tcp_slow_start(tp); | 240 | tcp_slow_start(tp); |
239 | else { | 241 | else { |
240 | measure_rtt(sk); | ||
241 | |||
242 | /* In dangerous area, increase slowly. | 242 | /* In dangerous area, increase slowly. |
243 | * In theory this is tp->snd_cwnd += alpha / tp->snd_cwnd | 243 | * In theory this is tp->snd_cwnd += alpha / tp->snd_cwnd |
244 | */ | 244 | */ |
diff --git a/net/ipv4/tcp_illinois.c b/net/ipv4/tcp_illinois.c index cc5de6f69d46..64f1cbaf96e8 100644 --- a/net/ipv4/tcp_illinois.c +++ b/net/ipv4/tcp_illinois.c | |||
@@ -83,18 +83,16 @@ static void tcp_illinois_init(struct sock *sk) | |||
83 | } | 83 | } |
84 | 84 | ||
85 | /* Measure RTT for each ack. */ | 85 | /* Measure RTT for each ack. */ |
86 | static void tcp_illinois_acked(struct sock *sk, u32 pkts_acked, ktime_t last) | 86 | static void tcp_illinois_acked(struct sock *sk, u32 pkts_acked, s32 rtt) |
87 | { | 87 | { |
88 | struct illinois *ca = inet_csk_ca(sk); | 88 | struct illinois *ca = inet_csk_ca(sk); |
89 | u32 rtt; | ||
90 | 89 | ||
91 | ca->acked = pkts_acked; | 90 | ca->acked = pkts_acked; |
92 | 91 | ||
93 | if (ktime_equal(last, net_invalid_timestamp())) | 92 | /* dup ack, no rtt sample */ |
93 | if (rtt < 0) | ||
94 | return; | 94 | return; |
95 | 95 | ||
96 | rtt = ktime_to_us(net_timedelta(last)); | ||
97 | |||
98 | /* ignore bogus values, this prevents wraparound in alpha math */ | 96 | /* ignore bogus values, this prevents wraparound in alpha math */ |
99 | if (rtt > RTT_MAX) | 97 | if (rtt > RTT_MAX) |
100 | rtt = RTT_MAX; | 98 | rtt = RTT_MAX; |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index fec8a7a4dbaf..378ca8a086a3 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -1851,19 +1851,22 @@ static inline u32 tcp_cwnd_min(const struct sock *sk) | |||
1851 | } | 1851 | } |
1852 | 1852 | ||
1853 | /* Decrease cwnd each second ack. */ | 1853 | /* Decrease cwnd each second ack. */ |
1854 | static void tcp_cwnd_down(struct sock *sk) | 1854 | static void tcp_cwnd_down(struct sock *sk, int flag) |
1855 | { | 1855 | { |
1856 | struct tcp_sock *tp = tcp_sk(sk); | 1856 | struct tcp_sock *tp = tcp_sk(sk); |
1857 | int decr = tp->snd_cwnd_cnt + 1; | 1857 | int decr = tp->snd_cwnd_cnt + 1; |
1858 | 1858 | ||
1859 | tp->snd_cwnd_cnt = decr&1; | 1859 | if ((flag&FLAG_FORWARD_PROGRESS) || |
1860 | decr >>= 1; | 1860 | (IsReno(tp) && !(flag&FLAG_NOT_DUP))) { |
1861 | tp->snd_cwnd_cnt = decr&1; | ||
1862 | decr >>= 1; | ||
1861 | 1863 | ||
1862 | if (decr && tp->snd_cwnd > tcp_cwnd_min(sk)) | 1864 | if (decr && tp->snd_cwnd > tcp_cwnd_min(sk)) |
1863 | tp->snd_cwnd -= decr; | 1865 | tp->snd_cwnd -= decr; |
1864 | 1866 | ||
1865 | tp->snd_cwnd = min(tp->snd_cwnd, tcp_packets_in_flight(tp)+1); | 1867 | tp->snd_cwnd = min(tp->snd_cwnd, tcp_packets_in_flight(tp)+1); |
1866 | tp->snd_cwnd_stamp = tcp_time_stamp; | 1868 | tp->snd_cwnd_stamp = tcp_time_stamp; |
1869 | } | ||
1867 | } | 1870 | } |
1868 | 1871 | ||
1869 | /* Nothing was retransmitted or returned timestamp is less | 1872 | /* Nothing was retransmitted or returned timestamp is less |
@@ -2060,7 +2063,7 @@ static void tcp_try_to_open(struct sock *sk, int flag) | |||
2060 | } | 2063 | } |
2061 | tcp_moderate_cwnd(tp); | 2064 | tcp_moderate_cwnd(tp); |
2062 | } else { | 2065 | } else { |
2063 | tcp_cwnd_down(sk); | 2066 | tcp_cwnd_down(sk, flag); |
2064 | } | 2067 | } |
2065 | } | 2068 | } |
2066 | 2069 | ||
@@ -2109,7 +2112,10 @@ tcp_fastretrans_alert(struct sock *sk, u32 prior_snd_una, | |||
2109 | { | 2112 | { |
2110 | struct inet_connection_sock *icsk = inet_csk(sk); | 2113 | struct inet_connection_sock *icsk = inet_csk(sk); |
2111 | struct tcp_sock *tp = tcp_sk(sk); | 2114 | struct tcp_sock *tp = tcp_sk(sk); |
2112 | int is_dupack = (tp->snd_una == prior_snd_una && !(flag&FLAG_NOT_DUP)); | 2115 | int is_dupack = (tp->snd_una == prior_snd_una && |
2116 | (!(flag&FLAG_NOT_DUP) || | ||
2117 | ((flag&FLAG_DATA_SACKED) && | ||
2118 | (tp->fackets_out > tp->reordering)))); | ||
2113 | 2119 | ||
2114 | /* Some technical things: | 2120 | /* Some technical things: |
2115 | * 1. Reno does not count dupacks (sacked_out) automatically. */ | 2121 | * 1. Reno does not count dupacks (sacked_out) automatically. */ |
@@ -2260,7 +2266,7 @@ tcp_fastretrans_alert(struct sock *sk, u32 prior_snd_una, | |||
2260 | 2266 | ||
2261 | if (is_dupack || tcp_head_timedout(sk)) | 2267 | if (is_dupack || tcp_head_timedout(sk)) |
2262 | tcp_update_scoreboard(sk); | 2268 | tcp_update_scoreboard(sk); |
2263 | tcp_cwnd_down(sk); | 2269 | tcp_cwnd_down(sk, flag); |
2264 | tcp_xmit_retransmit_queue(sk); | 2270 | tcp_xmit_retransmit_queue(sk); |
2265 | } | 2271 | } |
2266 | 2272 | ||
@@ -2490,12 +2496,23 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p) | |||
2490 | tcp_ack_update_rtt(sk, acked, seq_rtt); | 2496 | tcp_ack_update_rtt(sk, acked, seq_rtt); |
2491 | tcp_ack_packets_out(sk); | 2497 | tcp_ack_packets_out(sk); |
2492 | 2498 | ||
2493 | /* Is the ACK triggering packet unambiguous? */ | 2499 | if (ca_ops->pkts_acked) { |
2494 | if (acked & FLAG_RETRANS_DATA_ACKED) | 2500 | s32 rtt_us = -1; |
2495 | last_ackt = net_invalid_timestamp(); | 2501 | |
2502 | /* Is the ACK triggering packet unambiguous? */ | ||
2503 | if (!(acked & FLAG_RETRANS_DATA_ACKED)) { | ||
2504 | /* High resolution needed and available? */ | ||
2505 | if (ca_ops->flags & TCP_CONG_RTT_STAMP && | ||
2506 | !ktime_equal(last_ackt, | ||
2507 | net_invalid_timestamp())) | ||
2508 | rtt_us = ktime_us_delta(ktime_get_real(), | ||
2509 | last_ackt); | ||
2510 | else if (seq_rtt > 0) | ||
2511 | rtt_us = jiffies_to_usecs(seq_rtt); | ||
2512 | } | ||
2496 | 2513 | ||
2497 | if (ca_ops->pkts_acked) | 2514 | ca_ops->pkts_acked(sk, pkts_acked, rtt_us); |
2498 | ca_ops->pkts_acked(sk, pkts_acked, last_ackt); | 2515 | } |
2499 | } | 2516 | } |
2500 | 2517 | ||
2501 | #if FASTRETRANS_DEBUG > 0 | 2518 | #if FASTRETRANS_DEBUG > 0 |
diff --git a/net/ipv4/tcp_lp.c b/net/ipv4/tcp_lp.c index 80e140e3ec2d..e7f5ef92cbd8 100644 --- a/net/ipv4/tcp_lp.c +++ b/net/ipv4/tcp_lp.c | |||
@@ -260,13 +260,13 @@ static void tcp_lp_rtt_sample(struct sock *sk, u32 rtt) | |||
260 | * newReno in increase case. | 260 | * newReno in increase case. |
261 | * We work it out by following the idea from TCP-LP's paper directly | 261 | * We work it out by following the idea from TCP-LP's paper directly |
262 | */ | 262 | */ |
263 | static void tcp_lp_pkts_acked(struct sock *sk, u32 num_acked, ktime_t last) | 263 | static void tcp_lp_pkts_acked(struct sock *sk, u32 num_acked, s32 rtt_us) |
264 | { | 264 | { |
265 | struct tcp_sock *tp = tcp_sk(sk); | 265 | struct tcp_sock *tp = tcp_sk(sk); |
266 | struct lp *lp = inet_csk_ca(sk); | 266 | struct lp *lp = inet_csk_ca(sk); |
267 | 267 | ||
268 | if (!ktime_equal(last, net_invalid_timestamp())) | 268 | if (rtt_us > 0) |
269 | tcp_lp_rtt_sample(sk, ktime_to_us(net_timedelta(last))); | 269 | tcp_lp_rtt_sample(sk, rtt_us); |
270 | 270 | ||
271 | /* calc inference */ | 271 | /* calc inference */ |
272 | if (tcp_time_stamp > tp->rx_opt.rcv_tsecr) | 272 | if (tcp_time_stamp > tp->rx_opt.rcv_tsecr) |
diff --git a/net/ipv4/tcp_vegas.c b/net/ipv4/tcp_vegas.c index 914e0307f7af..b49dedcda52d 100644 --- a/net/ipv4/tcp_vegas.c +++ b/net/ipv4/tcp_vegas.c | |||
@@ -112,16 +112,16 @@ EXPORT_SYMBOL_GPL(tcp_vegas_init); | |||
112 | * o min-filter RTT samples from a much longer window (forever for now) | 112 | * o min-filter RTT samples from a much longer window (forever for now) |
113 | * to find the propagation delay (baseRTT) | 113 | * to find the propagation delay (baseRTT) |
114 | */ | 114 | */ |
115 | void tcp_vegas_pkts_acked(struct sock *sk, u32 cnt, ktime_t last) | 115 | void tcp_vegas_pkts_acked(struct sock *sk, u32 cnt, s32 rtt_us) |
116 | { | 116 | { |
117 | struct vegas *vegas = inet_csk_ca(sk); | 117 | struct vegas *vegas = inet_csk_ca(sk); |
118 | u32 vrtt; | 118 | u32 vrtt; |
119 | 119 | ||
120 | if (ktime_equal(last, net_invalid_timestamp())) | 120 | if (rtt_us < 0) |
121 | return; | 121 | return; |
122 | 122 | ||
123 | /* Never allow zero rtt or baseRTT */ | 123 | /* Never allow zero rtt or baseRTT */ |
124 | vrtt = ktime_to_us(net_timedelta(last)) + 1; | 124 | vrtt = rtt_us + 1; |
125 | 125 | ||
126 | /* Filter to find propagation delay: */ | 126 | /* Filter to find propagation delay: */ |
127 | if (vrtt < vegas->baseRTT) | 127 | if (vrtt < vegas->baseRTT) |
diff --git a/net/ipv4/tcp_vegas.h b/net/ipv4/tcp_vegas.h index 502fa8183634..6c0eea2f8249 100644 --- a/net/ipv4/tcp_vegas.h +++ b/net/ipv4/tcp_vegas.h | |||
@@ -17,7 +17,7 @@ struct vegas { | |||
17 | 17 | ||
18 | extern void tcp_vegas_init(struct sock *sk); | 18 | extern void tcp_vegas_init(struct sock *sk); |
19 | extern void tcp_vegas_state(struct sock *sk, u8 ca_state); | 19 | extern void tcp_vegas_state(struct sock *sk, u8 ca_state); |
20 | extern void tcp_vegas_pkts_acked(struct sock *sk, u32 cnt, ktime_t last); | 20 | extern void tcp_vegas_pkts_acked(struct sock *sk, u32 cnt, s32 rtt_us); |
21 | extern void tcp_vegas_cwnd_event(struct sock *sk, enum tcp_ca_event event); | 21 | extern void tcp_vegas_cwnd_event(struct sock *sk, enum tcp_ca_event event); |
22 | extern void tcp_vegas_get_info(struct sock *sk, u32 ext, struct sk_buff *skb); | 22 | extern void tcp_vegas_get_info(struct sock *sk, u32 ext, struct sk_buff *skb); |
23 | 23 | ||
diff --git a/net/ipv4/tcp_veno.c b/net/ipv4/tcp_veno.c index 7a55ddf86032..8fb2aee0b1a4 100644 --- a/net/ipv4/tcp_veno.c +++ b/net/ipv4/tcp_veno.c | |||
@@ -69,16 +69,16 @@ static void tcp_veno_init(struct sock *sk) | |||
69 | } | 69 | } |
70 | 70 | ||
71 | /* Do rtt sampling needed for Veno. */ | 71 | /* Do rtt sampling needed for Veno. */ |
72 | static void tcp_veno_pkts_acked(struct sock *sk, u32 cnt, ktime_t last) | 72 | static void tcp_veno_pkts_acked(struct sock *sk, u32 cnt, s32 rtt_us) |
73 | { | 73 | { |
74 | struct veno *veno = inet_csk_ca(sk); | 74 | struct veno *veno = inet_csk_ca(sk); |
75 | u32 vrtt; | 75 | u32 vrtt; |
76 | 76 | ||
77 | if (ktime_equal(last, net_invalid_timestamp())) | 77 | if (rtt_us < 0) |
78 | return; | 78 | return; |
79 | 79 | ||
80 | /* Never allow zero rtt or baseRTT */ | 80 | /* Never allow zero rtt or baseRTT */ |
81 | vrtt = ktime_to_us(net_timedelta(last)) + 1; | 81 | vrtt = rtt_us + 1; |
82 | 82 | ||
83 | /* Filter to find propagation delay: */ | 83 | /* Filter to find propagation delay: */ |
84 | if (vrtt < veno->basertt) | 84 | if (vrtt < veno->basertt) |
diff --git a/net/ipv4/tcp_westwood.c b/net/ipv4/tcp_westwood.c index e61e09dd513e..20151d6a6241 100644 --- a/net/ipv4/tcp_westwood.c +++ b/net/ipv4/tcp_westwood.c | |||
@@ -100,11 +100,12 @@ static void westwood_filter(struct westwood *w, u32 delta) | |||
100 | * Called after processing group of packets. | 100 | * Called after processing group of packets. |
101 | * but all westwood needs is the last sample of srtt. | 101 | * but all westwood needs is the last sample of srtt. |
102 | */ | 102 | */ |
103 | static void tcp_westwood_pkts_acked(struct sock *sk, u32 cnt, ktime_t last) | 103 | static void tcp_westwood_pkts_acked(struct sock *sk, u32 cnt, s32 rtt) |
104 | { | 104 | { |
105 | struct westwood *w = inet_csk_ca(sk); | 105 | struct westwood *w = inet_csk_ca(sk); |
106 | if (cnt > 0) | 106 | |
107 | w->rtt = tcp_sk(sk)->srtt >> 3; | 107 | if (rtt > 0) |
108 | w->rtt = usecs_to_jiffies(rtt); | ||
108 | } | 109 | } |
109 | 110 | ||
110 | /* | 111 | /* |
diff --git a/net/ipv4/tcp_yeah.c b/net/ipv4/tcp_yeah.c index c04b7c6ec702..c107fba7430e 100644 --- a/net/ipv4/tcp_yeah.c +++ b/net/ipv4/tcp_yeah.c | |||
@@ -58,7 +58,7 @@ static void tcp_yeah_init(struct sock *sk) | |||
58 | } | 58 | } |
59 | 59 | ||
60 | 60 | ||
61 | static void tcp_yeah_pkts_acked(struct sock *sk, u32 pkts_acked, ktime_t last) | 61 | static void tcp_yeah_pkts_acked(struct sock *sk, u32 pkts_acked, s32 rtt_us) |
62 | { | 62 | { |
63 | const struct inet_connection_sock *icsk = inet_csk(sk); | 63 | const struct inet_connection_sock *icsk = inet_csk(sk); |
64 | struct yeah *yeah = inet_csk_ca(sk); | 64 | struct yeah *yeah = inet_csk_ca(sk); |
@@ -66,7 +66,7 @@ static void tcp_yeah_pkts_acked(struct sock *sk, u32 pkts_acked, ktime_t last) | |||
66 | if (icsk->icsk_ca_state == TCP_CA_Open) | 66 | if (icsk->icsk_ca_state == TCP_CA_Open) |
67 | yeah->pkts_acked = pkts_acked; | 67 | yeah->pkts_acked = pkts_acked; |
68 | 68 | ||
69 | tcp_vegas_pkts_acked(sk, pkts_acked, last); | 69 | tcp_vegas_pkts_acked(sk, pkts_acked, rtt_us); |
70 | } | 70 | } |
71 | 71 | ||
72 | static void tcp_yeah_cong_avoid(struct sock *sk, u32 ack, | 72 | static void tcp_yeah_cong_avoid(struct sock *sk, u32 ack, |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 06012920912a..91ef3be5abad 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -2256,14 +2256,14 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event, | |||
2256 | struct net_device *dev = (struct net_device *) data; | 2256 | struct net_device *dev = (struct net_device *) data; |
2257 | struct inet6_dev *idev = __in6_dev_get(dev); | 2257 | struct inet6_dev *idev = __in6_dev_get(dev); |
2258 | int run_pending = 0; | 2258 | int run_pending = 0; |
2259 | int err; | ||
2259 | 2260 | ||
2260 | switch(event) { | 2261 | switch(event) { |
2261 | case NETDEV_REGISTER: | 2262 | case NETDEV_REGISTER: |
2262 | if (!idev && dev->mtu >= IPV6_MIN_MTU) { | 2263 | if (!idev && dev->mtu >= IPV6_MIN_MTU) { |
2263 | idev = ipv6_add_dev(dev); | 2264 | idev = ipv6_add_dev(dev); |
2264 | if (!idev) | 2265 | if (!idev) |
2265 | printk(KERN_WARNING "IPv6: add_dev failed for %s\n", | 2266 | return notifier_from_errno(-ENOMEM); |
2266 | dev->name); | ||
2267 | } | 2267 | } |
2268 | break; | 2268 | break; |
2269 | case NETDEV_UP: | 2269 | case NETDEV_UP: |
@@ -2373,7 +2373,9 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event, | |||
2373 | NULL); | 2373 | NULL); |
2374 | addrconf_sysctl_register(idev, &idev->cnf); | 2374 | addrconf_sysctl_register(idev, &idev->cnf); |
2375 | #endif | 2375 | #endif |
2376 | snmp6_register_dev(idev); | 2376 | err = snmp6_register_dev(idev); |
2377 | if (err) | ||
2378 | return notifier_from_errno(err); | ||
2377 | } | 2379 | } |
2378 | break; | 2380 | break; |
2379 | } | 2381 | } |
diff --git a/net/ipv6/addrconf_core.c b/net/ipv6/addrconf_core.c index faaefb692298..3f82e9542eda 100644 --- a/net/ipv6/addrconf_core.c +++ b/net/ipv6/addrconf_core.c | |||
@@ -50,6 +50,9 @@ int __ipv6_addr_type(const struct in6_addr *addr) | |||
50 | if ((st & htonl(0xFFC00000)) == htonl(0xFEC00000)) | 50 | if ((st & htonl(0xFFC00000)) == htonl(0xFEC00000)) |
51 | return (IPV6_ADDR_SITELOCAL | IPV6_ADDR_UNICAST | | 51 | return (IPV6_ADDR_SITELOCAL | IPV6_ADDR_UNICAST | |
52 | IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_SITELOCAL)); /* addr-select 3.1 */ | 52 | IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_SITELOCAL)); /* addr-select 3.1 */ |
53 | if ((st & htonl(0xFE000000)) == htonl(0xFC000000)) | ||
54 | return (IPV6_ADDR_UNICAST | | ||
55 | IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_GLOBAL)); /* RFC 4193 */ | ||
53 | 56 | ||
54 | if ((addr->s6_addr32[0] | addr->s6_addr32[1]) == 0) { | 57 | if ((addr->s6_addr32[0] | addr->s6_addr32[1]) == 0) { |
55 | if (addr->s6_addr32[2] == 0) { | 58 | if (addr->s6_addr32[2] == 0) { |
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c index 36df2218b669..3153e15e0f7c 100644 --- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c +++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | |||
@@ -86,8 +86,8 @@ static int ipv6_print_conntrack(struct seq_file *s, | |||
86 | * - Note also special handling of AUTH header. Thanks to IPsec wizards. | 86 | * - Note also special handling of AUTH header. Thanks to IPsec wizards. |
87 | */ | 87 | */ |
88 | 88 | ||
89 | int nf_ct_ipv6_skip_exthdr(const struct sk_buff *skb, int start, u8 *nexthdrp, | 89 | static int nf_ct_ipv6_skip_exthdr(const struct sk_buff *skb, int start, |
90 | int len) | 90 | u8 *nexthdrp, int len) |
91 | { | 91 | { |
92 | u8 nexthdr = *nexthdrp; | 92 | u8 nexthdr = *nexthdrp; |
93 | 93 | ||
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 919de682b331..55ea80fac601 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -1983,9 +1983,10 @@ static int rt6_mtu_change_route(struct rt6_info *rt, void *p_arg) | |||
1983 | !dst_metric_locked(&rt->u.dst, RTAX_MTU) && | 1983 | !dst_metric_locked(&rt->u.dst, RTAX_MTU) && |
1984 | (dst_mtu(&rt->u.dst) > arg->mtu || | 1984 | (dst_mtu(&rt->u.dst) > arg->mtu || |
1985 | (dst_mtu(&rt->u.dst) < arg->mtu && | 1985 | (dst_mtu(&rt->u.dst) < arg->mtu && |
1986 | dst_mtu(&rt->u.dst) == idev->cnf.mtu6))) | 1986 | dst_mtu(&rt->u.dst) == idev->cnf.mtu6))) { |
1987 | rt->u.dst.metrics[RTAX_MTU-1] = arg->mtu; | 1987 | rt->u.dst.metrics[RTAX_MTU-1] = arg->mtu; |
1988 | rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(arg->mtu); | 1988 | rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(arg->mtu); |
1989 | } | ||
1989 | return 0; | 1990 | return 0; |
1990 | } | 1991 | } |
1991 | 1992 | ||
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 13c09bc32aa3..dee0d5fb39c5 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -380,6 +380,10 @@ void qdisc_tree_decrease_qlen(struct Qdisc *sch, unsigned int n) | |||
380 | return; | 380 | return; |
381 | while ((parentid = sch->parent)) { | 381 | while ((parentid = sch->parent)) { |
382 | sch = qdisc_lookup(sch->dev, TC_H_MAJ(parentid)); | 382 | sch = qdisc_lookup(sch->dev, TC_H_MAJ(parentid)); |
383 | if (sch == NULL) { | ||
384 | WARN_ON(parentid != TC_H_ROOT); | ||
385 | return; | ||
386 | } | ||
383 | cops = sch->ops->cl_ops; | 387 | cops = sch->ops->cl_ops; |
384 | if (cops->qlen_notify) { | 388 | if (cops->qlen_notify) { |
385 | cl = cops->get(sch, parentid); | 389 | cl = cops->get(sch, parentid); |
@@ -420,8 +424,6 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent, | |||
420 | unsigned long cl = cops->get(parent, classid); | 424 | unsigned long cl = cops->get(parent, classid); |
421 | if (cl) { | 425 | if (cl) { |
422 | err = cops->graft(parent, cl, new, old); | 426 | err = cops->graft(parent, cl, new, old); |
423 | if (new) | ||
424 | new->parent = classid; | ||
425 | cops->put(parent, cl); | 427 | cops->put(parent, cl); |
426 | } | 428 | } |
427 | } | 429 | } |
@@ -436,7 +438,8 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent, | |||
436 | */ | 438 | */ |
437 | 439 | ||
438 | static struct Qdisc * | 440 | static struct Qdisc * |
439 | qdisc_create(struct net_device *dev, u32 handle, struct rtattr **tca, int *errp) | 441 | qdisc_create(struct net_device *dev, u32 parent, u32 handle, |
442 | struct rtattr **tca, int *errp) | ||
440 | { | 443 | { |
441 | int err; | 444 | int err; |
442 | struct rtattr *kind = tca[TCA_KIND-1]; | 445 | struct rtattr *kind = tca[TCA_KIND-1]; |
@@ -482,6 +485,8 @@ qdisc_create(struct net_device *dev, u32 handle, struct rtattr **tca, int *errp) | |||
482 | goto err_out2; | 485 | goto err_out2; |
483 | } | 486 | } |
484 | 487 | ||
488 | sch->parent = parent; | ||
489 | |||
485 | if (handle == TC_H_INGRESS) { | 490 | if (handle == TC_H_INGRESS) { |
486 | sch->flags |= TCQ_F_INGRESS; | 491 | sch->flags |= TCQ_F_INGRESS; |
487 | sch->stats_lock = &dev->ingress_lock; | 492 | sch->stats_lock = &dev->ingress_lock; |
@@ -758,9 +763,11 @@ create_n_graft: | |||
758 | if (!(n->nlmsg_flags&NLM_F_CREATE)) | 763 | if (!(n->nlmsg_flags&NLM_F_CREATE)) |
759 | return -ENOENT; | 764 | return -ENOENT; |
760 | if (clid == TC_H_INGRESS) | 765 | if (clid == TC_H_INGRESS) |
761 | q = qdisc_create(dev, tcm->tcm_parent, tca, &err); | 766 | q = qdisc_create(dev, tcm->tcm_parent, tcm->tcm_parent, |
767 | tca, &err); | ||
762 | else | 768 | else |
763 | q = qdisc_create(dev, tcm->tcm_handle, tca, &err); | 769 | q = qdisc_create(dev, tcm->tcm_parent, tcm->tcm_handle, |
770 | tca, &err); | ||
764 | if (q == NULL) { | 771 | if (q == NULL) { |
765 | if (err == -EAGAIN) | 772 | if (err == -EAGAIN) |
766 | goto replay; | 773 | goto replay; |
diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c index 51f16b0af198..2d32fd27496e 100644 --- a/net/sched/sch_ingress.c +++ b/net/sched/sch_ingress.c | |||
@@ -158,9 +158,8 @@ static int ingress_enqueue(struct sk_buff *skb,struct Qdisc *sch) | |||
158 | break; | 158 | break; |
159 | case TC_ACT_RECLASSIFY: | 159 | case TC_ACT_RECLASSIFY: |
160 | case TC_ACT_OK: | 160 | case TC_ACT_OK: |
161 | case TC_ACT_UNSPEC: | ||
162 | default: | ||
163 | skb->tc_index = TC_H_MIN(res.classid); | 161 | skb->tc_index = TC_H_MIN(res.classid); |
162 | default: | ||
164 | result = TC_ACT_OK; | 163 | result = TC_ACT_OK; |
165 | break; | 164 | break; |
166 | } | 165 | } |
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c index 2d8c08493d6e..4a49db65772e 100644 --- a/net/sched/sch_prio.c +++ b/net/sched/sch_prio.c | |||
@@ -38,9 +38,11 @@ prio_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr) | |||
38 | struct prio_sched_data *q = qdisc_priv(sch); | 38 | struct prio_sched_data *q = qdisc_priv(sch); |
39 | u32 band = skb->priority; | 39 | u32 band = skb->priority; |
40 | struct tcf_result res; | 40 | struct tcf_result res; |
41 | int err; | ||
41 | 42 | ||
42 | *qerr = NET_XMIT_BYPASS; | 43 | *qerr = NET_XMIT_BYPASS; |
43 | if (TC_H_MAJ(skb->priority) != sch->handle) { | 44 | if (TC_H_MAJ(skb->priority) != sch->handle) { |
45 | err = tc_classify(skb, q->filter_list, &res); | ||
44 | #ifdef CONFIG_NET_CLS_ACT | 46 | #ifdef CONFIG_NET_CLS_ACT |
45 | switch (tc_classify(skb, q->filter_list, &res)) { | 47 | switch (tc_classify(skb, q->filter_list, &res)) { |
46 | case TC_ACT_STOLEN: | 48 | case TC_ACT_STOLEN: |
@@ -49,11 +51,8 @@ prio_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr) | |||
49 | case TC_ACT_SHOT: | 51 | case TC_ACT_SHOT: |
50 | return NULL; | 52 | return NULL; |
51 | } | 53 | } |
52 | |||
53 | if (!q->filter_list ) { | ||
54 | #else | ||
55 | if (!q->filter_list || tc_classify(skb, q->filter_list, &res)) { | ||
56 | #endif | 54 | #endif |
55 | if (!q->filter_list || err < 0) { | ||
57 | if (TC_H_MAJ(band)) | 56 | if (TC_H_MAJ(band)) |
58 | band = 0; | 57 | band = 0; |
59 | band = q->prio2band[band&TC_PRIO_MAX]; | 58 | band = q->prio2band[band&TC_PRIO_MAX]; |
@@ -239,11 +238,13 @@ static int prio_tune(struct Qdisc *sch, struct rtattr *opt) | |||
239 | /* If we're multiqueue, make sure the number of incoming bands | 238 | /* If we're multiqueue, make sure the number of incoming bands |
240 | * matches the number of queues on the device we're associating with. | 239 | * matches the number of queues on the device we're associating with. |
241 | * If the number of bands requested is zero, then set q->bands to | 240 | * If the number of bands requested is zero, then set q->bands to |
242 | * dev->egress_subqueue_count. | 241 | * dev->egress_subqueue_count. Also, the root qdisc must be the |
242 | * only one that is enabled for multiqueue, since it's the only one | ||
243 | * that interacts with the underlying device. | ||
243 | */ | 244 | */ |
244 | q->mq = RTA_GET_FLAG(tb[TCA_PRIO_MQ - 1]); | 245 | q->mq = RTA_GET_FLAG(tb[TCA_PRIO_MQ - 1]); |
245 | if (q->mq) { | 246 | if (q->mq) { |
246 | if (sch->handle != TC_H_ROOT) | 247 | if (sch->parent != TC_H_ROOT) |
247 | return -EINVAL; | 248 | return -EINVAL; |
248 | if (netif_is_multiqueue(sch->dev)) { | 249 | if (netif_is_multiqueue(sch->dev)) { |
249 | if (q->bands == 0) | 250 | if (q->bands == 0) |
diff --git a/net/tipc/link.c b/net/tipc/link.c index 5adfdfd49d61..1d674e0848fa 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c | |||
@@ -423,6 +423,17 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer, | |||
423 | return NULL; | 423 | return NULL; |
424 | } | 424 | } |
425 | 425 | ||
426 | if (LINK_LOG_BUF_SIZE) { | ||
427 | char *pb = kmalloc(LINK_LOG_BUF_SIZE, GFP_ATOMIC); | ||
428 | |||
429 | if (!pb) { | ||
430 | kfree(l_ptr); | ||
431 | warn("Link creation failed, no memory for print buffer\n"); | ||
432 | return NULL; | ||
433 | } | ||
434 | tipc_printbuf_init(&l_ptr->print_buf, pb, LINK_LOG_BUF_SIZE); | ||
435 | } | ||
436 | |||
426 | l_ptr->addr = peer; | 437 | l_ptr->addr = peer; |
427 | if_name = strchr(b_ptr->publ.name, ':') + 1; | 438 | if_name = strchr(b_ptr->publ.name, ':') + 1; |
428 | sprintf(l_ptr->name, "%u.%u.%u:%s-%u.%u.%u:", | 439 | sprintf(l_ptr->name, "%u.%u.%u:%s-%u.%u.%u:", |
@@ -432,8 +443,6 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer, | |||
432 | tipc_zone(peer), tipc_cluster(peer), tipc_node(peer)); | 443 | tipc_zone(peer), tipc_cluster(peer), tipc_node(peer)); |
433 | /* note: peer i/f is appended to link name by reset/activate */ | 444 | /* note: peer i/f is appended to link name by reset/activate */ |
434 | memcpy(&l_ptr->media_addr, media_addr, sizeof(*media_addr)); | 445 | memcpy(&l_ptr->media_addr, media_addr, sizeof(*media_addr)); |
435 | k_init_timer(&l_ptr->timer, (Handler)link_timeout, (unsigned long)l_ptr); | ||
436 | list_add_tail(&l_ptr->link_list, &b_ptr->links); | ||
437 | l_ptr->checkpoint = 1; | 446 | l_ptr->checkpoint = 1; |
438 | l_ptr->b_ptr = b_ptr; | 447 | l_ptr->b_ptr = b_ptr; |
439 | link_set_supervision_props(l_ptr, b_ptr->media->tolerance); | 448 | link_set_supervision_props(l_ptr, b_ptr->media->tolerance); |
@@ -459,21 +468,14 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer, | |||
459 | 468 | ||
460 | l_ptr->owner = tipc_node_attach_link(l_ptr); | 469 | l_ptr->owner = tipc_node_attach_link(l_ptr); |
461 | if (!l_ptr->owner) { | 470 | if (!l_ptr->owner) { |
471 | if (LINK_LOG_BUF_SIZE) | ||
472 | kfree(l_ptr->print_buf.buf); | ||
462 | kfree(l_ptr); | 473 | kfree(l_ptr); |
463 | return NULL; | 474 | return NULL; |
464 | } | 475 | } |
465 | 476 | ||
466 | if (LINK_LOG_BUF_SIZE) { | 477 | k_init_timer(&l_ptr->timer, (Handler)link_timeout, (unsigned long)l_ptr); |
467 | char *pb = kmalloc(LINK_LOG_BUF_SIZE, GFP_ATOMIC); | 478 | list_add_tail(&l_ptr->link_list, &b_ptr->links); |
468 | |||
469 | if (!pb) { | ||
470 | kfree(l_ptr); | ||
471 | warn("Link creation failed, no memory for print buffer\n"); | ||
472 | return NULL; | ||
473 | } | ||
474 | tipc_printbuf_init(&l_ptr->print_buf, pb, LINK_LOG_BUF_SIZE); | ||
475 | } | ||
476 | |||
477 | tipc_k_signal((Handler)tipc_link_start, (unsigned long)l_ptr); | 479 | tipc_k_signal((Handler)tipc_link_start, (unsigned long)l_ptr); |
478 | 480 | ||
479 | dbg("tipc_link_create(): tolerance = %u,cont intv = %u, abort_limit = %u\n", | 481 | dbg("tipc_link_create(): tolerance = %u,cont intv = %u, abort_limit = %u\n", |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 65ebccc0a698..a05c34260e70 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -118,14 +118,40 @@ | |||
118 | 118 | ||
119 | int sysctl_unix_max_dgram_qlen __read_mostly = 10; | 119 | int sysctl_unix_max_dgram_qlen __read_mostly = 10; |
120 | 120 | ||
121 | struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1]; | 121 | static struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1]; |
122 | DEFINE_SPINLOCK(unix_table_lock); | 122 | static DEFINE_SPINLOCK(unix_table_lock); |
123 | static atomic_t unix_nr_socks = ATOMIC_INIT(0); | 123 | static atomic_t unix_nr_socks = ATOMIC_INIT(0); |
124 | 124 | ||
125 | #define unix_sockets_unbound (&unix_socket_table[UNIX_HASH_SIZE]) | 125 | #define unix_sockets_unbound (&unix_socket_table[UNIX_HASH_SIZE]) |
126 | 126 | ||
127 | #define UNIX_ABSTRACT(sk) (unix_sk(sk)->addr->hash != UNIX_HASH_SIZE) | 127 | #define UNIX_ABSTRACT(sk) (unix_sk(sk)->addr->hash != UNIX_HASH_SIZE) |
128 | 128 | ||
129 | static struct sock *first_unix_socket(int *i) | ||
130 | { | ||
131 | for (*i = 0; *i <= UNIX_HASH_SIZE; (*i)++) { | ||
132 | if (!hlist_empty(&unix_socket_table[*i])) | ||
133 | return __sk_head(&unix_socket_table[*i]); | ||
134 | } | ||
135 | return NULL; | ||
136 | } | ||
137 | |||
138 | static struct sock *next_unix_socket(int *i, struct sock *s) | ||
139 | { | ||
140 | struct sock *next = sk_next(s); | ||
141 | /* More in this chain? */ | ||
142 | if (next) | ||
143 | return next; | ||
144 | /* Look for next non-empty chain. */ | ||
145 | for ((*i)++; *i <= UNIX_HASH_SIZE; (*i)++) { | ||
146 | if (!hlist_empty(&unix_socket_table[*i])) | ||
147 | return __sk_head(&unix_socket_table[*i]); | ||
148 | } | ||
149 | return NULL; | ||
150 | } | ||
151 | |||
152 | #define forall_unix_sockets(i, s) \ | ||
153 | for (s = first_unix_socket(&(i)); s; s = next_unix_socket(&(i),(s))) | ||
154 | |||
129 | #ifdef CONFIG_SECURITY_NETWORK | 155 | #ifdef CONFIG_SECURITY_NETWORK |
130 | static void unix_get_secdata(struct scm_cookie *scm, struct sk_buff *skb) | 156 | static void unix_get_secdata(struct scm_cookie *scm, struct sk_buff *skb) |
131 | { | 157 | { |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index c3a4b0a18687..95a47304336d 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -1299,7 +1299,8 @@ xfrm_tmpl_resolve_one(struct xfrm_policy *policy, struct flowi *fl, | |||
1299 | xfrm_address_t *local = saddr; | 1299 | xfrm_address_t *local = saddr; |
1300 | struct xfrm_tmpl *tmpl = &policy->xfrm_vec[i]; | 1300 | struct xfrm_tmpl *tmpl = &policy->xfrm_vec[i]; |
1301 | 1301 | ||
1302 | if (tmpl->mode == XFRM_MODE_TUNNEL) { | 1302 | if (tmpl->mode == XFRM_MODE_TUNNEL || |
1303 | tmpl->mode == XFRM_MODE_BEET) { | ||
1303 | remote = &tmpl->id.daddr; | 1304 | remote = &tmpl->id.daddr; |
1304 | local = &tmpl->saddr; | 1305 | local = &tmpl->saddr; |
1305 | family = tmpl->encap_family; | 1306 | family = tmpl->encap_family; |
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 38f90ca75b1e..31be405efb55 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -611,7 +611,7 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, | |||
611 | selector. | 611 | selector. |
612 | */ | 612 | */ |
613 | if (x->km.state == XFRM_STATE_VALID) { | 613 | if (x->km.state == XFRM_STATE_VALID) { |
614 | if (!xfrm_selector_match(&x->sel, fl, family) || | 614 | if (!xfrm_selector_match(&x->sel, fl, x->sel.family) || |
615 | !security_xfrm_state_pol_flow_match(x, pol, fl)) | 615 | !security_xfrm_state_pol_flow_match(x, pol, fl)) |
616 | continue; | 616 | continue; |
617 | if (!best || | 617 | if (!best || |
@@ -623,7 +623,7 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, | |||
623 | acquire_in_progress = 1; | 623 | acquire_in_progress = 1; |
624 | } else if (x->km.state == XFRM_STATE_ERROR || | 624 | } else if (x->km.state == XFRM_STATE_ERROR || |
625 | x->km.state == XFRM_STATE_EXPIRED) { | 625 | x->km.state == XFRM_STATE_EXPIRED) { |
626 | if (xfrm_selector_match(&x->sel, fl, family) && | 626 | if (xfrm_selector_match(&x->sel, fl, x->sel.family) && |
627 | security_xfrm_state_pol_flow_match(x, pol, fl)) | 627 | security_xfrm_state_pol_flow_match(x, pol, fl)) |
628 | error = -ESRCH; | 628 | error = -ESRCH; |
629 | } | 629 | } |
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index c06883bf620e..61339e17a0f5 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -322,6 +322,13 @@ static void copy_from_user_state(struct xfrm_state *x, struct xfrm_usersa_info * | |||
322 | x->props.family = p->family; | 322 | x->props.family = p->family; |
323 | memcpy(&x->props.saddr, &p->saddr, sizeof(x->props.saddr)); | 323 | memcpy(&x->props.saddr, &p->saddr, sizeof(x->props.saddr)); |
324 | x->props.flags = p->flags; | 324 | x->props.flags = p->flags; |
325 | |||
326 | /* | ||
327 | * Set inner address family if the KM left it as zero. | ||
328 | * See comment in validate_tmpl. | ||
329 | */ | ||
330 | if (!x->sel.family) | ||
331 | x->sel.family = p->family; | ||
325 | } | 332 | } |
326 | 333 | ||
327 | /* | 334 | /* |