diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-13 21:17:26 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-13 21:17:26 -0500 |
commit | 551a10c7fc14640d484ee3dda699758041d8123f (patch) | |
tree | d04cb9a72b97aa4abac9e82b479be3d721fcbac5 | |
parent | f90203e0cf0d5a8b027d511af318bb3db4758fe2 (diff) | |
parent | 928ba4169dc1d82c83105831f5ddb5472379b440 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6:
[IPSEC]: Fix the address family to refer encap_family
[IPSEC]: changing API of xfrm6_tunnel_register
[IPSEC]: make sit use the xfrm4_tunnel_register
[IPSEC]: Changing API of xfrm4_tunnel_register.
[TCP]: Prevent pseudo garbage in SYN's advertized window
[NET_SCHED]: sch_hfsc: replace ASSERT macro by WARN_ON
[BRIDGE] br_if: Fix oops in port_carrier_check
[NETFILTER]: Clear GSO bits for TCP reset packet
[TG3]: Update copyright, version, and reldate.
[TG3]: Add some tx timeout debug messages.
[TG3]: Use constant for PHY register 0x1e.
[TG3]: Power down 5704 serdes transceiver when shutting down.
[TG3]: 5906 doesn't need to switch to slower clock.
[TG3]: 5722/5756 don't need PHY jitter workaround.
[TG3]: Use lower DMA watermark for 5703.
[TG3]: Save MSI state before suspend.
[XFRM]: Fix IPv4 tunnel mode decapsulation with IPV6=n
[IPV6] HASHTABLES: Use appropriate seed for caluculating ehash index.
-rw-r--r-- | drivers/net/tg3.c | 58 | ||||
-rw-r--r-- | drivers/net/tg3.h | 1 | ||||
-rw-r--r-- | include/net/xfrm.h | 8 | ||||
-rw-r--r-- | net/bridge/br_if.c | 8 | ||||
-rw-r--r-- | net/bridge/br_notify.c | 4 | ||||
-rw-r--r-- | net/ipv4/ipip.c | 6 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_REJECT.c | 4 | ||||
-rw-r--r-- | net/ipv4/tcp_output.c | 4 | ||||
-rw-r--r-- | net/ipv4/tunnel4.c | 50 | ||||
-rw-r--r-- | net/ipv4/xfrm4_input.c | 4 | ||||
-rw-r--r-- | net/ipv4/xfrm4_mode_tunnel.c | 1 | ||||
-rw-r--r-- | net/ipv4/xfrm4_tunnel.c | 29 | ||||
-rw-r--r-- | net/ipv6/Kconfig | 1 | ||||
-rw-r--r-- | net/ipv6/inet6_hashtables.c | 2 | ||||
-rw-r--r-- | net/ipv6/ip6_tunnel.c | 6 | ||||
-rw-r--r-- | net/ipv6/sit.c | 30 | ||||
-rw-r--r-- | net/ipv6/tunnel6.c | 43 | ||||
-rw-r--r-- | net/ipv6/xfrm6_input.c | 3 | ||||
-rw-r--r-- | net/ipv6/xfrm6_tunnel.c | 19 | ||||
-rw-r--r-- | net/sched/sch_hfsc.c | 15 | ||||
-rw-r--r-- | net/xfrm/xfrm_policy.c | 2 |
21 files changed, 226 insertions, 72 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index e136bae61970..81a1c2e1a3f5 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Copyright (C) 2001, 2002, 2003, 2004 David S. Miller (davem@redhat.com) | 4 | * Copyright (C) 2001, 2002, 2003, 2004 David S. Miller (davem@redhat.com) |
5 | * Copyright (C) 2001, 2002, 2003 Jeff Garzik (jgarzik@pobox.com) | 5 | * Copyright (C) 2001, 2002, 2003 Jeff Garzik (jgarzik@pobox.com) |
6 | * Copyright (C) 2004 Sun Microsystems Inc. | 6 | * Copyright (C) 2004 Sun Microsystems Inc. |
7 | * Copyright (C) 2005 Broadcom Corporation. | 7 | * Copyright (C) 2005-2007 Broadcom Corporation. |
8 | * | 8 | * |
9 | * Firmware is: | 9 | * Firmware is: |
10 | * Derived from proprietary unpublished source code, | 10 | * Derived from proprietary unpublished source code, |
@@ -64,8 +64,8 @@ | |||
64 | 64 | ||
65 | #define DRV_MODULE_NAME "tg3" | 65 | #define DRV_MODULE_NAME "tg3" |
66 | #define PFX DRV_MODULE_NAME ": " | 66 | #define PFX DRV_MODULE_NAME ": " |
67 | #define DRV_MODULE_VERSION "3.72" | 67 | #define DRV_MODULE_VERSION "3.73" |
68 | #define DRV_MODULE_RELDATE "January 8, 2007" | 68 | #define DRV_MODULE_RELDATE "February 12, 2007" |
69 | 69 | ||
70 | #define TG3_DEF_MAC_MODE 0 | 70 | #define TG3_DEF_MAC_MODE 0 |
71 | #define TG3_DEF_RX_MODE 0 | 71 | #define TG3_DEF_RX_MODE 0 |
@@ -1175,8 +1175,18 @@ static void tg3_nvram_unlock(struct tg3 *); | |||
1175 | 1175 | ||
1176 | static void tg3_power_down_phy(struct tg3 *tp) | 1176 | static void tg3_power_down_phy(struct tg3 *tp) |
1177 | { | 1177 | { |
1178 | if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) | 1178 | if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) { |
1179 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) { | ||
1180 | u32 sg_dig_ctrl = tr32(SG_DIG_CTRL); | ||
1181 | u32 serdes_cfg = tr32(MAC_SERDES_CFG); | ||
1182 | |||
1183 | sg_dig_ctrl |= | ||
1184 | SG_DIG_USING_HW_AUTONEG | SG_DIG_SOFT_RESET; | ||
1185 | tw32(SG_DIG_CTRL, sg_dig_ctrl); | ||
1186 | tw32(MAC_SERDES_CFG, serdes_cfg | (1 << 15)); | ||
1187 | } | ||
1179 | return; | 1188 | return; |
1189 | } | ||
1180 | 1190 | ||
1181 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { | 1191 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { |
1182 | u32 val; | 1192 | u32 val; |
@@ -1340,7 +1350,8 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state) | |||
1340 | 1350 | ||
1341 | tw32_wait_f(TG3PCI_CLOCK_CTRL, base_val | CLOCK_CTRL_ALTCLK | | 1351 | tw32_wait_f(TG3PCI_CLOCK_CTRL, base_val | CLOCK_CTRL_ALTCLK | |
1342 | CLOCK_CTRL_PWRDOWN_PLL133, 40); | 1352 | CLOCK_CTRL_PWRDOWN_PLL133, 40); |
1343 | } else if (tp->tg3_flags2 & TG3_FLG2_5780_CLASS) { | 1353 | } else if ((tp->tg3_flags2 & TG3_FLG2_5780_CLASS) || |
1354 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)) { | ||
1344 | /* do nothing */ | 1355 | /* do nothing */ |
1345 | } else if (!((tp->tg3_flags2 & TG3_FLG2_5750_PLUS) && | 1356 | } else if (!((tp->tg3_flags2 & TG3_FLG2_5750_PLUS) && |
1346 | (tp->tg3_flags & TG3_FLAG_ENABLE_ASF))) { | 1357 | (tp->tg3_flags & TG3_FLAG_ENABLE_ASF))) { |
@@ -3724,13 +3735,23 @@ out: | |||
3724 | tg3_full_unlock(tp); | 3735 | tg3_full_unlock(tp); |
3725 | } | 3736 | } |
3726 | 3737 | ||
3738 | static void tg3_dump_short_state(struct tg3 *tp) | ||
3739 | { | ||
3740 | printk(KERN_ERR PFX "DEBUG: MAC_TX_STATUS[%08x] MAC_RX_STATUS[%08x]\n", | ||
3741 | tr32(MAC_TX_STATUS), tr32(MAC_RX_STATUS)); | ||
3742 | printk(KERN_ERR PFX "DEBUG: RDMAC_STATUS[%08x] WDMAC_STATUS[%08x]\n", | ||
3743 | tr32(RDMAC_STATUS), tr32(WDMAC_STATUS)); | ||
3744 | } | ||
3745 | |||
3727 | static void tg3_tx_timeout(struct net_device *dev) | 3746 | static void tg3_tx_timeout(struct net_device *dev) |
3728 | { | 3747 | { |
3729 | struct tg3 *tp = netdev_priv(dev); | 3748 | struct tg3 *tp = netdev_priv(dev); |
3730 | 3749 | ||
3731 | if (netif_msg_tx_err(tp)) | 3750 | if (netif_msg_tx_err(tp)) { |
3732 | printk(KERN_ERR PFX "%s: transmit timed out, resetting\n", | 3751 | printk(KERN_ERR PFX "%s: transmit timed out, resetting\n", |
3733 | dev->name); | 3752 | dev->name); |
3753 | tg3_dump_short_state(tp); | ||
3754 | } | ||
3734 | 3755 | ||
3735 | schedule_work(&tp->reset_task); | 3756 | schedule_work(&tp->reset_task); |
3736 | } | 3757 | } |
@@ -6583,8 +6604,9 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
6583 | u32 tmp; | 6604 | u32 tmp; |
6584 | 6605 | ||
6585 | /* Clear CRC stats. */ | 6606 | /* Clear CRC stats. */ |
6586 | if (!tg3_readphy(tp, 0x1e, &tmp)) { | 6607 | if (!tg3_readphy(tp, MII_TG3_TEST1, &tmp)) { |
6587 | tg3_writephy(tp, 0x1e, tmp | 0x8000); | 6608 | tg3_writephy(tp, MII_TG3_TEST1, |
6609 | tmp | MII_TG3_TEST1_CRC_EN); | ||
6588 | tg3_readphy(tp, 0x14, &tmp); | 6610 | tg3_readphy(tp, 0x14, &tmp); |
6589 | } | 6611 | } |
6590 | } | 6612 | } |
@@ -7408,8 +7430,9 @@ static unsigned long calc_crc_errors(struct tg3 *tp) | |||
7408 | u32 val; | 7430 | u32 val; |
7409 | 7431 | ||
7410 | spin_lock_bh(&tp->lock); | 7432 | spin_lock_bh(&tp->lock); |
7411 | if (!tg3_readphy(tp, 0x1e, &val)) { | 7433 | if (!tg3_readphy(tp, MII_TG3_TEST1, &val)) { |
7412 | tg3_writephy(tp, 0x1e, val | 0x8000); | 7434 | tg3_writephy(tp, MII_TG3_TEST1, |
7435 | val | MII_TG3_TEST1_CRC_EN); | ||
7413 | tg3_readphy(tp, 0x14, &val); | 7436 | tg3_readphy(tp, 0x14, &val); |
7414 | } else | 7437 | } else |
7415 | val = 0; | 7438 | val = 0; |
@@ -10779,7 +10802,9 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
10779 | if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) { | 10802 | if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) { |
10780 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 || | 10803 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 || |
10781 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787) { | 10804 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787) { |
10782 | tp->tg3_flags2 |= TG3_FLG2_PHY_JITTER_BUG; | 10805 | if (tp->pdev->device != PCI_DEVICE_ID_TIGON3_5756 && |
10806 | tp->pdev->device != PCI_DEVICE_ID_TIGON3_5722) | ||
10807 | tp->tg3_flags2 |= TG3_FLG2_PHY_JITTER_BUG; | ||
10783 | if (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5755M) | 10808 | if (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5755M) |
10784 | tp->tg3_flags2 |= TG3_FLG2_PHY_ADJUST_TRIM; | 10809 | tp->tg3_flags2 |= TG3_FLG2_PHY_ADJUST_TRIM; |
10785 | } else if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5906) | 10810 | } else if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5906) |
@@ -11314,6 +11339,7 @@ static int __devinit tg3_test_dma(struct tg3 *tp) | |||
11314 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 || | 11339 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 || |
11315 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) { | 11340 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) { |
11316 | u32 ccval = (tr32(TG3PCI_CLOCK_CTRL) & 0x1f); | 11341 | u32 ccval = (tr32(TG3PCI_CLOCK_CTRL) & 0x1f); |
11342 | u32 read_water = 0x7; | ||
11317 | 11343 | ||
11318 | /* If the 5704 is behind the EPB bridge, we can | 11344 | /* If the 5704 is behind the EPB bridge, we can |
11319 | * do the less restrictive ONE_DMA workaround for | 11345 | * do the less restrictive ONE_DMA workaround for |
@@ -11325,8 +11351,13 @@ static int __devinit tg3_test_dma(struct tg3 *tp) | |||
11325 | else if (ccval == 0x6 || ccval == 0x7) | 11351 | else if (ccval == 0x6 || ccval == 0x7) |
11326 | tp->dma_rwctrl |= DMA_RWCTRL_ONE_DMA; | 11352 | tp->dma_rwctrl |= DMA_RWCTRL_ONE_DMA; |
11327 | 11353 | ||
11354 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) | ||
11355 | read_water = 4; | ||
11328 | /* Set bit 23 to enable PCIX hw bug fix */ | 11356 | /* Set bit 23 to enable PCIX hw bug fix */ |
11329 | tp->dma_rwctrl |= 0x009f0000; | 11357 | tp->dma_rwctrl |= |
11358 | (read_water << DMA_RWCTRL_READ_WATER_SHIFT) | | ||
11359 | (0x3 << DMA_RWCTRL_WRITE_WATER_SHIFT) | | ||
11360 | (1 << 23); | ||
11330 | } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780) { | 11361 | } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780) { |
11331 | /* 5780 always in PCIX mode */ | 11362 | /* 5780 always in PCIX mode */ |
11332 | tp->dma_rwctrl |= 0x00144000; | 11363 | tp->dma_rwctrl |= 0x00144000; |
@@ -12016,6 +12047,9 @@ static int tg3_suspend(struct pci_dev *pdev, pm_message_t state) | |||
12016 | tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE; | 12047 | tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE; |
12017 | tg3_full_unlock(tp); | 12048 | tg3_full_unlock(tp); |
12018 | 12049 | ||
12050 | /* Save MSI address and data for resume. */ | ||
12051 | pci_save_state(pdev); | ||
12052 | |||
12019 | err = tg3_set_power_state(tp, pci_choose_state(pdev, state)); | 12053 | err = tg3_set_power_state(tp, pci_choose_state(pdev, state)); |
12020 | if (err) { | 12054 | if (err) { |
12021 | tg3_full_lock(tp, 0); | 12055 | tg3_full_lock(tp, 0); |
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index 80f59ac7ec58..45d477e8f374 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
@@ -1660,6 +1660,7 @@ | |||
1660 | 1660 | ||
1661 | #define MII_TG3_TEST1 0x1e | 1661 | #define MII_TG3_TEST1 0x1e |
1662 | #define MII_TG3_TEST1_TRIM_EN 0x0010 | 1662 | #define MII_TG3_TEST1_TRIM_EN 0x0010 |
1663 | #define MII_TG3_TEST1_CRC_EN 0x8000 | ||
1663 | 1664 | ||
1664 | /* There are two ways to manage the TX descriptors on the tigon3. | 1665 | /* There are two ways to manage the TX descriptors on the tigon3. |
1665 | * Either the descriptors are in host DMA'able memory, or they | 1666 | * Either the descriptors are in host DMA'able memory, or they |
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 16924cb772c9..92a1fc46ea59 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -946,14 +946,14 @@ extern int xfrm_state_mtu(struct xfrm_state *x, int mtu); | |||
946 | extern int xfrm_init_state(struct xfrm_state *x); | 946 | extern int xfrm_init_state(struct xfrm_state *x); |
947 | extern int xfrm4_rcv(struct sk_buff *skb); | 947 | extern int xfrm4_rcv(struct sk_buff *skb); |
948 | extern int xfrm4_output(struct sk_buff *skb); | 948 | extern int xfrm4_output(struct sk_buff *skb); |
949 | extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler); | 949 | extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family); |
950 | extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler); | 950 | extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family); |
951 | extern int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi); | 951 | extern int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi); |
952 | extern int xfrm6_rcv(struct sk_buff **pskb); | 952 | extern int xfrm6_rcv(struct sk_buff **pskb); |
953 | extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, | 953 | extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, |
954 | xfrm_address_t *saddr, u8 proto); | 954 | xfrm_address_t *saddr, u8 proto); |
955 | extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler); | 955 | extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family); |
956 | extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler); | 956 | extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family); |
957 | extern __be32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr); | 957 | extern __be32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr); |
958 | extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr); | 958 | extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr); |
959 | extern __be32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr); | 959 | extern __be32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr); |
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index f35c1a378d0f..aff6a779c9c8 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c | |||
@@ -108,6 +108,7 @@ static void port_carrier_check(struct work_struct *work) | |||
108 | spin_unlock_bh(&br->lock); | 108 | spin_unlock_bh(&br->lock); |
109 | } | 109 | } |
110 | done: | 110 | done: |
111 | dev_put(dev); | ||
111 | rtnl_unlock(); | 112 | rtnl_unlock(); |
112 | } | 113 | } |
113 | 114 | ||
@@ -161,7 +162,8 @@ static void del_nbp(struct net_bridge_port *p) | |||
161 | 162 | ||
162 | dev_set_promiscuity(dev, -1); | 163 | dev_set_promiscuity(dev, -1); |
163 | 164 | ||
164 | cancel_delayed_work(&p->carrier_check); | 165 | if (cancel_delayed_work(&p->carrier_check)) |
166 | dev_put(dev); | ||
165 | 167 | ||
166 | spin_lock_bh(&br->lock); | 168 | spin_lock_bh(&br->lock); |
167 | br_stp_disable_port(p); | 169 | br_stp_disable_port(p); |
@@ -444,7 +446,9 @@ int br_add_if(struct net_bridge *br, struct net_device *dev) | |||
444 | spin_lock_bh(&br->lock); | 446 | spin_lock_bh(&br->lock); |
445 | br_stp_recalculate_bridge_id(br); | 447 | br_stp_recalculate_bridge_id(br); |
446 | br_features_recompute(br); | 448 | br_features_recompute(br); |
447 | schedule_delayed_work(&p->carrier_check, BR_PORT_DEBOUNCE); | 449 | if (schedule_delayed_work(&p->carrier_check, BR_PORT_DEBOUNCE)) |
450 | dev_hold(dev); | ||
451 | |||
448 | spin_unlock_bh(&br->lock); | 452 | spin_unlock_bh(&br->lock); |
449 | 453 | ||
450 | dev_set_mtu(br->dev, br_min_mtu(br)); | 454 | dev_set_mtu(br->dev, br_min_mtu(br)); |
diff --git a/net/bridge/br_notify.c b/net/bridge/br_notify.c index 8cd3e4229070..3311c4e30829 100644 --- a/net/bridge/br_notify.c +++ b/net/bridge/br_notify.c | |||
@@ -56,7 +56,9 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v | |||
56 | 56 | ||
57 | case NETDEV_CHANGE: | 57 | case NETDEV_CHANGE: |
58 | if (br->dev->flags & IFF_UP) | 58 | if (br->dev->flags & IFF_UP) |
59 | schedule_delayed_work(&p->carrier_check, BR_PORT_DEBOUNCE); | 59 | if (schedule_delayed_work(&p->carrier_check, |
60 | BR_PORT_DEBOUNCE)) | ||
61 | dev_hold(dev); | ||
60 | break; | 62 | break; |
61 | 63 | ||
62 | case NETDEV_FEAT_CHANGE: | 64 | case NETDEV_FEAT_CHANGE: |
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c index 475bcd1e4181..9b561e633b00 100644 --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c | |||
@@ -871,7 +871,7 @@ static int __init ipip_init(void) | |||
871 | 871 | ||
872 | printk(banner); | 872 | printk(banner); |
873 | 873 | ||
874 | if (xfrm4_tunnel_register(&ipip_handler)) { | 874 | if (xfrm4_tunnel_register(&ipip_handler, AF_INET)) { |
875 | printk(KERN_INFO "ipip init: can't register tunnel\n"); | 875 | printk(KERN_INFO "ipip init: can't register tunnel\n"); |
876 | return -EAGAIN; | 876 | return -EAGAIN; |
877 | } | 877 | } |
@@ -893,7 +893,7 @@ static int __init ipip_init(void) | |||
893 | err2: | 893 | err2: |
894 | free_netdev(ipip_fb_tunnel_dev); | 894 | free_netdev(ipip_fb_tunnel_dev); |
895 | err1: | 895 | err1: |
896 | xfrm4_tunnel_deregister(&ipip_handler); | 896 | xfrm4_tunnel_deregister(&ipip_handler, AF_INET); |
897 | goto out; | 897 | goto out; |
898 | } | 898 | } |
899 | 899 | ||
@@ -913,7 +913,7 @@ static void __exit ipip_destroy_tunnels(void) | |||
913 | 913 | ||
914 | static void __exit ipip_fini(void) | 914 | static void __exit ipip_fini(void) |
915 | { | 915 | { |
916 | if (xfrm4_tunnel_deregister(&ipip_handler)) | 916 | if (xfrm4_tunnel_deregister(&ipip_handler, AF_INET)) |
917 | printk(KERN_INFO "ipip close: can't deregister tunnel\n"); | 917 | printk(KERN_INFO "ipip close: can't deregister tunnel\n"); |
918 | 918 | ||
919 | rtnl_lock(); | 919 | rtnl_lock(); |
diff --git a/net/ipv4/netfilter/ipt_REJECT.c b/net/ipv4/netfilter/ipt_REJECT.c index a9eb3635fff2..80f739e21824 100644 --- a/net/ipv4/netfilter/ipt_REJECT.c +++ b/net/ipv4/netfilter/ipt_REJECT.c | |||
@@ -80,6 +80,10 @@ static void send_reset(struct sk_buff *oldskb, int hook) | |||
80 | nskb->mark = 0; | 80 | nskb->mark = 0; |
81 | skb_init_secmark(nskb); | 81 | skb_init_secmark(nskb); |
82 | 82 | ||
83 | skb_shinfo(nskb)->gso_size = 0; | ||
84 | skb_shinfo(nskb)->gso_segs = 0; | ||
85 | skb_shinfo(nskb)->gso_type = 0; | ||
86 | |||
83 | tcph = (struct tcphdr *)((u_int32_t*)nskb->nh.iph + nskb->nh.iph->ihl); | 87 | tcph = (struct tcphdr *)((u_int32_t*)nskb->nh.iph + nskb->nh.iph->ihl); |
84 | 88 | ||
85 | /* Swap source and dest */ | 89 | /* Swap source and dest */ |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index cebe9aa918a3..dc151139b5af 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -481,7 +481,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
481 | /* RFC1323: The window in SYN & SYN/ACK segments | 481 | /* RFC1323: The window in SYN & SYN/ACK segments |
482 | * is never scaled. | 482 | * is never scaled. |
483 | */ | 483 | */ |
484 | th->window = htons(tp->rcv_wnd); | 484 | th->window = htons(min(tp->rcv_wnd, 65535U)); |
485 | } else { | 485 | } else { |
486 | th->window = htons(tcp_select_window(sk)); | 486 | th->window = htons(tcp_select_window(sk)); |
487 | } | 487 | } |
@@ -2160,7 +2160,7 @@ struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst, | |||
2160 | } | 2160 | } |
2161 | 2161 | ||
2162 | /* RFC1323: The window in SYN & SYN/ACK segments is never scaled. */ | 2162 | /* RFC1323: The window in SYN & SYN/ACK segments is never scaled. */ |
2163 | th->window = htons(req->rcv_wnd); | 2163 | th->window = htons(min(req->rcv_wnd, 65535U)); |
2164 | 2164 | ||
2165 | TCP_SKB_CB(skb)->when = tcp_time_stamp; | 2165 | TCP_SKB_CB(skb)->when = tcp_time_stamp; |
2166 | tcp_syn_build_options((__be32 *)(th + 1), dst_metric(dst, RTAX_ADVMSS), ireq->tstamp_ok, | 2166 | tcp_syn_build_options((__be32 *)(th + 1), dst_metric(dst, RTAX_ADVMSS), ireq->tstamp_ok, |
diff --git a/net/ipv4/tunnel4.c b/net/ipv4/tunnel4.c index 8d30c48f090e..a794a8ca8b4f 100644 --- a/net/ipv4/tunnel4.c +++ b/net/ipv4/tunnel4.c | |||
@@ -14,9 +14,10 @@ | |||
14 | #include <net/xfrm.h> | 14 | #include <net/xfrm.h> |
15 | 15 | ||
16 | static struct xfrm_tunnel *tunnel4_handlers; | 16 | static struct xfrm_tunnel *tunnel4_handlers; |
17 | static struct xfrm_tunnel *tunnel64_handlers; | ||
17 | static DEFINE_MUTEX(tunnel4_mutex); | 18 | static DEFINE_MUTEX(tunnel4_mutex); |
18 | 19 | ||
19 | int xfrm4_tunnel_register(struct xfrm_tunnel *handler) | 20 | int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family) |
20 | { | 21 | { |
21 | struct xfrm_tunnel **pprev; | 22 | struct xfrm_tunnel **pprev; |
22 | int ret = -EEXIST; | 23 | int ret = -EEXIST; |
@@ -24,7 +25,8 @@ int xfrm4_tunnel_register(struct xfrm_tunnel *handler) | |||
24 | 25 | ||
25 | mutex_lock(&tunnel4_mutex); | 26 | mutex_lock(&tunnel4_mutex); |
26 | 27 | ||
27 | for (pprev = &tunnel4_handlers; *pprev; pprev = &(*pprev)->next) { | 28 | for (pprev = (family == AF_INET) ? &tunnel4_handlers : &tunnel64_handlers; |
29 | *pprev; pprev = &(*pprev)->next) { | ||
28 | if ((*pprev)->priority > priority) | 30 | if ((*pprev)->priority > priority) |
29 | break; | 31 | break; |
30 | if ((*pprev)->priority == priority) | 32 | if ((*pprev)->priority == priority) |
@@ -44,14 +46,15 @@ err: | |||
44 | 46 | ||
45 | EXPORT_SYMBOL(xfrm4_tunnel_register); | 47 | EXPORT_SYMBOL(xfrm4_tunnel_register); |
46 | 48 | ||
47 | int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler) | 49 | int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family) |
48 | { | 50 | { |
49 | struct xfrm_tunnel **pprev; | 51 | struct xfrm_tunnel **pprev; |
50 | int ret = -ENOENT; | 52 | int ret = -ENOENT; |
51 | 53 | ||
52 | mutex_lock(&tunnel4_mutex); | 54 | mutex_lock(&tunnel4_mutex); |
53 | 55 | ||
54 | for (pprev = &tunnel4_handlers; *pprev; pprev = &(*pprev)->next) { | 56 | for (pprev = (family == AF_INET) ? &tunnel4_handlers : &tunnel64_handlers; |
57 | *pprev; pprev = &(*pprev)->next) { | ||
55 | if (*pprev == handler) { | 58 | if (*pprev == handler) { |
56 | *pprev = handler->next; | 59 | *pprev = handler->next; |
57 | ret = 0; | 60 | ret = 0; |
@@ -86,6 +89,26 @@ drop: | |||
86 | return 0; | 89 | return 0; |
87 | } | 90 | } |
88 | 91 | ||
92 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
93 | static int tunnel64_rcv(struct sk_buff *skb) | ||
94 | { | ||
95 | struct xfrm_tunnel *handler; | ||
96 | |||
97 | if (!pskb_may_pull(skb, sizeof(struct iphdr))) | ||
98 | goto drop; | ||
99 | |||
100 | for (handler = tunnel64_handlers; handler; handler = handler->next) | ||
101 | if (!handler->handler(skb)) | ||
102 | return 0; | ||
103 | |||
104 | icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0); | ||
105 | |||
106 | drop: | ||
107 | kfree_skb(skb); | ||
108 | return 0; | ||
109 | } | ||
110 | #endif | ||
111 | |||
89 | static void tunnel4_err(struct sk_buff *skb, u32 info) | 112 | static void tunnel4_err(struct sk_buff *skb, u32 info) |
90 | { | 113 | { |
91 | struct xfrm_tunnel *handler; | 114 | struct xfrm_tunnel *handler; |
@@ -101,17 +124,36 @@ static struct net_protocol tunnel4_protocol = { | |||
101 | .no_policy = 1, | 124 | .no_policy = 1, |
102 | }; | 125 | }; |
103 | 126 | ||
127 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
128 | static struct net_protocol tunnel64_protocol = { | ||
129 | .handler = tunnel64_rcv, | ||
130 | .err_handler = tunnel4_err, | ||
131 | .no_policy = 1, | ||
132 | }; | ||
133 | #endif | ||
134 | |||
104 | static int __init tunnel4_init(void) | 135 | static int __init tunnel4_init(void) |
105 | { | 136 | { |
106 | if (inet_add_protocol(&tunnel4_protocol, IPPROTO_IPIP)) { | 137 | if (inet_add_protocol(&tunnel4_protocol, IPPROTO_IPIP)) { |
107 | printk(KERN_ERR "tunnel4 init: can't add protocol\n"); | 138 | printk(KERN_ERR "tunnel4 init: can't add protocol\n"); |
108 | return -EAGAIN; | 139 | return -EAGAIN; |
109 | } | 140 | } |
141 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
142 | if (inet_add_protocol(&tunnel64_protocol, IPPROTO_IPV6)) { | ||
143 | printk(KERN_ERR "tunnel64 init: can't add protocol\n"); | ||
144 | inet_del_protocol(&tunnel4_protocol, IPPROTO_IPIP); | ||
145 | return -EAGAIN; | ||
146 | } | ||
147 | #endif | ||
110 | return 0; | 148 | return 0; |
111 | } | 149 | } |
112 | 150 | ||
113 | static void __exit tunnel4_fini(void) | 151 | static void __exit tunnel4_fini(void) |
114 | { | 152 | { |
153 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
154 | if (inet_del_protocol(&tunnel64_protocol, IPPROTO_IPV6)) | ||
155 | printk(KERN_ERR "tunnel64 close: can't remove protocol\n"); | ||
156 | #endif | ||
115 | if (inet_del_protocol(&tunnel4_protocol, IPPROTO_IPIP)) | 157 | if (inet_del_protocol(&tunnel4_protocol, IPPROTO_IPIP)) |
116 | printk(KERN_ERR "tunnel4 close: can't remove protocol\n"); | 158 | printk(KERN_ERR "tunnel4 close: can't remove protocol\n"); |
117 | } | 159 | } |
diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c index 289146bdb8b0..78e80deb7e89 100644 --- a/net/ipv4/xfrm4_input.c +++ b/net/ipv4/xfrm4_input.c | |||
@@ -27,6 +27,7 @@ static int xfrm4_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 | |||
27 | { | 27 | { |
28 | switch (nexthdr) { | 28 | switch (nexthdr) { |
29 | case IPPROTO_IPIP: | 29 | case IPPROTO_IPIP: |
30 | case IPPROTO_IPV6: | ||
30 | *spi = skb->nh.iph->saddr; | 31 | *spi = skb->nh.iph->saddr; |
31 | *seq = 0; | 32 | *seq = 0; |
32 | return 0; | 33 | return 0; |
@@ -70,7 +71,8 @@ int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type) | |||
70 | if (xfrm_nr == XFRM_MAX_DEPTH) | 71 | if (xfrm_nr == XFRM_MAX_DEPTH) |
71 | goto drop; | 72 | goto drop; |
72 | 73 | ||
73 | x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, spi, iph->protocol, AF_INET); | 74 | x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, spi, |
75 | iph->protocol != IPPROTO_IPV6 ? iph->protocol : IPPROTO_IPIP, AF_INET); | ||
74 | if (x == NULL) | 76 | if (x == NULL) |
75 | goto drop; | 77 | goto drop; |
76 | 78 | ||
diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c index e54c5494c88f..e1cab33fdad1 100644 --- a/net/ipv4/xfrm4_mode_tunnel.c +++ b/net/ipv4/xfrm4_mode_tunnel.c | |||
@@ -95,6 +95,7 @@ static int xfrm4_tunnel_input(struct xfrm_state *x, struct sk_buff *skb) | |||
95 | 95 | ||
96 | switch(iph->protocol){ | 96 | switch(iph->protocol){ |
97 | case IPPROTO_IPIP: | 97 | case IPPROTO_IPIP: |
98 | break; | ||
98 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) | 99 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) |
99 | case IPPROTO_IPV6: | 100 | case IPPROTO_IPV6: |
100 | break; | 101 | break; |
diff --git a/net/ipv4/xfrm4_tunnel.c b/net/ipv4/xfrm4_tunnel.c index 1be6762b2d47..3eef06454da9 100644 --- a/net/ipv4/xfrm4_tunnel.c +++ b/net/ipv4/xfrm4_tunnel.c | |||
@@ -64,24 +64,45 @@ static struct xfrm_tunnel xfrm_tunnel_handler = { | |||
64 | .priority = 2, | 64 | .priority = 2, |
65 | }; | 65 | }; |
66 | 66 | ||
67 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
68 | static struct xfrm_tunnel xfrm64_tunnel_handler = { | ||
69 | .handler = xfrm4_rcv, | ||
70 | .err_handler = xfrm_tunnel_err, | ||
71 | .priority = 2, | ||
72 | }; | ||
73 | #endif | ||
74 | |||
67 | static int __init ipip_init(void) | 75 | static int __init ipip_init(void) |
68 | { | 76 | { |
69 | if (xfrm_register_type(&ipip_type, AF_INET) < 0) { | 77 | if (xfrm_register_type(&ipip_type, AF_INET) < 0) { |
70 | printk(KERN_INFO "ipip init: can't add xfrm type\n"); | 78 | printk(KERN_INFO "ipip init: can't add xfrm type\n"); |
71 | return -EAGAIN; | 79 | return -EAGAIN; |
72 | } | 80 | } |
73 | if (xfrm4_tunnel_register(&xfrm_tunnel_handler)) { | 81 | |
74 | printk(KERN_INFO "ipip init: can't add xfrm handler\n"); | 82 | if (xfrm4_tunnel_register(&xfrm_tunnel_handler, AF_INET)) { |
83 | printk(KERN_INFO "ipip init: can't add xfrm handler for AF_INET\n"); | ||
84 | xfrm_unregister_type(&ipip_type, AF_INET); | ||
85 | return -EAGAIN; | ||
86 | } | ||
87 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
88 | if (xfrm4_tunnel_register(&xfrm64_tunnel_handler, AF_INET6)) { | ||
89 | printk(KERN_INFO "ipip init: can't add xfrm handler for AF_INET6\n"); | ||
90 | xfrm4_tunnel_deregister(&xfrm_tunnel_handler, AF_INET); | ||
75 | xfrm_unregister_type(&ipip_type, AF_INET); | 91 | xfrm_unregister_type(&ipip_type, AF_INET); |
76 | return -EAGAIN; | 92 | return -EAGAIN; |
77 | } | 93 | } |
94 | #endif | ||
78 | return 0; | 95 | return 0; |
79 | } | 96 | } |
80 | 97 | ||
81 | static void __exit ipip_fini(void) | 98 | static void __exit ipip_fini(void) |
82 | { | 99 | { |
83 | if (xfrm4_tunnel_deregister(&xfrm_tunnel_handler)) | 100 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
84 | printk(KERN_INFO "ipip close: can't remove xfrm handler\n"); | 101 | if (xfrm4_tunnel_deregister(&xfrm64_tunnel_handler, AF_INET6)) |
102 | printk(KERN_INFO "ipip close: can't remove xfrm handler for AF_INET6\n"); | ||
103 | #endif | ||
104 | if (xfrm4_tunnel_deregister(&xfrm_tunnel_handler, AF_INET)) | ||
105 | printk(KERN_INFO "ipip close: can't remove xfrm handler for AF_INET\n"); | ||
85 | if (xfrm_unregister_type(&ipip_type, AF_INET) < 0) | 106 | if (xfrm_unregister_type(&ipip_type, AF_INET) < 0) |
86 | printk(KERN_INFO "ipip close: can't remove xfrm type\n"); | 107 | printk(KERN_INFO "ipip close: can't remove xfrm type\n"); |
87 | } | 108 | } |
diff --git a/net/ipv6/Kconfig b/net/ipv6/Kconfig index deb4101a2a81..79682efb14be 100644 --- a/net/ipv6/Kconfig +++ b/net/ipv6/Kconfig | |||
@@ -156,6 +156,7 @@ config INET6_XFRM_MODE_ROUTEOPTIMIZATION | |||
156 | config IPV6_SIT | 156 | config IPV6_SIT |
157 | tristate "IPv6: IPv6-in-IPv4 tunnel (SIT driver)" | 157 | tristate "IPv6: IPv6-in-IPv4 tunnel (SIT driver)" |
158 | depends on IPV6 | 158 | depends on IPV6 |
159 | select INET_TUNNEL | ||
159 | default y | 160 | default y |
160 | ---help--- | 161 | ---help--- |
161 | Tunneling means encapsulating data of one protocol type within | 162 | Tunneling means encapsulating data of one protocol type within |
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c index 30b16da739c2..ae6b0e7eb488 100644 --- a/net/ipv6/inet6_hashtables.c +++ b/net/ipv6/inet6_hashtables.c | |||
@@ -172,7 +172,7 @@ static int __inet6_check_established(struct inet_timewait_death_row *death_row, | |||
172 | const struct in6_addr *saddr = &np->daddr; | 172 | const struct in6_addr *saddr = &np->daddr; |
173 | const int dif = sk->sk_bound_dev_if; | 173 | const int dif = sk->sk_bound_dev_if; |
174 | const __portpair ports = INET_COMBINED_PORTS(inet->dport, lport); | 174 | const __portpair ports = INET_COMBINED_PORTS(inet->dport, lport); |
175 | const unsigned int hash = inet6_ehashfn(daddr, inet->num, saddr, | 175 | const unsigned int hash = inet6_ehashfn(daddr, lport, saddr, |
176 | inet->dport); | 176 | inet->dport); |
177 | struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash); | 177 | struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash); |
178 | struct sock *sk2; | 178 | struct sock *sk2; |
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 367b74832986..662edb826899 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -1128,7 +1128,7 @@ static int __init ip6_tunnel_init(void) | |||
1128 | { | 1128 | { |
1129 | int err; | 1129 | int err; |
1130 | 1130 | ||
1131 | if (xfrm6_tunnel_register(&ip6ip6_handler)) { | 1131 | if (xfrm6_tunnel_register(&ip6ip6_handler, AF_INET6)) { |
1132 | printk(KERN_ERR "ip6ip6 init: can't register tunnel\n"); | 1132 | printk(KERN_ERR "ip6ip6 init: can't register tunnel\n"); |
1133 | return -EAGAIN; | 1133 | return -EAGAIN; |
1134 | } | 1134 | } |
@@ -1147,7 +1147,7 @@ static int __init ip6_tunnel_init(void) | |||
1147 | } | 1147 | } |
1148 | return 0; | 1148 | return 0; |
1149 | fail: | 1149 | fail: |
1150 | xfrm6_tunnel_deregister(&ip6ip6_handler); | 1150 | xfrm6_tunnel_deregister(&ip6ip6_handler, AF_INET6); |
1151 | return err; | 1151 | return err; |
1152 | } | 1152 | } |
1153 | 1153 | ||
@@ -1171,7 +1171,7 @@ static void __exit ip6ip6_destroy_tunnels(void) | |||
1171 | 1171 | ||
1172 | static void __exit ip6_tunnel_cleanup(void) | 1172 | static void __exit ip6_tunnel_cleanup(void) |
1173 | { | 1173 | { |
1174 | if (xfrm6_tunnel_deregister(&ip6ip6_handler)) | 1174 | if (xfrm6_tunnel_deregister(&ip6ip6_handler, AF_INET6)) |
1175 | printk(KERN_INFO "ip6ip6 close: can't deregister tunnel\n"); | 1175 | printk(KERN_INFO "ip6ip6 close: can't deregister tunnel\n"); |
1176 | 1176 | ||
1177 | rtnl_lock(); | 1177 | rtnl_lock(); |
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 4d3cf301e1fc..862ed7c52c38 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c | |||
@@ -216,7 +216,7 @@ static void ipip6_tunnel_uninit(struct net_device *dev) | |||
216 | } | 216 | } |
217 | 217 | ||
218 | 218 | ||
219 | static void ipip6_err(struct sk_buff *skb, u32 info) | 219 | static int ipip6_err(struct sk_buff *skb, u32 info) |
220 | { | 220 | { |
221 | #ifndef I_WISH_WORLD_WERE_PERFECT | 221 | #ifndef I_WISH_WORLD_WERE_PERFECT |
222 | 222 | ||
@@ -228,21 +228,22 @@ static void ipip6_err(struct sk_buff *skb, u32 info) | |||
228 | int type = skb->h.icmph->type; | 228 | int type = skb->h.icmph->type; |
229 | int code = skb->h.icmph->code; | 229 | int code = skb->h.icmph->code; |
230 | struct ip_tunnel *t; | 230 | struct ip_tunnel *t; |
231 | int err; | ||
231 | 232 | ||
232 | switch (type) { | 233 | switch (type) { |
233 | default: | 234 | default: |
234 | case ICMP_PARAMETERPROB: | 235 | case ICMP_PARAMETERPROB: |
235 | return; | 236 | return 0; |
236 | 237 | ||
237 | case ICMP_DEST_UNREACH: | 238 | case ICMP_DEST_UNREACH: |
238 | switch (code) { | 239 | switch (code) { |
239 | case ICMP_SR_FAILED: | 240 | case ICMP_SR_FAILED: |
240 | case ICMP_PORT_UNREACH: | 241 | case ICMP_PORT_UNREACH: |
241 | /* Impossible event. */ | 242 | /* Impossible event. */ |
242 | return; | 243 | return 0; |
243 | case ICMP_FRAG_NEEDED: | 244 | case ICMP_FRAG_NEEDED: |
244 | /* Soft state for pmtu is maintained by IP core. */ | 245 | /* Soft state for pmtu is maintained by IP core. */ |
245 | return; | 246 | return 0; |
246 | default: | 247 | default: |
247 | /* All others are translated to HOST_UNREACH. | 248 | /* All others are translated to HOST_UNREACH. |
248 | rfc2003 contains "deep thoughts" about NET_UNREACH, | 249 | rfc2003 contains "deep thoughts" about NET_UNREACH, |
@@ -253,14 +254,18 @@ static void ipip6_err(struct sk_buff *skb, u32 info) | |||
253 | break; | 254 | break; |
254 | case ICMP_TIME_EXCEEDED: | 255 | case ICMP_TIME_EXCEEDED: |
255 | if (code != ICMP_EXC_TTL) | 256 | if (code != ICMP_EXC_TTL) |
256 | return; | 257 | return 0; |
257 | break; | 258 | break; |
258 | } | 259 | } |
259 | 260 | ||
261 | err = -ENOENT; | ||
262 | |||
260 | read_lock(&ipip6_lock); | 263 | read_lock(&ipip6_lock); |
261 | t = ipip6_tunnel_lookup(iph->daddr, iph->saddr); | 264 | t = ipip6_tunnel_lookup(iph->daddr, iph->saddr); |
262 | if (t == NULL || t->parms.iph.daddr == 0) | 265 | if (t == NULL || t->parms.iph.daddr == 0) |
263 | goto out; | 266 | goto out; |
267 | |||
268 | err = 0; | ||
264 | if (t->parms.iph.ttl == 0 && type == ICMP_TIME_EXCEEDED) | 269 | if (t->parms.iph.ttl == 0 && type == ICMP_TIME_EXCEEDED) |
265 | goto out; | 270 | goto out; |
266 | 271 | ||
@@ -271,7 +276,7 @@ static void ipip6_err(struct sk_buff *skb, u32 info) | |||
271 | t->err_time = jiffies; | 276 | t->err_time = jiffies; |
272 | out: | 277 | out: |
273 | read_unlock(&ipip6_lock); | 278 | read_unlock(&ipip6_lock); |
274 | return; | 279 | return err; |
275 | #else | 280 | #else |
276 | struct iphdr *iph = (struct iphdr*)dp; | 281 | struct iphdr *iph = (struct iphdr*)dp; |
277 | int hlen = iph->ihl<<2; | 282 | int hlen = iph->ihl<<2; |
@@ -332,7 +337,7 @@ out: | |||
332 | /* Prepare fake skb to feed it to icmpv6_send */ | 337 | /* Prepare fake skb to feed it to icmpv6_send */ |
333 | skb2 = skb_clone(skb, GFP_ATOMIC); | 338 | skb2 = skb_clone(skb, GFP_ATOMIC); |
334 | if (skb2 == NULL) | 339 | if (skb2 == NULL) |
335 | return; | 340 | return 0; |
336 | dst_release(skb2->dst); | 341 | dst_release(skb2->dst); |
337 | skb2->dst = NULL; | 342 | skb2->dst = NULL; |
338 | skb_pull(skb2, skb->data - (u8*)iph6); | 343 | skb_pull(skb2, skb->data - (u8*)iph6); |
@@ -355,7 +360,7 @@ out: | |||
355 | } | 360 | } |
356 | } | 361 | } |
357 | kfree_skb(skb2); | 362 | kfree_skb(skb2); |
358 | return; | 363 | return 0; |
359 | #endif | 364 | #endif |
360 | } | 365 | } |
361 | 366 | ||
@@ -791,9 +796,10 @@ static int __init ipip6_fb_tunnel_init(struct net_device *dev) | |||
791 | return 0; | 796 | return 0; |
792 | } | 797 | } |
793 | 798 | ||
794 | static struct net_protocol sit_protocol = { | 799 | static struct xfrm_tunnel sit_handler = { |
795 | .handler = ipip6_rcv, | 800 | .handler = ipip6_rcv, |
796 | .err_handler = ipip6_err, | 801 | .err_handler = ipip6_err, |
802 | .priority = 1, | ||
797 | }; | 803 | }; |
798 | 804 | ||
799 | static void __exit sit_destroy_tunnels(void) | 805 | static void __exit sit_destroy_tunnels(void) |
@@ -812,7 +818,7 @@ static void __exit sit_destroy_tunnels(void) | |||
812 | 818 | ||
813 | static void __exit sit_cleanup(void) | 819 | static void __exit sit_cleanup(void) |
814 | { | 820 | { |
815 | inet_del_protocol(&sit_protocol, IPPROTO_IPV6); | 821 | xfrm4_tunnel_deregister(&sit_handler, AF_INET6); |
816 | 822 | ||
817 | rtnl_lock(); | 823 | rtnl_lock(); |
818 | sit_destroy_tunnels(); | 824 | sit_destroy_tunnels(); |
@@ -826,7 +832,7 @@ static int __init sit_init(void) | |||
826 | 832 | ||
827 | printk(KERN_INFO "IPv6 over IPv4 tunneling driver\n"); | 833 | printk(KERN_INFO "IPv6 over IPv4 tunneling driver\n"); |
828 | 834 | ||
829 | if (inet_add_protocol(&sit_protocol, IPPROTO_IPV6) < 0) { | 835 | if (xfrm4_tunnel_register(&sit_handler, AF_INET6) < 0) { |
830 | printk(KERN_INFO "sit init: Can't add protocol\n"); | 836 | printk(KERN_INFO "sit init: Can't add protocol\n"); |
831 | return -EAGAIN; | 837 | return -EAGAIN; |
832 | } | 838 | } |
@@ -848,7 +854,7 @@ static int __init sit_init(void) | |||
848 | err2: | 854 | err2: |
849 | free_netdev(ipip6_fb_tunnel_dev); | 855 | free_netdev(ipip6_fb_tunnel_dev); |
850 | err1: | 856 | err1: |
851 | inet_del_protocol(&sit_protocol, IPPROTO_IPV6); | 857 | xfrm4_tunnel_deregister(&sit_handler, AF_INET6); |
852 | goto out; | 858 | goto out; |
853 | } | 859 | } |
854 | 860 | ||
diff --git a/net/ipv6/tunnel6.c b/net/ipv6/tunnel6.c index 918d07dd1219..23e2809878ae 100644 --- a/net/ipv6/tunnel6.c +++ b/net/ipv6/tunnel6.c | |||
@@ -30,9 +30,10 @@ | |||
30 | #include <net/xfrm.h> | 30 | #include <net/xfrm.h> |
31 | 31 | ||
32 | static struct xfrm6_tunnel *tunnel6_handlers; | 32 | static struct xfrm6_tunnel *tunnel6_handlers; |
33 | static struct xfrm6_tunnel *tunnel46_handlers; | ||
33 | static DEFINE_MUTEX(tunnel6_mutex); | 34 | static DEFINE_MUTEX(tunnel6_mutex); |
34 | 35 | ||
35 | int xfrm6_tunnel_register(struct xfrm6_tunnel *handler) | 36 | int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family) |
36 | { | 37 | { |
37 | struct xfrm6_tunnel **pprev; | 38 | struct xfrm6_tunnel **pprev; |
38 | int ret = -EEXIST; | 39 | int ret = -EEXIST; |
@@ -40,7 +41,8 @@ int xfrm6_tunnel_register(struct xfrm6_tunnel *handler) | |||
40 | 41 | ||
41 | mutex_lock(&tunnel6_mutex); | 42 | mutex_lock(&tunnel6_mutex); |
42 | 43 | ||
43 | for (pprev = &tunnel6_handlers; *pprev; pprev = &(*pprev)->next) { | 44 | for (pprev = (family == AF_INET6) ? &tunnel6_handlers : &tunnel46_handlers; |
45 | *pprev; pprev = &(*pprev)->next) { | ||
44 | if ((*pprev)->priority > priority) | 46 | if ((*pprev)->priority > priority) |
45 | break; | 47 | break; |
46 | if ((*pprev)->priority == priority) | 48 | if ((*pprev)->priority == priority) |
@@ -60,14 +62,15 @@ err: | |||
60 | 62 | ||
61 | EXPORT_SYMBOL(xfrm6_tunnel_register); | 63 | EXPORT_SYMBOL(xfrm6_tunnel_register); |
62 | 64 | ||
63 | int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler) | 65 | int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family) |
64 | { | 66 | { |
65 | struct xfrm6_tunnel **pprev; | 67 | struct xfrm6_tunnel **pprev; |
66 | int ret = -ENOENT; | 68 | int ret = -ENOENT; |
67 | 69 | ||
68 | mutex_lock(&tunnel6_mutex); | 70 | mutex_lock(&tunnel6_mutex); |
69 | 71 | ||
70 | for (pprev = &tunnel6_handlers; *pprev; pprev = &(*pprev)->next) { | 72 | for (pprev = (family == AF_INET6) ? &tunnel6_handlers : &tunnel46_handlers; |
73 | *pprev; pprev = &(*pprev)->next) { | ||
71 | if (*pprev == handler) { | 74 | if (*pprev == handler) { |
72 | *pprev = handler->next; | 75 | *pprev = handler->next; |
73 | ret = 0; | 76 | ret = 0; |
@@ -103,6 +106,25 @@ drop: | |||
103 | return 0; | 106 | return 0; |
104 | } | 107 | } |
105 | 108 | ||
109 | static int tunnel46_rcv(struct sk_buff **pskb) | ||
110 | { | ||
111 | struct sk_buff *skb = *pskb; | ||
112 | struct xfrm6_tunnel *handler; | ||
113 | |||
114 | if (!pskb_may_pull(skb, sizeof(struct ipv6hdr))) | ||
115 | goto drop; | ||
116 | |||
117 | for (handler = tunnel46_handlers; handler; handler = handler->next) | ||
118 | if (!handler->handler(skb)) | ||
119 | return 0; | ||
120 | |||
121 | icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_PORT_UNREACH, 0, skb->dev); | ||
122 | |||
123 | drop: | ||
124 | kfree_skb(skb); | ||
125 | return 0; | ||
126 | } | ||
127 | |||
106 | static void tunnel6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | 128 | static void tunnel6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, |
107 | int type, int code, int offset, __be32 info) | 129 | int type, int code, int offset, __be32 info) |
108 | { | 130 | { |
@@ -119,17 +141,30 @@ static struct inet6_protocol tunnel6_protocol = { | |||
119 | .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, | 141 | .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, |
120 | }; | 142 | }; |
121 | 143 | ||
144 | static struct inet6_protocol tunnel46_protocol = { | ||
145 | .handler = tunnel46_rcv, | ||
146 | .err_handler = tunnel6_err, | ||
147 | .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, | ||
148 | }; | ||
149 | |||
122 | static int __init tunnel6_init(void) | 150 | static int __init tunnel6_init(void) |
123 | { | 151 | { |
124 | if (inet6_add_protocol(&tunnel6_protocol, IPPROTO_IPV6)) { | 152 | if (inet6_add_protocol(&tunnel6_protocol, IPPROTO_IPV6)) { |
125 | printk(KERN_ERR "tunnel6 init(): can't add protocol\n"); | 153 | printk(KERN_ERR "tunnel6 init(): can't add protocol\n"); |
126 | return -EAGAIN; | 154 | return -EAGAIN; |
127 | } | 155 | } |
156 | if (inet6_add_protocol(&tunnel46_protocol, IPPROTO_IPIP)) { | ||
157 | printk(KERN_ERR "tunnel6 init(): can't add protocol\n"); | ||
158 | inet6_del_protocol(&tunnel6_protocol, IPPROTO_IPV6); | ||
159 | return -EAGAIN; | ||
160 | } | ||
128 | return 0; | 161 | return 0; |
129 | } | 162 | } |
130 | 163 | ||
131 | static void __exit tunnel6_fini(void) | 164 | static void __exit tunnel6_fini(void) |
132 | { | 165 | { |
166 | if (inet6_del_protocol(&tunnel46_protocol, IPPROTO_IPIP)) | ||
167 | printk(KERN_ERR "tunnel6 close: can't remove protocol\n"); | ||
133 | if (inet6_del_protocol(&tunnel6_protocol, IPPROTO_IPV6)) | 168 | if (inet6_del_protocol(&tunnel6_protocol, IPPROTO_IPV6)) |
134 | printk(KERN_ERR "tunnel6 close: can't remove protocol\n"); | 169 | printk(KERN_ERR "tunnel6 close: can't remove protocol\n"); |
135 | } | 170 | } |
diff --git a/net/ipv6/xfrm6_input.c b/net/ipv6/xfrm6_input.c index 25250147bdc3..31f651f95096 100644 --- a/net/ipv6/xfrm6_input.c +++ b/net/ipv6/xfrm6_input.c | |||
@@ -40,7 +40,8 @@ int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi) | |||
40 | if (xfrm_nr == XFRM_MAX_DEPTH) | 40 | if (xfrm_nr == XFRM_MAX_DEPTH) |
41 | goto drop; | 41 | goto drop; |
42 | 42 | ||
43 | x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, spi, nexthdr, AF_INET6); | 43 | x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, spi, |
44 | nexthdr != IPPROTO_IPIP ? nexthdr : IPPROTO_IPV6, AF_INET6); | ||
44 | if (x == NULL) | 45 | if (x == NULL) |
45 | goto drop; | 46 | goto drop; |
46 | spin_lock(&x->lock); | 47 | spin_lock(&x->lock); |
diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c index fb0228772f01..ee4b84a33ff4 100644 --- a/net/ipv6/xfrm6_tunnel.c +++ b/net/ipv6/xfrm6_tunnel.c | |||
@@ -339,17 +339,29 @@ static struct xfrm6_tunnel xfrm6_tunnel_handler = { | |||
339 | .priority = 2, | 339 | .priority = 2, |
340 | }; | 340 | }; |
341 | 341 | ||
342 | static struct xfrm6_tunnel xfrm46_tunnel_handler = { | ||
343 | .handler = xfrm6_tunnel_rcv, | ||
344 | .err_handler = xfrm6_tunnel_err, | ||
345 | .priority = 2, | ||
346 | }; | ||
347 | |||
342 | static int __init xfrm6_tunnel_init(void) | 348 | static int __init xfrm6_tunnel_init(void) |
343 | { | 349 | { |
344 | if (xfrm_register_type(&xfrm6_tunnel_type, AF_INET6) < 0) | 350 | if (xfrm_register_type(&xfrm6_tunnel_type, AF_INET6) < 0) |
345 | return -EAGAIN; | 351 | return -EAGAIN; |
346 | 352 | ||
347 | if (xfrm6_tunnel_register(&xfrm6_tunnel_handler)) { | 353 | if (xfrm6_tunnel_register(&xfrm6_tunnel_handler, AF_INET6)) { |
354 | xfrm_unregister_type(&xfrm6_tunnel_type, AF_INET6); | ||
355 | return -EAGAIN; | ||
356 | } | ||
357 | if (xfrm6_tunnel_register(&xfrm46_tunnel_handler, AF_INET)) { | ||
358 | xfrm6_tunnel_deregister(&xfrm6_tunnel_handler, AF_INET6); | ||
348 | xfrm_unregister_type(&xfrm6_tunnel_type, AF_INET6); | 359 | xfrm_unregister_type(&xfrm6_tunnel_type, AF_INET6); |
349 | return -EAGAIN; | 360 | return -EAGAIN; |
350 | } | 361 | } |
351 | if (xfrm6_tunnel_spi_init() < 0) { | 362 | if (xfrm6_tunnel_spi_init() < 0) { |
352 | xfrm6_tunnel_deregister(&xfrm6_tunnel_handler); | 363 | xfrm6_tunnel_deregister(&xfrm46_tunnel_handler, AF_INET); |
364 | xfrm6_tunnel_deregister(&xfrm6_tunnel_handler, AF_INET6); | ||
353 | xfrm_unregister_type(&xfrm6_tunnel_type, AF_INET6); | 365 | xfrm_unregister_type(&xfrm6_tunnel_type, AF_INET6); |
354 | return -EAGAIN; | 366 | return -EAGAIN; |
355 | } | 367 | } |
@@ -359,7 +371,8 @@ static int __init xfrm6_tunnel_init(void) | |||
359 | static void __exit xfrm6_tunnel_fini(void) | 371 | static void __exit xfrm6_tunnel_fini(void) |
360 | { | 372 | { |
361 | xfrm6_tunnel_spi_fini(); | 373 | xfrm6_tunnel_spi_fini(); |
362 | xfrm6_tunnel_deregister(&xfrm6_tunnel_handler); | 374 | xfrm6_tunnel_deregister(&xfrm46_tunnel_handler, AF_INET); |
375 | xfrm6_tunnel_deregister(&xfrm6_tunnel_handler, AF_INET6); | ||
363 | xfrm_unregister_type(&xfrm6_tunnel_type, AF_INET6); | 376 | xfrm_unregister_type(&xfrm6_tunnel_type, AF_INET6); |
364 | } | 377 | } |
365 | 378 | ||
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c index 135087d4213a..396deb71480f 100644 --- a/net/sched/sch_hfsc.c +++ b/net/sched/sch_hfsc.c | |||
@@ -71,8 +71,6 @@ | |||
71 | #include <asm/system.h> | 71 | #include <asm/system.h> |
72 | #include <asm/div64.h> | 72 | #include <asm/div64.h> |
73 | 73 | ||
74 | #define HFSC_DEBUG 1 | ||
75 | |||
76 | /* | 74 | /* |
77 | * kernel internal service curve representation: | 75 | * kernel internal service curve representation: |
78 | * coordinates are given by 64 bit unsigned integers. | 76 | * coordinates are given by 64 bit unsigned integers. |
@@ -211,17 +209,6 @@ do { \ | |||
211 | } while (0) | 209 | } while (0) |
212 | #endif | 210 | #endif |
213 | 211 | ||
214 | #if HFSC_DEBUG | ||
215 | #define ASSERT(cond) \ | ||
216 | do { \ | ||
217 | if (unlikely(!(cond))) \ | ||
218 | printk("assertion %s failed at %s:%i (%s)\n", \ | ||
219 | #cond, __FILE__, __LINE__, __FUNCTION__); \ | ||
220 | } while (0) | ||
221 | #else | ||
222 | #define ASSERT(cond) | ||
223 | #endif /* HFSC_DEBUG */ | ||
224 | |||
225 | #define HT_INFINITY 0xffffffffffffffffULL /* infinite time value */ | 212 | #define HT_INFINITY 0xffffffffffffffffULL /* infinite time value */ |
226 | 213 | ||
227 | 214 | ||
@@ -1492,7 +1479,7 @@ hfsc_schedule_watchdog(struct Qdisc *sch, u64 cur_time) | |||
1492 | if (next_time == 0 || next_time > q->root.cl_cfmin) | 1479 | if (next_time == 0 || next_time > q->root.cl_cfmin) |
1493 | next_time = q->root.cl_cfmin; | 1480 | next_time = q->root.cl_cfmin; |
1494 | } | 1481 | } |
1495 | ASSERT(next_time != 0); | 1482 | WARN_ON(next_time == 0); |
1496 | delay = next_time - cur_time; | 1483 | delay = next_time - cur_time; |
1497 | delay = PSCHED_US2JIFFIE(delay); | 1484 | delay = PSCHED_US2JIFFIE(delay); |
1498 | 1485 | ||
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index c394b413f651..946b715db5ec 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -1550,7 +1550,7 @@ xfrm_state_ok(struct xfrm_tmpl *tmpl, struct xfrm_state *x, | |||
1550 | unsigned short family) | 1550 | unsigned short family) |
1551 | { | 1551 | { |
1552 | if (xfrm_state_kern(x)) | 1552 | if (xfrm_state_kern(x)) |
1553 | return tmpl->optional && !xfrm_state_addr_cmp(tmpl, x, family); | 1553 | return tmpl->optional && !xfrm_state_addr_cmp(tmpl, x, tmpl->encap_family); |
1554 | return x->id.proto == tmpl->id.proto && | 1554 | return x->id.proto == tmpl->id.proto && |
1555 | (x->id.spi == tmpl->id.spi || !tmpl->id.spi) && | 1555 | (x->id.spi == tmpl->id.spi || !tmpl->id.spi) && |
1556 | (x->props.reqid == tmpl->reqid || !tmpl->reqid) && | 1556 | (x->props.reqid == tmpl->reqid || !tmpl->reqid) && |