diff options
37 files changed, 543 insertions, 565 deletions
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c index 1f7ca453bb4a..dde631f8f685 100644 --- a/drivers/net/cassini.c +++ b/drivers/net/cassini.c | |||
@@ -1925,8 +1925,8 @@ static void cas_tx(struct net_device *dev, struct cas *cp, | |||
1925 | u64 compwb = le64_to_cpu(cp->init_block->tx_compwb); | 1925 | u64 compwb = le64_to_cpu(cp->init_block->tx_compwb); |
1926 | #endif | 1926 | #endif |
1927 | if (netif_msg_intr(cp)) | 1927 | if (netif_msg_intr(cp)) |
1928 | printk(KERN_DEBUG "%s: tx interrupt, status: 0x%x, %lx\n", | 1928 | printk(KERN_DEBUG "%s: tx interrupt, status: 0x%x, %llx\n", |
1929 | cp->dev->name, status, compwb); | 1929 | cp->dev->name, status, (unsigned long long)compwb); |
1930 | /* process all the rings */ | 1930 | /* process all the rings */ |
1931 | for (ring = 0; ring < N_TX_RINGS; ring++) { | 1931 | for (ring = 0; ring < N_TX_RINGS; ring++) { |
1932 | #ifdef USE_TX_COMPWB | 1932 | #ifdef USE_TX_COMPWB |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index eb86b059809b..f2d1dafde087 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -69,8 +69,8 @@ | |||
69 | 69 | ||
70 | #define DRV_MODULE_NAME "tg3" | 70 | #define DRV_MODULE_NAME "tg3" |
71 | #define PFX DRV_MODULE_NAME ": " | 71 | #define PFX DRV_MODULE_NAME ": " |
72 | #define DRV_MODULE_VERSION "3.47" | 72 | #define DRV_MODULE_VERSION "3.48" |
73 | #define DRV_MODULE_RELDATE "Dec 28, 2005" | 73 | #define DRV_MODULE_RELDATE "Jan 16, 2006" |
74 | 74 | ||
75 | #define TG3_DEF_MAC_MODE 0 | 75 | #define TG3_DEF_MAC_MODE 0 |
76 | #define TG3_DEF_RX_MODE 0 | 76 | #define TG3_DEF_RX_MODE 0 |
@@ -1325,10 +1325,12 @@ static int tg3_set_power_state(struct tg3 *tp, int state) | |||
1325 | val &= ~((1 << 16) | (1 << 4) | (1 << 2) | (1 << 1) | 1); | 1325 | val &= ~((1 << 16) | (1 << 4) | (1 << 2) | (1 << 1) | 1); |
1326 | tw32(0x7d00, val); | 1326 | tw32(0x7d00, val); |
1327 | if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) { | 1327 | if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) { |
1328 | tg3_nvram_lock(tp); | 1328 | int err; |
1329 | |||
1330 | err = tg3_nvram_lock(tp); | ||
1329 | tg3_halt_cpu(tp, RX_CPU_BASE); | 1331 | tg3_halt_cpu(tp, RX_CPU_BASE); |
1330 | tw32_f(NVRAM_SWARB, SWARB_REQ_CLR0); | 1332 | if (!err) |
1331 | tg3_nvram_unlock(tp); | 1333 | tg3_nvram_unlock(tp); |
1332 | } | 1334 | } |
1333 | } | 1335 | } |
1334 | 1336 | ||
@@ -4193,14 +4195,19 @@ static int tg3_nvram_lock(struct tg3 *tp) | |||
4193 | if (tp->tg3_flags & TG3_FLAG_NVRAM) { | 4195 | if (tp->tg3_flags & TG3_FLAG_NVRAM) { |
4194 | int i; | 4196 | int i; |
4195 | 4197 | ||
4196 | tw32(NVRAM_SWARB, SWARB_REQ_SET1); | 4198 | if (tp->nvram_lock_cnt == 0) { |
4197 | for (i = 0; i < 8000; i++) { | 4199 | tw32(NVRAM_SWARB, SWARB_REQ_SET1); |
4198 | if (tr32(NVRAM_SWARB) & SWARB_GNT1) | 4200 | for (i = 0; i < 8000; i++) { |
4199 | break; | 4201 | if (tr32(NVRAM_SWARB) & SWARB_GNT1) |
4200 | udelay(20); | 4202 | break; |
4203 | udelay(20); | ||
4204 | } | ||
4205 | if (i == 8000) { | ||
4206 | tw32(NVRAM_SWARB, SWARB_REQ_CLR1); | ||
4207 | return -ENODEV; | ||
4208 | } | ||
4201 | } | 4209 | } |
4202 | if (i == 8000) | 4210 | tp->nvram_lock_cnt++; |
4203 | return -ENODEV; | ||
4204 | } | 4211 | } |
4205 | return 0; | 4212 | return 0; |
4206 | } | 4213 | } |
@@ -4208,8 +4215,12 @@ static int tg3_nvram_lock(struct tg3 *tp) | |||
4208 | /* tp->lock is held. */ | 4215 | /* tp->lock is held. */ |
4209 | static void tg3_nvram_unlock(struct tg3 *tp) | 4216 | static void tg3_nvram_unlock(struct tg3 *tp) |
4210 | { | 4217 | { |
4211 | if (tp->tg3_flags & TG3_FLAG_NVRAM) | 4218 | if (tp->tg3_flags & TG3_FLAG_NVRAM) { |
4212 | tw32_f(NVRAM_SWARB, SWARB_REQ_CLR1); | 4219 | if (tp->nvram_lock_cnt > 0) |
4220 | tp->nvram_lock_cnt--; | ||
4221 | if (tp->nvram_lock_cnt == 0) | ||
4222 | tw32_f(NVRAM_SWARB, SWARB_REQ_CLR1); | ||
4223 | } | ||
4213 | } | 4224 | } |
4214 | 4225 | ||
4215 | /* tp->lock is held. */ | 4226 | /* tp->lock is held. */ |
@@ -4320,8 +4331,13 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
4320 | void (*write_op)(struct tg3 *, u32, u32); | 4331 | void (*write_op)(struct tg3 *, u32, u32); |
4321 | int i; | 4332 | int i; |
4322 | 4333 | ||
4323 | if (!(tp->tg3_flags2 & TG3_FLG2_SUN_570X)) | 4334 | if (!(tp->tg3_flags2 & TG3_FLG2_SUN_570X)) { |
4324 | tg3_nvram_lock(tp); | 4335 | tg3_nvram_lock(tp); |
4336 | /* No matching tg3_nvram_unlock() after this because | ||
4337 | * chip reset below will undo the nvram lock. | ||
4338 | */ | ||
4339 | tp->nvram_lock_cnt = 0; | ||
4340 | } | ||
4325 | 4341 | ||
4326 | /* | 4342 | /* |
4327 | * We must avoid the readl() that normally takes place. | 4343 | * We must avoid the readl() that normally takes place. |
@@ -4717,6 +4733,10 @@ static int tg3_halt_cpu(struct tg3 *tp, u32 offset) | |||
4717 | (offset == RX_CPU_BASE ? "RX" : "TX")); | 4733 | (offset == RX_CPU_BASE ? "RX" : "TX")); |
4718 | return -ENODEV; | 4734 | return -ENODEV; |
4719 | } | 4735 | } |
4736 | |||
4737 | /* Clear firmware's nvram arbitration. */ | ||
4738 | if (tp->tg3_flags & TG3_FLAG_NVRAM) | ||
4739 | tw32(NVRAM_SWARB, SWARB_REQ_CLR0); | ||
4720 | return 0; | 4740 | return 0; |
4721 | } | 4741 | } |
4722 | 4742 | ||
@@ -4736,7 +4756,7 @@ struct fw_info { | |||
4736 | static int tg3_load_firmware_cpu(struct tg3 *tp, u32 cpu_base, u32 cpu_scratch_base, | 4756 | static int tg3_load_firmware_cpu(struct tg3 *tp, u32 cpu_base, u32 cpu_scratch_base, |
4737 | int cpu_scratch_size, struct fw_info *info) | 4757 | int cpu_scratch_size, struct fw_info *info) |
4738 | { | 4758 | { |
4739 | int err, i; | 4759 | int err, lock_err, i; |
4740 | void (*write_op)(struct tg3 *, u32, u32); | 4760 | void (*write_op)(struct tg3 *, u32, u32); |
4741 | 4761 | ||
4742 | if (cpu_base == TX_CPU_BASE && | 4762 | if (cpu_base == TX_CPU_BASE && |
@@ -4755,9 +4775,10 @@ static int tg3_load_firmware_cpu(struct tg3 *tp, u32 cpu_base, u32 cpu_scratch_b | |||
4755 | /* It is possible that bootcode is still loading at this point. | 4775 | /* It is possible that bootcode is still loading at this point. |
4756 | * Get the nvram lock first before halting the cpu. | 4776 | * Get the nvram lock first before halting the cpu. |
4757 | */ | 4777 | */ |
4758 | tg3_nvram_lock(tp); | 4778 | lock_err = tg3_nvram_lock(tp); |
4759 | err = tg3_halt_cpu(tp, cpu_base); | 4779 | err = tg3_halt_cpu(tp, cpu_base); |
4760 | tg3_nvram_unlock(tp); | 4780 | if (!lock_err) |
4781 | tg3_nvram_unlock(tp); | ||
4761 | if (err) | 4782 | if (err) |
4762 | goto out; | 4783 | goto out; |
4763 | 4784 | ||
@@ -8182,7 +8203,7 @@ static void tg3_self_test(struct net_device *dev, struct ethtool_test *etest, | |||
8182 | data[1] = 1; | 8203 | data[1] = 1; |
8183 | } | 8204 | } |
8184 | if (etest->flags & ETH_TEST_FL_OFFLINE) { | 8205 | if (etest->flags & ETH_TEST_FL_OFFLINE) { |
8185 | int irq_sync = 0; | 8206 | int err, irq_sync = 0; |
8186 | 8207 | ||
8187 | if (netif_running(dev)) { | 8208 | if (netif_running(dev)) { |
8188 | tg3_netif_stop(tp); | 8209 | tg3_netif_stop(tp); |
@@ -8192,11 +8213,12 @@ static void tg3_self_test(struct net_device *dev, struct ethtool_test *etest, | |||
8192 | tg3_full_lock(tp, irq_sync); | 8213 | tg3_full_lock(tp, irq_sync); |
8193 | 8214 | ||
8194 | tg3_halt(tp, RESET_KIND_SUSPEND, 1); | 8215 | tg3_halt(tp, RESET_KIND_SUSPEND, 1); |
8195 | tg3_nvram_lock(tp); | 8216 | err = tg3_nvram_lock(tp); |
8196 | tg3_halt_cpu(tp, RX_CPU_BASE); | 8217 | tg3_halt_cpu(tp, RX_CPU_BASE); |
8197 | if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) | 8218 | if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) |
8198 | tg3_halt_cpu(tp, TX_CPU_BASE); | 8219 | tg3_halt_cpu(tp, TX_CPU_BASE); |
8199 | tg3_nvram_unlock(tp); | 8220 | if (!err) |
8221 | tg3_nvram_unlock(tp); | ||
8200 | 8222 | ||
8201 | if (tg3_test_registers(tp) != 0) { | 8223 | if (tg3_test_registers(tp) != 0) { |
8202 | etest->flags |= ETH_TEST_FL_FAILED; | 8224 | etest->flags |= ETH_TEST_FL_FAILED; |
@@ -8588,7 +8610,11 @@ static void __devinit tg3_nvram_init(struct tg3 *tp) | |||
8588 | GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701) { | 8610 | GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701) { |
8589 | tp->tg3_flags |= TG3_FLAG_NVRAM; | 8611 | tp->tg3_flags |= TG3_FLAG_NVRAM; |
8590 | 8612 | ||
8591 | tg3_nvram_lock(tp); | 8613 | if (tg3_nvram_lock(tp)) { |
8614 | printk(KERN_WARNING PFX "%s: Cannot get nvarm lock, " | ||
8615 | "tg3_nvram_init failed.\n", tp->dev->name); | ||
8616 | return; | ||
8617 | } | ||
8592 | tg3_enable_nvram_access(tp); | 8618 | tg3_enable_nvram_access(tp); |
8593 | 8619 | ||
8594 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752) | 8620 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752) |
@@ -8686,7 +8712,9 @@ static int tg3_nvram_read(struct tg3 *tp, u32 offset, u32 *val) | |||
8686 | if (offset > NVRAM_ADDR_MSK) | 8712 | if (offset > NVRAM_ADDR_MSK) |
8687 | return -EINVAL; | 8713 | return -EINVAL; |
8688 | 8714 | ||
8689 | tg3_nvram_lock(tp); | 8715 | ret = tg3_nvram_lock(tp); |
8716 | if (ret) | ||
8717 | return ret; | ||
8690 | 8718 | ||
8691 | tg3_enable_nvram_access(tp); | 8719 | tg3_enable_nvram_access(tp); |
8692 | 8720 | ||
@@ -8785,10 +8813,6 @@ static int tg3_nvram_write_block_unbuffered(struct tg3 *tp, u32 offset, u32 len, | |||
8785 | 8813 | ||
8786 | offset = offset + (pagesize - page_off); | 8814 | offset = offset + (pagesize - page_off); |
8787 | 8815 | ||
8788 | /* Nvram lock released by tg3_nvram_read() above, | ||
8789 | * so need to get it again. | ||
8790 | */ | ||
8791 | tg3_nvram_lock(tp); | ||
8792 | tg3_enable_nvram_access(tp); | 8816 | tg3_enable_nvram_access(tp); |
8793 | 8817 | ||
8794 | /* | 8818 | /* |
@@ -8925,7 +8949,9 @@ static int tg3_nvram_write_block(struct tg3 *tp, u32 offset, u32 len, u8 *buf) | |||
8925 | else { | 8949 | else { |
8926 | u32 grc_mode; | 8950 | u32 grc_mode; |
8927 | 8951 | ||
8928 | tg3_nvram_lock(tp); | 8952 | ret = tg3_nvram_lock(tp); |
8953 | if (ret) | ||
8954 | return ret; | ||
8929 | 8955 | ||
8930 | tg3_enable_nvram_access(tp); | 8956 | tg3_enable_nvram_access(tp); |
8931 | if ((tp->tg3_flags2 & TG3_FLG2_5750_PLUS) && | 8957 | if ((tp->tg3_flags2 & TG3_FLG2_5750_PLUS) && |
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index 890e1635996b..e8243305f0e8 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
@@ -2275,6 +2275,7 @@ struct tg3 { | |||
2275 | dma_addr_t stats_mapping; | 2275 | dma_addr_t stats_mapping; |
2276 | struct work_struct reset_task; | 2276 | struct work_struct reset_task; |
2277 | 2277 | ||
2278 | int nvram_lock_cnt; | ||
2278 | u32 nvram_size; | 2279 | u32 nvram_size; |
2279 | u32 nvram_pagesize; | 2280 | u32 nvram_pagesize; |
2280 | u32 nvram_jedecnum; | 2281 | u32 nvram_jedecnum; |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 323924edb26a..a5363324cf95 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -228,6 +228,7 @@ extern void dump_stack(void); | |||
228 | ntohs((addr).s6_addr16[6]), \ | 228 | ntohs((addr).s6_addr16[6]), \ |
229 | ntohs((addr).s6_addr16[7]) | 229 | ntohs((addr).s6_addr16[7]) |
230 | #define NIP6_FMT "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x" | 230 | #define NIP6_FMT "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x" |
231 | #define NIP6_SEQFMT "%04x%04x%04x%04x%04x%04x%04x%04x" | ||
231 | 232 | ||
232 | #if defined(__LITTLE_ENDIAN) | 233 | #if defined(__LITTLE_ENDIAN) |
233 | #define HIPQUAD(addr) \ | 234 | #define HIPQUAD(addr) \ |
diff --git a/include/linux/netfilter_ipv6/ip6t_ah.h b/include/linux/netfilter_ipv6/ip6t_ah.h index c4f0793a0a98..8531879eb464 100644 --- a/include/linux/netfilter_ipv6/ip6t_ah.h +++ b/include/linux/netfilter_ipv6/ip6t_ah.h | |||
@@ -18,13 +18,4 @@ struct ip6t_ah | |||
18 | #define IP6T_AH_INV_LEN 0x02 /* Invert the sense of length. */ | 18 | #define IP6T_AH_INV_LEN 0x02 /* Invert the sense of length. */ |
19 | #define IP6T_AH_INV_MASK 0x03 /* All possible flags. */ | 19 | #define IP6T_AH_INV_MASK 0x03 /* All possible flags. */ |
20 | 20 | ||
21 | #define MASK_HOPOPTS 128 | ||
22 | #define MASK_DSTOPTS 64 | ||
23 | #define MASK_ROUTING 32 | ||
24 | #define MASK_FRAGMENT 16 | ||
25 | #define MASK_AH 8 | ||
26 | #define MASK_ESP 4 | ||
27 | #define MASK_NONE 2 | ||
28 | #define MASK_PROTO 1 | ||
29 | |||
30 | #endif /*_IP6T_AH_H*/ | 21 | #endif /*_IP6T_AH_H*/ |
diff --git a/include/linux/netfilter_ipv6/ip6t_esp.h b/include/linux/netfilter_ipv6/ip6t_esp.h index 01142b98a231..a91b6abc8079 100644 --- a/include/linux/netfilter_ipv6/ip6t_esp.h +++ b/include/linux/netfilter_ipv6/ip6t_esp.h | |||
@@ -7,15 +7,6 @@ struct ip6t_esp | |||
7 | u_int8_t invflags; /* Inverse flags */ | 7 | u_int8_t invflags; /* Inverse flags */ |
8 | }; | 8 | }; |
9 | 9 | ||
10 | #define MASK_HOPOPTS 128 | ||
11 | #define MASK_DSTOPTS 64 | ||
12 | #define MASK_ROUTING 32 | ||
13 | #define MASK_FRAGMENT 16 | ||
14 | #define MASK_AH 8 | ||
15 | #define MASK_ESP 4 | ||
16 | #define MASK_NONE 2 | ||
17 | #define MASK_PROTO 1 | ||
18 | |||
19 | /* Values for "invflags" field in struct ip6t_esp. */ | 10 | /* Values for "invflags" field in struct ip6t_esp. */ |
20 | #define IP6T_ESP_INV_SPI 0x01 /* Invert the sense of spi. */ | 11 | #define IP6T_ESP_INV_SPI 0x01 /* Invert the sense of spi. */ |
21 | #define IP6T_ESP_INV_MASK 0x01 /* All possible flags. */ | 12 | #define IP6T_ESP_INV_MASK 0x01 /* All possible flags. */ |
diff --git a/include/linux/netfilter_ipv6/ip6t_frag.h b/include/linux/netfilter_ipv6/ip6t_frag.h index 449a57eca7dd..66070a0d6dfc 100644 --- a/include/linux/netfilter_ipv6/ip6t_frag.h +++ b/include/linux/netfilter_ipv6/ip6t_frag.h | |||
@@ -21,13 +21,4 @@ struct ip6t_frag | |||
21 | #define IP6T_FRAG_INV_LEN 0x02 /* Invert the sense of length. */ | 21 | #define IP6T_FRAG_INV_LEN 0x02 /* Invert the sense of length. */ |
22 | #define IP6T_FRAG_INV_MASK 0x03 /* All possible flags. */ | 22 | #define IP6T_FRAG_INV_MASK 0x03 /* All possible flags. */ |
23 | 23 | ||
24 | #define MASK_HOPOPTS 128 | ||
25 | #define MASK_DSTOPTS 64 | ||
26 | #define MASK_ROUTING 32 | ||
27 | #define MASK_FRAGMENT 16 | ||
28 | #define MASK_AH 8 | ||
29 | #define MASK_ESP 4 | ||
30 | #define MASK_NONE 2 | ||
31 | #define MASK_PROTO 1 | ||
32 | |||
33 | #endif /*_IP6T_FRAG_H*/ | 24 | #endif /*_IP6T_FRAG_H*/ |
diff --git a/include/linux/netfilter_ipv6/ip6t_opts.h b/include/linux/netfilter_ipv6/ip6t_opts.h index e259b6275bd2..a07e36380ae8 100644 --- a/include/linux/netfilter_ipv6/ip6t_opts.h +++ b/include/linux/netfilter_ipv6/ip6t_opts.h | |||
@@ -20,13 +20,4 @@ struct ip6t_opts | |||
20 | #define IP6T_OPTS_INV_LEN 0x01 /* Invert the sense of length. */ | 20 | #define IP6T_OPTS_INV_LEN 0x01 /* Invert the sense of length. */ |
21 | #define IP6T_OPTS_INV_MASK 0x01 /* All possible flags. */ | 21 | #define IP6T_OPTS_INV_MASK 0x01 /* All possible flags. */ |
22 | 22 | ||
23 | #define MASK_HOPOPTS 128 | ||
24 | #define MASK_DSTOPTS 64 | ||
25 | #define MASK_ROUTING 32 | ||
26 | #define MASK_FRAGMENT 16 | ||
27 | #define MASK_AH 8 | ||
28 | #define MASK_ESP 4 | ||
29 | #define MASK_NONE 2 | ||
30 | #define MASK_PROTO 1 | ||
31 | |||
32 | #endif /*_IP6T_OPTS_H*/ | 23 | #endif /*_IP6T_OPTS_H*/ |
diff --git a/include/linux/netfilter_ipv6/ip6t_rt.h b/include/linux/netfilter_ipv6/ip6t_rt.h index f1070fbf2757..52156023e8db 100644 --- a/include/linux/netfilter_ipv6/ip6t_rt.h +++ b/include/linux/netfilter_ipv6/ip6t_rt.h | |||
@@ -30,13 +30,4 @@ struct ip6t_rt | |||
30 | #define IP6T_RT_INV_LEN 0x04 /* Invert the sense of length. */ | 30 | #define IP6T_RT_INV_LEN 0x04 /* Invert the sense of length. */ |
31 | #define IP6T_RT_INV_MASK 0x07 /* All possible flags. */ | 31 | #define IP6T_RT_INV_MASK 0x07 /* All possible flags. */ |
32 | 32 | ||
33 | #define MASK_HOPOPTS 128 | ||
34 | #define MASK_DSTOPTS 64 | ||
35 | #define MASK_ROUTING 32 | ||
36 | #define MASK_FRAGMENT 16 | ||
37 | #define MASK_AH 8 | ||
38 | #define MASK_ESP 4 | ||
39 | #define MASK_NONE 2 | ||
40 | #define MASK_PROTO 1 | ||
41 | |||
42 | #endif /*_IP6T_RT_H*/ | 33 | #endif /*_IP6T_RT_H*/ |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index e5fd66c5650b..ad7cc22bd424 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -926,7 +926,7 @@ static inline int skb_tailroom(const struct sk_buff *skb) | |||
926 | * Increase the headroom of an empty &sk_buff by reducing the tail | 926 | * Increase the headroom of an empty &sk_buff by reducing the tail |
927 | * room. This is only allowed for an empty buffer. | 927 | * room. This is only allowed for an empty buffer. |
928 | */ | 928 | */ |
929 | static inline void skb_reserve(struct sk_buff *skb, unsigned int len) | 929 | static inline void skb_reserve(struct sk_buff *skb, int len) |
930 | { | 930 | { |
931 | skb->data += len; | 931 | skb->data += len; |
932 | skb->tail += len; | 932 | skb->tail += len; |
diff --git a/net/bridge/netfilter/ebt_ip.c b/net/bridge/netfilter/ebt_ip.c index f158fe67dd60..dc5d0b2427cf 100644 --- a/net/bridge/netfilter/ebt_ip.c +++ b/net/bridge/netfilter/ebt_ip.c | |||
@@ -92,7 +92,9 @@ static int ebt_ip_check(const char *tablename, unsigned int hookmask, | |||
92 | if (info->invflags & EBT_IP_PROTO) | 92 | if (info->invflags & EBT_IP_PROTO) |
93 | return -EINVAL; | 93 | return -EINVAL; |
94 | if (info->protocol != IPPROTO_TCP && | 94 | if (info->protocol != IPPROTO_TCP && |
95 | info->protocol != IPPROTO_UDP) | 95 | info->protocol != IPPROTO_UDP && |
96 | info->protocol != IPPROTO_SCTP && | ||
97 | info->protocol != IPPROTO_DCCP) | ||
96 | return -EINVAL; | 98 | return -EINVAL; |
97 | } | 99 | } |
98 | if (info->bitmask & EBT_IP_DPORT && info->dport[0] > info->dport[1]) | 100 | if (info->bitmask & EBT_IP_DPORT && info->dport[0] > info->dport[1]) |
diff --git a/net/bridge/netfilter/ebt_log.c b/net/bridge/netfilter/ebt_log.c index a29c1232c420..0128fbbe2328 100644 --- a/net/bridge/netfilter/ebt_log.c +++ b/net/bridge/netfilter/ebt_log.c | |||
@@ -95,7 +95,9 @@ ebt_log_packet(unsigned int pf, unsigned int hooknum, | |||
95 | "tos=0x%02X, IP proto=%d", NIPQUAD(ih->saddr), | 95 | "tos=0x%02X, IP proto=%d", NIPQUAD(ih->saddr), |
96 | NIPQUAD(ih->daddr), ih->tos, ih->protocol); | 96 | NIPQUAD(ih->daddr), ih->tos, ih->protocol); |
97 | if (ih->protocol == IPPROTO_TCP || | 97 | if (ih->protocol == IPPROTO_TCP || |
98 | ih->protocol == IPPROTO_UDP) { | 98 | ih->protocol == IPPROTO_UDP || |
99 | ih->protocol == IPPROTO_SCTP || | ||
100 | ih->protocol == IPPROTO_DCCP) { | ||
99 | struct tcpudphdr _ports, *pptr; | 101 | struct tcpudphdr _ports, *pptr; |
100 | 102 | ||
101 | pptr = skb_header_pointer(skb, ih->ihl*4, | 103 | pptr = skb_header_pointer(skb, ih->ihl*4, |
diff --git a/net/core/filter.c b/net/core/filter.c index a52665f75224..9540946a48f3 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -74,7 +74,6 @@ static inline void *load_pointer(struct sk_buff *skb, int k, | |||
74 | * filtering, filter is the array of filter instructions, and | 74 | * filtering, filter is the array of filter instructions, and |
75 | * len is the number of filter blocks in the array. | 75 | * len is the number of filter blocks in the array. |
76 | */ | 76 | */ |
77 | |||
78 | unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen) | 77 | unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen) |
79 | { | 78 | { |
80 | struct sock_filter *fentry; /* We walk down these */ | 79 | struct sock_filter *fentry; /* We walk down these */ |
@@ -175,7 +174,7 @@ unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int | |||
175 | continue; | 174 | continue; |
176 | case BPF_LD|BPF_W|BPF_ABS: | 175 | case BPF_LD|BPF_W|BPF_ABS: |
177 | k = fentry->k; | 176 | k = fentry->k; |
178 | load_w: | 177 | load_w: |
179 | ptr = load_pointer(skb, k, 4, &tmp); | 178 | ptr = load_pointer(skb, k, 4, &tmp); |
180 | if (ptr != NULL) { | 179 | if (ptr != NULL) { |
181 | A = ntohl(*(u32 *)ptr); | 180 | A = ntohl(*(u32 *)ptr); |
@@ -184,7 +183,7 @@ unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int | |||
184 | break; | 183 | break; |
185 | case BPF_LD|BPF_H|BPF_ABS: | 184 | case BPF_LD|BPF_H|BPF_ABS: |
186 | k = fentry->k; | 185 | k = fentry->k; |
187 | load_h: | 186 | load_h: |
188 | ptr = load_pointer(skb, k, 2, &tmp); | 187 | ptr = load_pointer(skb, k, 2, &tmp); |
189 | if (ptr != NULL) { | 188 | if (ptr != NULL) { |
190 | A = ntohs(*(u16 *)ptr); | 189 | A = ntohs(*(u16 *)ptr); |
@@ -374,7 +373,7 @@ int sk_chk_filter(struct sock_filter *filter, int flen) | |||
374 | case BPF_JMP|BPF_JSET|BPF_K: | 373 | case BPF_JMP|BPF_JSET|BPF_K: |
375 | case BPF_JMP|BPF_JSET|BPF_X: | 374 | case BPF_JMP|BPF_JSET|BPF_X: |
376 | /* for conditionals both must be safe */ | 375 | /* for conditionals both must be safe */ |
377 | if (pc + ftest->jt + 1 >= flen || | 376 | if (pc + ftest->jt + 1 >= flen || |
378 | pc + ftest->jf + 1 >= flen) | 377 | pc + ftest->jf + 1 >= flen) |
379 | return -EINVAL; | 378 | return -EINVAL; |
380 | break; | 379 | break; |
@@ -384,7 +383,7 @@ int sk_chk_filter(struct sock_filter *filter, int flen) | |||
384 | } | 383 | } |
385 | } | 384 | } |
386 | 385 | ||
387 | return (BPF_CLASS(filter[flen - 1].code) == BPF_RET) ? 0 : -EINVAL; | 386 | return (BPF_CLASS(filter[flen - 1].code) == BPF_RET) ? 0 : -EINVAL; |
388 | } | 387 | } |
389 | 388 | ||
390 | /** | 389 | /** |
@@ -404,8 +403,8 @@ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk) | |||
404 | int err; | 403 | int err; |
405 | 404 | ||
406 | /* Make sure new filter is there and in the right amounts. */ | 405 | /* Make sure new filter is there and in the right amounts. */ |
407 | if (fprog->filter == NULL) | 406 | if (fprog->filter == NULL) |
408 | return -EINVAL; | 407 | return -EINVAL; |
409 | 408 | ||
410 | fp = sock_kmalloc(sk, fsize+sizeof(*fp), GFP_KERNEL); | 409 | fp = sock_kmalloc(sk, fsize+sizeof(*fp), GFP_KERNEL); |
411 | if (!fp) | 410 | if (!fp) |
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 281a632fa6a6..ea51f8d02eb8 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c | |||
@@ -703,7 +703,7 @@ int netpoll_setup(struct netpoll *np) | |||
703 | } | 703 | } |
704 | } | 704 | } |
705 | 705 | ||
706 | if (!memcmp(np->local_mac, "\0\0\0\0\0\0", 6) && ndev->dev_addr) | 706 | if (is_zero_ether_addr(np->local_mac) && ndev->dev_addr) |
707 | memcpy(np->local_mac, ndev->dev_addr, 6); | 707 | memcpy(np->local_mac, ndev->dev_addr, 6); |
708 | 708 | ||
709 | if (!np->local_ip) { | 709 | if (!np->local_ip) { |
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 39063122fbb7..3827f881f429 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -139,6 +139,7 @@ | |||
139 | #include <linux/proc_fs.h> | 139 | #include <linux/proc_fs.h> |
140 | #include <linux/seq_file.h> | 140 | #include <linux/seq_file.h> |
141 | #include <linux/wait.h> | 141 | #include <linux/wait.h> |
142 | #include <linux/etherdevice.h> | ||
142 | #include <net/checksum.h> | 143 | #include <net/checksum.h> |
143 | #include <net/ipv6.h> | 144 | #include <net/ipv6.h> |
144 | #include <net/addrconf.h> | 145 | #include <net/addrconf.h> |
@@ -281,8 +282,8 @@ struct pktgen_dev { | |||
281 | __u32 src_mac_count; /* How many MACs to iterate through */ | 282 | __u32 src_mac_count; /* How many MACs to iterate through */ |
282 | __u32 dst_mac_count; /* How many MACs to iterate through */ | 283 | __u32 dst_mac_count; /* How many MACs to iterate through */ |
283 | 284 | ||
284 | unsigned char dst_mac[6]; | 285 | unsigned char dst_mac[ETH_ALEN]; |
285 | unsigned char src_mac[6]; | 286 | unsigned char src_mac[ETH_ALEN]; |
286 | 287 | ||
287 | __u32 cur_dst_mac_offset; | 288 | __u32 cur_dst_mac_offset; |
288 | __u32 cur_src_mac_offset; | 289 | __u32 cur_src_mac_offset; |
@@ -594,16 +595,9 @@ static int pktgen_if_show(struct seq_file *seq, void *v) | |||
594 | 595 | ||
595 | seq_puts(seq, " src_mac: "); | 596 | seq_puts(seq, " src_mac: "); |
596 | 597 | ||
597 | if ((pkt_dev->src_mac[0] == 0) && | 598 | if (is_zero_ether_addr(pkt_dev->src_mac)) |
598 | (pkt_dev->src_mac[1] == 0) && | ||
599 | (pkt_dev->src_mac[2] == 0) && | ||
600 | (pkt_dev->src_mac[3] == 0) && | ||
601 | (pkt_dev->src_mac[4] == 0) && | ||
602 | (pkt_dev->src_mac[5] == 0)) | ||
603 | |||
604 | for (i = 0; i < 6; i++) | 599 | for (i = 0; i < 6; i++) |
605 | seq_printf(seq, "%02X%s", pkt_dev->odev->dev_addr[i], i == 5 ? " " : ":"); | 600 | seq_printf(seq, "%02X%s", pkt_dev->odev->dev_addr[i], i == 5 ? " " : ":"); |
606 | |||
607 | else | 601 | else |
608 | for (i = 0; i < 6; i++) | 602 | for (i = 0; i < 6; i++) |
609 | seq_printf(seq, "%02X%s", pkt_dev->src_mac[i], i == 5 ? " " : ":"); | 603 | seq_printf(seq, "%02X%s", pkt_dev->src_mac[i], i == 5 ? " " : ":"); |
@@ -1189,9 +1183,9 @@ static ssize_t pktgen_if_write(struct file *file, const char __user *user_buffer | |||
1189 | } | 1183 | } |
1190 | if (!strcmp(name, "dst_mac")) { | 1184 | if (!strcmp(name, "dst_mac")) { |
1191 | char *v = valstr; | 1185 | char *v = valstr; |
1192 | unsigned char old_dmac[6]; | 1186 | unsigned char old_dmac[ETH_ALEN]; |
1193 | unsigned char *m = pkt_dev->dst_mac; | 1187 | unsigned char *m = pkt_dev->dst_mac; |
1194 | memcpy(old_dmac, pkt_dev->dst_mac, 6); | 1188 | memcpy(old_dmac, pkt_dev->dst_mac, ETH_ALEN); |
1195 | 1189 | ||
1196 | len = strn_len(&user_buffer[i], sizeof(valstr) - 1); | 1190 | len = strn_len(&user_buffer[i], sizeof(valstr) - 1); |
1197 | if (len < 0) { return len; } | 1191 | if (len < 0) { return len; } |
@@ -1220,8 +1214,8 @@ static ssize_t pktgen_if_write(struct file *file, const char __user *user_buffer | |||
1220 | } | 1214 | } |
1221 | 1215 | ||
1222 | /* Set up Dest MAC */ | 1216 | /* Set up Dest MAC */ |
1223 | if (memcmp(old_dmac, pkt_dev->dst_mac, 6) != 0) | 1217 | if (compare_ether_addr(old_dmac, pkt_dev->dst_mac)) |
1224 | memcpy(&(pkt_dev->hh[0]), pkt_dev->dst_mac, 6); | 1218 | memcpy(&(pkt_dev->hh[0]), pkt_dev->dst_mac, ETH_ALEN); |
1225 | 1219 | ||
1226 | sprintf(pg_result, "OK: dstmac"); | 1220 | sprintf(pg_result, "OK: dstmac"); |
1227 | return count; | 1221 | return count; |
@@ -1560,17 +1554,11 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev) | |||
1560 | 1554 | ||
1561 | /* Default to the interface's mac if not explicitly set. */ | 1555 | /* Default to the interface's mac if not explicitly set. */ |
1562 | 1556 | ||
1563 | if ((pkt_dev->src_mac[0] == 0) && | 1557 | if (is_zero_ether_addr(pkt_dev->src_mac)) |
1564 | (pkt_dev->src_mac[1] == 0) && | 1558 | memcpy(&(pkt_dev->hh[6]), pkt_dev->odev->dev_addr, ETH_ALEN); |
1565 | (pkt_dev->src_mac[2] == 0) && | ||
1566 | (pkt_dev->src_mac[3] == 0) && | ||
1567 | (pkt_dev->src_mac[4] == 0) && | ||
1568 | (pkt_dev->src_mac[5] == 0)) { | ||
1569 | 1559 | ||
1570 | memcpy(&(pkt_dev->hh[6]), pkt_dev->odev->dev_addr, 6); | ||
1571 | } | ||
1572 | /* Set up Dest MAC */ | 1560 | /* Set up Dest MAC */ |
1573 | memcpy(&(pkt_dev->hh[0]), pkt_dev->dst_mac, 6); | 1561 | memcpy(&(pkt_dev->hh[0]), pkt_dev->dst_mac, ETH_ALEN); |
1574 | 1562 | ||
1575 | /* Set up pkt size */ | 1563 | /* Set up pkt size */ |
1576 | pkt_dev->cur_pkt_size = pkt_dev->min_pkt_size; | 1564 | pkt_dev->cur_pkt_size = pkt_dev->min_pkt_size; |
diff --git a/net/dccp/ackvec.c b/net/dccp/ackvec.c index ce9cb77c5c29..2c77dafbd091 100644 --- a/net/dccp/ackvec.c +++ b/net/dccp/ackvec.c | |||
@@ -144,7 +144,7 @@ static inline int dccp_ackvec_set_buf_head_state(struct dccp_ackvec *av, | |||
144 | const unsigned char state) | 144 | const unsigned char state) |
145 | { | 145 | { |
146 | unsigned int gap; | 146 | unsigned int gap; |
147 | signed long new_head; | 147 | long new_head; |
148 | 148 | ||
149 | if (av->dccpav_vec_len + packets > av->dccpav_buf_len) | 149 | if (av->dccpav_vec_len + packets > av->dccpav_buf_len) |
150 | return -ENOBUFS; | 150 | return -ENOBUFS; |
diff --git a/net/ipv4/netfilter/Makefile b/net/ipv4/netfilter/Makefile index bcefe64b9317..e5c5b3202f02 100644 --- a/net/ipv4/netfilter/Makefile +++ b/net/ipv4/netfilter/Makefile | |||
@@ -46,7 +46,6 @@ obj-$(CONFIG_IP_NF_NAT) += iptable_nat.o | |||
46 | obj-$(CONFIG_IP_NF_RAW) += iptable_raw.o | 46 | obj-$(CONFIG_IP_NF_RAW) += iptable_raw.o |
47 | 47 | ||
48 | # matches | 48 | # matches |
49 | obj-$(CONFIG_IP_NF_MATCH_HELPER) += ipt_helper.o | ||
50 | obj-$(CONFIG_IP_NF_MATCH_HASHLIMIT) += ipt_hashlimit.o | 49 | obj-$(CONFIG_IP_NF_MATCH_HASHLIMIT) += ipt_hashlimit.o |
51 | obj-$(CONFIG_IP_NF_MATCH_IPRANGE) += ipt_iprange.o | 50 | obj-$(CONFIG_IP_NF_MATCH_IPRANGE) += ipt_iprange.o |
52 | obj-$(CONFIG_IP_NF_MATCH_MULTIPORT) += ipt_multiport.o | 51 | obj-$(CONFIG_IP_NF_MATCH_MULTIPORT) += ipt_multiport.o |
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_gre.c b/net/ipv4/netfilter/ip_conntrack_proto_gre.c index c777abf16cb7..56794797d55b 100644 --- a/net/ipv4/netfilter/ip_conntrack_proto_gre.c +++ b/net/ipv4/netfilter/ip_conntrack_proto_gre.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/in.h> | 32 | #include <linux/in.h> |
33 | #include <linux/list.h> | 33 | #include <linux/list.h> |
34 | #include <linux/seq_file.h> | 34 | #include <linux/seq_file.h> |
35 | #include <linux/interrupt.h> | ||
35 | 36 | ||
36 | static DEFINE_RWLOCK(ip_ct_gre_lock); | 37 | static DEFINE_RWLOCK(ip_ct_gre_lock); |
37 | #define ASSERT_READ_LOCK(x) | 38 | #define ASSERT_READ_LOCK(x) |
diff --git a/net/ipv4/netfilter/ipt_policy.c b/net/ipv4/netfilter/ipt_policy.c index 709debcc69c9..18ca8258a1c5 100644 --- a/net/ipv4/netfilter/ipt_policy.c +++ b/net/ipv4/netfilter/ipt_policy.c | |||
@@ -95,7 +95,10 @@ match_policy_out(const struct sk_buff *skb, const struct ipt_policy_info *info) | |||
95 | static int match(const struct sk_buff *skb, | 95 | static int match(const struct sk_buff *skb, |
96 | const struct net_device *in, | 96 | const struct net_device *in, |
97 | const struct net_device *out, | 97 | const struct net_device *out, |
98 | const void *matchinfo, int offset, int *hotdrop) | 98 | const void *matchinfo, |
99 | int offset, | ||
100 | unsigned int protoff, | ||
101 | int *hotdrop) | ||
99 | { | 102 | { |
100 | const struct ipt_policy_info *info = matchinfo; | 103 | const struct ipt_policy_info *info = matchinfo; |
101 | int ret; | 104 | int ret; |
@@ -113,7 +116,7 @@ static int match(const struct sk_buff *skb, | |||
113 | return ret; | 116 | return ret; |
114 | } | 117 | } |
115 | 118 | ||
116 | static int checkentry(const char *tablename, const struct ipt_ip *ip, | 119 | static int checkentry(const char *tablename, const void *ip_void, |
117 | void *matchinfo, unsigned int matchsize, | 120 | void *matchinfo, unsigned int matchsize, |
118 | unsigned int hook_mask) | 121 | unsigned int hook_mask) |
119 | { | 122 | { |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index f701a136a6ae..f2e82afc15b3 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -240,9 +240,8 @@ static unsigned rt_hash_mask; | |||
240 | static int rt_hash_log; | 240 | static int rt_hash_log; |
241 | static unsigned int rt_hash_rnd; | 241 | static unsigned int rt_hash_rnd; |
242 | 242 | ||
243 | static struct rt_cache_stat *rt_cache_stat; | 243 | static DEFINE_PER_CPU(struct rt_cache_stat, rt_cache_stat); |
244 | #define RT_CACHE_STAT_INC(field) \ | 244 | #define RT_CACHE_STAT_INC(field) (__get_cpu_var(rt_cache_stat).field++) |
245 | (per_cpu_ptr(rt_cache_stat, raw_smp_processor_id())->field++) | ||
246 | 245 | ||
247 | static int rt_intern_hash(unsigned hash, struct rtable *rth, | 246 | static int rt_intern_hash(unsigned hash, struct rtable *rth, |
248 | struct rtable **res); | 247 | struct rtable **res); |
@@ -401,7 +400,7 @@ static void *rt_cpu_seq_start(struct seq_file *seq, loff_t *pos) | |||
401 | if (!cpu_possible(cpu)) | 400 | if (!cpu_possible(cpu)) |
402 | continue; | 401 | continue; |
403 | *pos = cpu+1; | 402 | *pos = cpu+1; |
404 | return per_cpu_ptr(rt_cache_stat, cpu); | 403 | return &per_cpu(rt_cache_stat, cpu); |
405 | } | 404 | } |
406 | return NULL; | 405 | return NULL; |
407 | } | 406 | } |
@@ -414,7 +413,7 @@ static void *rt_cpu_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
414 | if (!cpu_possible(cpu)) | 413 | if (!cpu_possible(cpu)) |
415 | continue; | 414 | continue; |
416 | *pos = cpu+1; | 415 | *pos = cpu+1; |
417 | return per_cpu_ptr(rt_cache_stat, cpu); | 416 | return &per_cpu(rt_cache_stat, cpu); |
418 | } | 417 | } |
419 | return NULL; | 418 | return NULL; |
420 | 419 | ||
@@ -3160,10 +3159,6 @@ int __init ip_rt_init(void) | |||
3160 | ipv4_dst_ops.gc_thresh = (rt_hash_mask + 1); | 3159 | ipv4_dst_ops.gc_thresh = (rt_hash_mask + 1); |
3161 | ip_rt_max_size = (rt_hash_mask + 1) * 16; | 3160 | ip_rt_max_size = (rt_hash_mask + 1) * 16; |
3162 | 3161 | ||
3163 | rt_cache_stat = alloc_percpu(struct rt_cache_stat); | ||
3164 | if (!rt_cache_stat) | ||
3165 | return -ENOMEM; | ||
3166 | |||
3167 | devinet_init(); | 3162 | devinet_init(); |
3168 | ip_fib_init(); | 3163 | ip_fib_init(); |
3169 | 3164 | ||
@@ -3191,7 +3186,6 @@ int __init ip_rt_init(void) | |||
3191 | if (!proc_net_fops_create("rt_cache", S_IRUGO, &rt_cache_seq_fops) || | 3186 | if (!proc_net_fops_create("rt_cache", S_IRUGO, &rt_cache_seq_fops) || |
3192 | !(rtstat_pde = create_proc_entry("rt_cache", S_IRUGO, | 3187 | !(rtstat_pde = create_proc_entry("rt_cache", S_IRUGO, |
3193 | proc_net_stat))) { | 3188 | proc_net_stat))) { |
3194 | free_percpu(rt_cache_stat); | ||
3195 | return -ENOMEM; | 3189 | return -ENOMEM; |
3196 | } | 3190 | } |
3197 | rtstat_pde->proc_fops = &rt_cpu_seq_fops; | 3191 | rtstat_pde->proc_fops = &rt_cpu_seq_fops; |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index dfb4f145a139..d328d5986143 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -2644,7 +2644,7 @@ static int if6_seq_show(struct seq_file *seq, void *v) | |||
2644 | { | 2644 | { |
2645 | struct inet6_ifaddr *ifp = (struct inet6_ifaddr *)v; | 2645 | struct inet6_ifaddr *ifp = (struct inet6_ifaddr *)v; |
2646 | seq_printf(seq, | 2646 | seq_printf(seq, |
2647 | NIP6_FMT " %02x %02x %02x %02x %8s\n", | 2647 | NIP6_SEQFMT " %02x %02x %02x %02x %8s\n", |
2648 | NIP6(ifp->addr), | 2648 | NIP6(ifp->addr), |
2649 | ifp->idev->dev->ifindex, | 2649 | ifp->idev->dev->ifindex, |
2650 | ifp->prefix_len, | 2650 | ifp->prefix_len, |
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c index 72bd08af2dfb..840a33d33296 100644 --- a/net/ipv6/anycast.c +++ b/net/ipv6/anycast.c | |||
@@ -532,7 +532,7 @@ static int ac6_seq_show(struct seq_file *seq, void *v) | |||
532 | struct ac6_iter_state *state = ac6_seq_private(seq); | 532 | struct ac6_iter_state *state = ac6_seq_private(seq); |
533 | 533 | ||
534 | seq_printf(seq, | 534 | seq_printf(seq, |
535 | "%-4d %-15s " NIP6_FMT " %5d\n", | 535 | "%-4d %-15s " NIP6_SEQFMT " %5d\n", |
536 | state->dev->ifindex, state->dev->name, | 536 | state->dev->ifindex, state->dev->name, |
537 | NIP6(im->aca_addr), | 537 | NIP6(im->aca_addr), |
538 | im->aca_users); | 538 | im->aca_users); |
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c index 4183c8dac7f6..69cbe8a66d02 100644 --- a/net/ipv6/ip6_flowlabel.c +++ b/net/ipv6/ip6_flowlabel.c | |||
@@ -629,7 +629,7 @@ static void ip6fl_fl_seq_show(struct seq_file *seq, struct ip6_flowlabel *fl) | |||
629 | { | 629 | { |
630 | while(fl) { | 630 | while(fl) { |
631 | seq_printf(seq, | 631 | seq_printf(seq, |
632 | "%05X %-1d %-6d %-6d %-6ld %-8ld " NIP6_FMT " %-4d\n", | 632 | "%05X %-1d %-6d %-6d %-6ld %-8ld " NIP6_SEQFMT " %-4d\n", |
633 | (unsigned)ntohl(fl->label), | 633 | (unsigned)ntohl(fl->label), |
634 | fl->share, | 634 | fl->share, |
635 | (unsigned)fl->owner, | 635 | (unsigned)fl->owner, |
@@ -645,7 +645,7 @@ static void ip6fl_fl_seq_show(struct seq_file *seq, struct ip6_flowlabel *fl) | |||
645 | static int ip6fl_seq_show(struct seq_file *seq, void *v) | 645 | static int ip6fl_seq_show(struct seq_file *seq, void *v) |
646 | { | 646 | { |
647 | if (v == SEQ_START_TOKEN) | 647 | if (v == SEQ_START_TOKEN) |
648 | seq_printf(seq, "%-5s %-1s %-6s %-6s %-6s %-8s %-39s %s\n", | 648 | seq_printf(seq, "%-5s %-1s %-6s %-6s %-6s %-8s %-32s %s\n", |
649 | "Label", "S", "Owner", "Users", "Linger", "Expires", "Dst", "Opt"); | 649 | "Label", "S", "Owner", "Users", "Linger", "Expires", "Dst", "Opt"); |
650 | else | 650 | else |
651 | ip6fl_fl_seq_show(seq, v); | 651 | ip6fl_fl_seq_show(seq, v); |
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 0e03eabfb9da..6c05c7978bef 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -2373,7 +2373,7 @@ static int igmp6_mc_seq_show(struct seq_file *seq, void *v) | |||
2373 | struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq); | 2373 | struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq); |
2374 | 2374 | ||
2375 | seq_printf(seq, | 2375 | seq_printf(seq, |
2376 | "%-4d %-15s " NIP6_FMT " %5d %08X %ld\n", | 2376 | "%-4d %-15s " NIP6_SEQFMT " %5d %08X %ld\n", |
2377 | state->dev->ifindex, state->dev->name, | 2377 | state->dev->ifindex, state->dev->name, |
2378 | NIP6(im->mca_addr), | 2378 | NIP6(im->mca_addr), |
2379 | im->mca_users, im->mca_flags, | 2379 | im->mca_users, im->mca_flags, |
@@ -2542,12 +2542,12 @@ static int igmp6_mcf_seq_show(struct seq_file *seq, void *v) | |||
2542 | if (v == SEQ_START_TOKEN) { | 2542 | if (v == SEQ_START_TOKEN) { |
2543 | seq_printf(seq, | 2543 | seq_printf(seq, |
2544 | "%3s %6s " | 2544 | "%3s %6s " |
2545 | "%39s %39s %6s %6s\n", "Idx", | 2545 | "%32s %32s %6s %6s\n", "Idx", |
2546 | "Device", "Multicast Address", | 2546 | "Device", "Multicast Address", |
2547 | "Source Address", "INC", "EXC"); | 2547 | "Source Address", "INC", "EXC"); |
2548 | } else { | 2548 | } else { |
2549 | seq_printf(seq, | 2549 | seq_printf(seq, |
2550 | "%3d %6.6s " NIP6_FMT " " NIP6_FMT " %6lu %6lu\n", | 2550 | "%3d %6.6s " NIP6_SEQFMT " " NIP6_SEQFMT " %6lu %6lu\n", |
2551 | state->dev->ifindex, state->dev->name, | 2551 | state->dev->ifindex, state->dev->name, |
2552 | NIP6(state->im->mca_addr), | 2552 | NIP6(state->im->mca_addr), |
2553 | NIP6(psf->sf_addr), | 2553 | NIP6(psf->sf_addr), |
diff --git a/net/ipv6/netfilter/Makefile b/net/ipv6/netfilter/Makefile index 663b4749820d..db6073c94163 100644 --- a/net/ipv6/netfilter/Makefile +++ b/net/ipv6/netfilter/Makefile | |||
@@ -4,7 +4,6 @@ | |||
4 | 4 | ||
5 | # Link order matters here. | 5 | # Link order matters here. |
6 | obj-$(CONFIG_IP6_NF_IPTABLES) += ip6_tables.o | 6 | obj-$(CONFIG_IP6_NF_IPTABLES) += ip6_tables.o |
7 | obj-$(CONFIG_IP6_NF_MATCH_LENGTH) += ip6t_length.o | ||
8 | obj-$(CONFIG_IP6_NF_MATCH_RT) += ip6t_rt.o | 7 | obj-$(CONFIG_IP6_NF_MATCH_RT) += ip6t_rt.o |
9 | obj-$(CONFIG_IP6_NF_MATCH_OPTS) += ip6t_hbh.o ip6t_dst.o | 8 | obj-$(CONFIG_IP6_NF_MATCH_OPTS) += ip6t_hbh.o ip6t_dst.o |
10 | obj-$(CONFIG_IP6_NF_MATCH_IPV6HEADER) += ip6t_ipv6header.o | 9 | obj-$(CONFIG_IP6_NF_MATCH_IPV6HEADER) += ip6t_ipv6header.o |
diff --git a/net/ipv6/netfilter/ip6t_dst.c b/net/ipv6/netfilter/ip6t_dst.c index 80fe82669ce2..b4c153a53500 100644 --- a/net/ipv6/netfilter/ip6t_dst.c +++ b/net/ipv6/netfilter/ip6t_dst.c | |||
@@ -36,19 +36,19 @@ MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>"); | |||
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | /* | 38 | /* |
39 | * (Type & 0xC0) >> 6 | 39 | * (Type & 0xC0) >> 6 |
40 | * 0 -> ignorable | 40 | * 0 -> ignorable |
41 | * 1 -> must drop the packet | 41 | * 1 -> must drop the packet |
42 | * 2 -> send ICMP PARM PROB regardless and drop packet | 42 | * 2 -> send ICMP PARM PROB regardless and drop packet |
43 | * 3 -> Send ICMP if not a multicast address and drop packet | 43 | * 3 -> Send ICMP if not a multicast address and drop packet |
44 | * (Type & 0x20) >> 5 | 44 | * (Type & 0x20) >> 5 |
45 | * 0 -> invariant | 45 | * 0 -> invariant |
46 | * 1 -> can change the routing | 46 | * 1 -> can change the routing |
47 | * (Type & 0x1F) Type | 47 | * (Type & 0x1F) Type |
48 | * 0 -> Pad1 (only 1 byte!) | 48 | * 0 -> Pad1 (only 1 byte!) |
49 | * 1 -> PadN LENGTH info (total length = length + 2) | 49 | * 1 -> PadN LENGTH info (total length = length + 2) |
50 | * C0 | 2 -> JUMBO 4 x x x x ( xxxx > 64k ) | 50 | * C0 | 2 -> JUMBO 4 x x x x ( xxxx > 64k ) |
51 | * 5 -> RTALERT 2 x x | 51 | * 5 -> RTALERT 2 x x |
52 | */ | 52 | */ |
53 | 53 | ||
54 | static int | 54 | static int |
@@ -60,16 +60,16 @@ match(const struct sk_buff *skb, | |||
60 | unsigned int protoff, | 60 | unsigned int protoff, |
61 | int *hotdrop) | 61 | int *hotdrop) |
62 | { | 62 | { |
63 | struct ipv6_opt_hdr _optsh, *oh; | 63 | struct ipv6_opt_hdr _optsh, *oh; |
64 | const struct ip6t_opts *optinfo = matchinfo; | 64 | const struct ip6t_opts *optinfo = matchinfo; |
65 | unsigned int temp; | 65 | unsigned int temp; |
66 | unsigned int ptr; | 66 | unsigned int ptr; |
67 | unsigned int hdrlen = 0; | 67 | unsigned int hdrlen = 0; |
68 | unsigned int ret = 0; | 68 | unsigned int ret = 0; |
69 | u8 _opttype, *tp = NULL; | 69 | u8 _opttype, *tp = NULL; |
70 | u8 _optlen, *lp = NULL; | 70 | u8 _optlen, *lp = NULL; |
71 | unsigned int optlen; | 71 | unsigned int optlen; |
72 | 72 | ||
73 | #if HOPBYHOP | 73 | #if HOPBYHOP |
74 | if (ipv6_find_hdr(skb, &ptr, NEXTHDR_HOP, NULL) < 0) | 74 | if (ipv6_find_hdr(skb, &ptr, NEXTHDR_HOP, NULL) < 0) |
75 | #else | 75 | #else |
@@ -77,42 +77,41 @@ match(const struct sk_buff *skb, | |||
77 | #endif | 77 | #endif |
78 | return 0; | 78 | return 0; |
79 | 79 | ||
80 | oh = skb_header_pointer(skb, ptr, sizeof(_optsh), &_optsh); | 80 | oh = skb_header_pointer(skb, ptr, sizeof(_optsh), &_optsh); |
81 | if (oh == NULL){ | 81 | if (oh == NULL) { |
82 | *hotdrop = 1; | 82 | *hotdrop = 1; |
83 | return 0; | 83 | return 0; |
84 | } | 84 | } |
85 | 85 | ||
86 | hdrlen = ipv6_optlen(oh); | 86 | hdrlen = ipv6_optlen(oh); |
87 | if (skb->len - ptr < hdrlen){ | 87 | if (skb->len - ptr < hdrlen) { |
88 | /* Packet smaller than it's length field */ | 88 | /* Packet smaller than it's length field */ |
89 | return 0; | 89 | return 0; |
90 | } | 90 | } |
91 | 91 | ||
92 | DEBUGP("IPv6 OPTS LEN %u %u ", hdrlen, oh->hdrlen); | 92 | DEBUGP("IPv6 OPTS LEN %u %u ", hdrlen, oh->hdrlen); |
93 | 93 | ||
94 | DEBUGP("len %02X %04X %02X ", | 94 | DEBUGP("len %02X %04X %02X ", |
95 | optinfo->hdrlen, hdrlen, | 95 | optinfo->hdrlen, hdrlen, |
96 | (!(optinfo->flags & IP6T_OPTS_LEN) || | 96 | (!(optinfo->flags & IP6T_OPTS_LEN) || |
97 | ((optinfo->hdrlen == hdrlen) ^ | 97 | ((optinfo->hdrlen == hdrlen) ^ |
98 | !!(optinfo->invflags & IP6T_OPTS_INV_LEN)))); | 98 | !!(optinfo->invflags & IP6T_OPTS_INV_LEN)))); |
99 | 99 | ||
100 | ret = (oh != NULL) | 100 | ret = (oh != NULL) && |
101 | && | 101 | (!(optinfo->flags & IP6T_OPTS_LEN) || |
102 | (!(optinfo->flags & IP6T_OPTS_LEN) || | 102 | ((optinfo->hdrlen == hdrlen) ^ |
103 | ((optinfo->hdrlen == hdrlen) ^ | 103 | !!(optinfo->invflags & IP6T_OPTS_INV_LEN))); |
104 | !!(optinfo->invflags & IP6T_OPTS_INV_LEN))); | 104 | |
105 | 105 | ptr += 2; | |
106 | ptr += 2; | 106 | hdrlen -= 2; |
107 | hdrlen -= 2; | 107 | if (!(optinfo->flags & IP6T_OPTS_OPTS)) { |
108 | if ( !(optinfo->flags & IP6T_OPTS_OPTS) ){ | 108 | return ret; |
109 | return ret; | ||
110 | } else if (optinfo->flags & IP6T_OPTS_NSTRICT) { | 109 | } else if (optinfo->flags & IP6T_OPTS_NSTRICT) { |
111 | DEBUGP("Not strict - not implemented"); | 110 | DEBUGP("Not strict - not implemented"); |
112 | } else { | 111 | } else { |
113 | DEBUGP("Strict "); | 112 | DEBUGP("Strict "); |
114 | DEBUGP("#%d ",optinfo->optsnr); | 113 | DEBUGP("#%d ", optinfo->optsnr); |
115 | for(temp=0; temp<optinfo->optsnr; temp++){ | 114 | for (temp = 0; temp < optinfo->optsnr; temp++) { |
116 | /* type field exists ? */ | 115 | /* type field exists ? */ |
117 | if (hdrlen < 1) | 116 | if (hdrlen < 1) |
118 | break; | 117 | break; |
@@ -122,10 +121,10 @@ match(const struct sk_buff *skb, | |||
122 | break; | 121 | break; |
123 | 122 | ||
124 | /* Type check */ | 123 | /* Type check */ |
125 | if (*tp != (optinfo->opts[temp] & 0xFF00)>>8){ | 124 | if (*tp != (optinfo->opts[temp] & 0xFF00) >> 8) { |
126 | DEBUGP("Tbad %02X %02X\n", | 125 | DEBUGP("Tbad %02X %02X\n", |
127 | *tp, | 126 | *tp, |
128 | (optinfo->opts[temp] & 0xFF00)>>8); | 127 | (optinfo->opts[temp] & 0xFF00) >> 8); |
129 | return 0; | 128 | return 0; |
130 | } else { | 129 | } else { |
131 | DEBUGP("Tok "); | 130 | DEBUGP("Tok "); |
@@ -169,7 +168,8 @@ match(const struct sk_buff *skb, | |||
169 | } | 168 | } |
170 | if (temp == optinfo->optsnr) | 169 | if (temp == optinfo->optsnr) |
171 | return ret; | 170 | return ret; |
172 | else return 0; | 171 | else |
172 | return 0; | ||
173 | } | 173 | } |
174 | 174 | ||
175 | return 0; | 175 | return 0; |
@@ -178,25 +178,24 @@ match(const struct sk_buff *skb, | |||
178 | /* Called when user tries to insert an entry of this type. */ | 178 | /* Called when user tries to insert an entry of this type. */ |
179 | static int | 179 | static int |
180 | checkentry(const char *tablename, | 180 | checkentry(const char *tablename, |
181 | const void *info, | 181 | const void *info, |
182 | void *matchinfo, | 182 | void *matchinfo, |
183 | unsigned int matchinfosize, | 183 | unsigned int matchinfosize, |
184 | unsigned int hook_mask) | 184 | unsigned int hook_mask) |
185 | { | 185 | { |
186 | const struct ip6t_opts *optsinfo = matchinfo; | 186 | const struct ip6t_opts *optsinfo = matchinfo; |
187 | 187 | ||
188 | if (matchinfosize != IP6T_ALIGN(sizeof(struct ip6t_opts))) { | 188 | if (matchinfosize != IP6T_ALIGN(sizeof(struct ip6t_opts))) { |
189 | DEBUGP("ip6t_opts: matchsize %u != %u\n", | 189 | DEBUGP("ip6t_opts: matchsize %u != %u\n", |
190 | matchinfosize, IP6T_ALIGN(sizeof(struct ip6t_opts))); | 190 | matchinfosize, IP6T_ALIGN(sizeof(struct ip6t_opts))); |
191 | return 0; | 191 | return 0; |
192 | } | 192 | } |
193 | if (optsinfo->invflags & ~IP6T_OPTS_INV_MASK) { | 193 | if (optsinfo->invflags & ~IP6T_OPTS_INV_MASK) { |
194 | DEBUGP("ip6t_opts: unknown flags %X\n", | 194 | DEBUGP("ip6t_opts: unknown flags %X\n", optsinfo->invflags); |
195 | optsinfo->invflags); | 195 | return 0; |
196 | return 0; | 196 | } |
197 | } | 197 | |
198 | 198 | return 1; | |
199 | return 1; | ||
200 | } | 199 | } |
201 | 200 | ||
202 | static struct ip6t_match opts_match = { | 201 | static struct ip6t_match opts_match = { |
@@ -212,12 +211,12 @@ static struct ip6t_match opts_match = { | |||
212 | 211 | ||
213 | static int __init init(void) | 212 | static int __init init(void) |
214 | { | 213 | { |
215 | return ip6t_register_match(&opts_match); | 214 | return ip6t_register_match(&opts_match); |
216 | } | 215 | } |
217 | 216 | ||
218 | static void __exit cleanup(void) | 217 | static void __exit cleanup(void) |
219 | { | 218 | { |
220 | ip6t_unregister_match(&opts_match); | 219 | ip6t_unregister_match(&opts_match); |
221 | } | 220 | } |
222 | 221 | ||
223 | module_init(init); | 222 | module_init(init); |
diff --git a/net/ipv6/netfilter/ip6t_eui64.c b/net/ipv6/netfilter/ip6t_eui64.c index ddf5f571909c..27396ac0b9ed 100644 --- a/net/ipv6/netfilter/ip6t_eui64.c +++ b/net/ipv6/netfilter/ip6t_eui64.c | |||
@@ -27,45 +27,45 @@ match(const struct sk_buff *skb, | |||
27 | unsigned int protoff, | 27 | unsigned int protoff, |
28 | int *hotdrop) | 28 | int *hotdrop) |
29 | { | 29 | { |
30 | unsigned char eui64[8]; | ||
31 | int i = 0; | ||
30 | 32 | ||
31 | unsigned char eui64[8]; | 33 | if (!(skb->mac.raw >= skb->head && |
32 | int i=0; | 34 | (skb->mac.raw + ETH_HLEN) <= skb->data) && |
33 | 35 | offset != 0) { | |
34 | if ( !(skb->mac.raw >= skb->head | 36 | *hotdrop = 1; |
35 | && (skb->mac.raw + ETH_HLEN) <= skb->data) | 37 | return 0; |
36 | && offset != 0) { | 38 | } |
37 | *hotdrop = 1; | 39 | |
38 | return 0; | 40 | memset(eui64, 0, sizeof(eui64)); |
39 | } | 41 | |
40 | 42 | if (eth_hdr(skb)->h_proto == ntohs(ETH_P_IPV6)) { | |
41 | memset(eui64, 0, sizeof(eui64)); | 43 | if (skb->nh.ipv6h->version == 0x6) { |
42 | 44 | memcpy(eui64, eth_hdr(skb)->h_source, 3); | |
43 | if (eth_hdr(skb)->h_proto == ntohs(ETH_P_IPV6)) { | 45 | memcpy(eui64 + 5, eth_hdr(skb)->h_source + 3, 3); |
44 | if (skb->nh.ipv6h->version == 0x6) { | 46 | eui64[3] = 0xff; |
45 | memcpy(eui64, eth_hdr(skb)->h_source, 3); | 47 | eui64[4] = 0xfe; |
46 | memcpy(eui64 + 5, eth_hdr(skb)->h_source + 3, 3); | 48 | eui64[0] |= 0x02; |
47 | eui64[3]=0xff; | 49 | |
48 | eui64[4]=0xfe; | 50 | i = 0; |
49 | eui64[0] |= 0x02; | 51 | while ((skb->nh.ipv6h->saddr.s6_addr[8+i] == eui64[i]) |
50 | 52 | && (i < 8)) | |
51 | i=0; | 53 | i++; |
52 | while ((skb->nh.ipv6h->saddr.s6_addr[8+i] == | 54 | |
53 | eui64[i]) && (i<8)) i++; | 55 | if (i == 8) |
54 | 56 | return 1; | |
55 | if ( i == 8 ) | 57 | } |
56 | return 1; | 58 | } |
57 | } | 59 | |
58 | } | 60 | return 0; |
59 | |||
60 | return 0; | ||
61 | } | 61 | } |
62 | 62 | ||
63 | static int | 63 | static int |
64 | ip6t_eui64_checkentry(const char *tablename, | 64 | ip6t_eui64_checkentry(const char *tablename, |
65 | const void *ip, | 65 | const void *ip, |
66 | void *matchinfo, | 66 | void *matchinfo, |
67 | unsigned int matchsize, | 67 | unsigned int matchsize, |
68 | unsigned int hook_mask) | 68 | unsigned int hook_mask) |
69 | { | 69 | { |
70 | if (hook_mask | 70 | if (hook_mask |
71 | & ~((1 << NF_IP6_PRE_ROUTING) | (1 << NF_IP6_LOCAL_IN) | | 71 | & ~((1 << NF_IP6_PRE_ROUTING) | (1 << NF_IP6_LOCAL_IN) | |
diff --git a/net/ipv6/netfilter/ip6t_frag.c b/net/ipv6/netfilter/ip6t_frag.c index a9964b946ed5..4c14125a0e26 100644 --- a/net/ipv6/netfilter/ip6t_frag.c +++ b/net/ipv6/netfilter/ip6t_frag.c | |||
@@ -31,12 +31,12 @@ MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>"); | |||
31 | static inline int | 31 | static inline int |
32 | id_match(u_int32_t min, u_int32_t max, u_int32_t id, int invert) | 32 | id_match(u_int32_t min, u_int32_t max, u_int32_t id, int invert) |
33 | { | 33 | { |
34 | int r=0; | 34 | int r = 0; |
35 | DEBUGP("frag id_match:%c 0x%x <= 0x%x <= 0x%x",invert? '!':' ', | 35 | DEBUGP("frag id_match:%c 0x%x <= 0x%x <= 0x%x", invert ? '!' : ' ', |
36 | min,id,max); | 36 | min, id, max); |
37 | r=(id >= min && id <= max) ^ invert; | 37 | r = (id >= min && id <= max) ^ invert; |
38 | DEBUGP(" result %s\n",r? "PASS" : "FAILED"); | 38 | DEBUGP(" result %s\n", r ? "PASS" : "FAILED"); |
39 | return r; | 39 | return r; |
40 | } | 40 | } |
41 | 41 | ||
42 | static int | 42 | static int |
@@ -48,92 +48,91 @@ match(const struct sk_buff *skb, | |||
48 | unsigned int protoff, | 48 | unsigned int protoff, |
49 | int *hotdrop) | 49 | int *hotdrop) |
50 | { | 50 | { |
51 | struct frag_hdr _frag, *fh; | 51 | struct frag_hdr _frag, *fh; |
52 | const struct ip6t_frag *fraginfo = matchinfo; | 52 | const struct ip6t_frag *fraginfo = matchinfo; |
53 | unsigned int ptr; | 53 | unsigned int ptr; |
54 | 54 | ||
55 | if (ipv6_find_hdr(skb, &ptr, NEXTHDR_FRAGMENT, NULL) < 0) | 55 | if (ipv6_find_hdr(skb, &ptr, NEXTHDR_FRAGMENT, NULL) < 0) |
56 | return 0; | 56 | return 0; |
57 | 57 | ||
58 | fh = skb_header_pointer(skb, ptr, sizeof(_frag), &_frag); | 58 | fh = skb_header_pointer(skb, ptr, sizeof(_frag), &_frag); |
59 | if (fh == NULL){ | 59 | if (fh == NULL) { |
60 | *hotdrop = 1; | 60 | *hotdrop = 1; |
61 | return 0; | 61 | return 0; |
62 | } | 62 | } |
63 | 63 | ||
64 | DEBUGP("INFO %04X ", fh->frag_off); | 64 | DEBUGP("INFO %04X ", fh->frag_off); |
65 | DEBUGP("OFFSET %04X ", ntohs(fh->frag_off) & ~0x7); | 65 | DEBUGP("OFFSET %04X ", ntohs(fh->frag_off) & ~0x7); |
66 | DEBUGP("RES %02X %04X", fh->reserved, ntohs(fh->frag_off) & 0x6); | 66 | DEBUGP("RES %02X %04X", fh->reserved, ntohs(fh->frag_off) & 0x6); |
67 | DEBUGP("MF %04X ", fh->frag_off & htons(IP6_MF)); | 67 | DEBUGP("MF %04X ", fh->frag_off & htons(IP6_MF)); |
68 | DEBUGP("ID %u %08X\n", ntohl(fh->identification), | 68 | DEBUGP("ID %u %08X\n", ntohl(fh->identification), |
69 | ntohl(fh->identification)); | 69 | ntohl(fh->identification)); |
70 | 70 | ||
71 | DEBUGP("IPv6 FRAG id %02X ", | 71 | DEBUGP("IPv6 FRAG id %02X ", |
72 | (id_match(fraginfo->ids[0], fraginfo->ids[1], | 72 | (id_match(fraginfo->ids[0], fraginfo->ids[1], |
73 | ntohl(fh->identification), | 73 | ntohl(fh->identification), |
74 | !!(fraginfo->invflags & IP6T_FRAG_INV_IDS)))); | 74 | !!(fraginfo->invflags & IP6T_FRAG_INV_IDS)))); |
75 | DEBUGP("res %02X %02X%04X %02X ", | 75 | DEBUGP("res %02X %02X%04X %02X ", |
76 | (fraginfo->flags & IP6T_FRAG_RES), fh->reserved, | 76 | (fraginfo->flags & IP6T_FRAG_RES), fh->reserved, |
77 | ntohs(fh->frag_off) & 0x6, | 77 | ntohs(fh->frag_off) & 0x6, |
78 | !((fraginfo->flags & IP6T_FRAG_RES) | 78 | !((fraginfo->flags & IP6T_FRAG_RES) |
79 | && (fh->reserved || (ntohs(fh->frag_off) & 0x06)))); | 79 | && (fh->reserved || (ntohs(fh->frag_off) & 0x06)))); |
80 | DEBUGP("first %02X %02X %02X ", | 80 | DEBUGP("first %02X %02X %02X ", |
81 | (fraginfo->flags & IP6T_FRAG_FST), | 81 | (fraginfo->flags & IP6T_FRAG_FST), |
82 | ntohs(fh->frag_off) & ~0x7, | 82 | ntohs(fh->frag_off) & ~0x7, |
83 | !((fraginfo->flags & IP6T_FRAG_FST) | 83 | !((fraginfo->flags & IP6T_FRAG_FST) |
84 | && (ntohs(fh->frag_off) & ~0x7))); | 84 | && (ntohs(fh->frag_off) & ~0x7))); |
85 | DEBUGP("mf %02X %02X %02X ", | 85 | DEBUGP("mf %02X %02X %02X ", |
86 | (fraginfo->flags & IP6T_FRAG_MF), | 86 | (fraginfo->flags & IP6T_FRAG_MF), |
87 | ntohs(fh->frag_off) & IP6_MF, | 87 | ntohs(fh->frag_off) & IP6_MF, |
88 | !((fraginfo->flags & IP6T_FRAG_MF) | 88 | !((fraginfo->flags & IP6T_FRAG_MF) |
89 | && !((ntohs(fh->frag_off) & IP6_MF)))); | 89 | && !((ntohs(fh->frag_off) & IP6_MF)))); |
90 | DEBUGP("last %02X %02X %02X\n", | 90 | DEBUGP("last %02X %02X %02X\n", |
91 | (fraginfo->flags & IP6T_FRAG_NMF), | 91 | (fraginfo->flags & IP6T_FRAG_NMF), |
92 | ntohs(fh->frag_off) & IP6_MF, | 92 | ntohs(fh->frag_off) & IP6_MF, |
93 | !((fraginfo->flags & IP6T_FRAG_NMF) | 93 | !((fraginfo->flags & IP6T_FRAG_NMF) |
94 | && (ntohs(fh->frag_off) & IP6_MF))); | 94 | && (ntohs(fh->frag_off) & IP6_MF))); |
95 | 95 | ||
96 | return (fh != NULL) | 96 | return (fh != NULL) |
97 | && | 97 | && |
98 | (id_match(fraginfo->ids[0], fraginfo->ids[1], | 98 | (id_match(fraginfo->ids[0], fraginfo->ids[1], |
99 | ntohl(fh->identification), | 99 | ntohl(fh->identification), |
100 | !!(fraginfo->invflags & IP6T_FRAG_INV_IDS))) | 100 | !!(fraginfo->invflags & IP6T_FRAG_INV_IDS))) |
101 | && | 101 | && |
102 | !((fraginfo->flags & IP6T_FRAG_RES) | 102 | !((fraginfo->flags & IP6T_FRAG_RES) |
103 | && (fh->reserved || (ntohs(fh->frag_off) & 0x6))) | 103 | && (fh->reserved || (ntohs(fh->frag_off) & 0x6))) |
104 | && | 104 | && |
105 | !((fraginfo->flags & IP6T_FRAG_FST) | 105 | !((fraginfo->flags & IP6T_FRAG_FST) |
106 | && (ntohs(fh->frag_off) & ~0x7)) | 106 | && (ntohs(fh->frag_off) & ~0x7)) |
107 | && | 107 | && |
108 | !((fraginfo->flags & IP6T_FRAG_MF) | 108 | !((fraginfo->flags & IP6T_FRAG_MF) |
109 | && !(ntohs(fh->frag_off) & IP6_MF)) | 109 | && !(ntohs(fh->frag_off) & IP6_MF)) |
110 | && | 110 | && |
111 | !((fraginfo->flags & IP6T_FRAG_NMF) | 111 | !((fraginfo->flags & IP6T_FRAG_NMF) |
112 | && (ntohs(fh->frag_off) & IP6_MF)); | 112 | && (ntohs(fh->frag_off) & IP6_MF)); |
113 | } | 113 | } |
114 | 114 | ||
115 | /* Called when user tries to insert an entry of this type. */ | 115 | /* Called when user tries to insert an entry of this type. */ |
116 | static int | 116 | static int |
117 | checkentry(const char *tablename, | 117 | checkentry(const char *tablename, |
118 | const void *ip, | 118 | const void *ip, |
119 | void *matchinfo, | 119 | void *matchinfo, |
120 | unsigned int matchinfosize, | 120 | unsigned int matchinfosize, |
121 | unsigned int hook_mask) | 121 | unsigned int hook_mask) |
122 | { | 122 | { |
123 | const struct ip6t_frag *fraginfo = matchinfo; | 123 | const struct ip6t_frag *fraginfo = matchinfo; |
124 | 124 | ||
125 | if (matchinfosize != IP6T_ALIGN(sizeof(struct ip6t_frag))) { | 125 | if (matchinfosize != IP6T_ALIGN(sizeof(struct ip6t_frag))) { |
126 | DEBUGP("ip6t_frag: matchsize %u != %u\n", | 126 | DEBUGP("ip6t_frag: matchsize %u != %u\n", |
127 | matchinfosize, IP6T_ALIGN(sizeof(struct ip6t_frag))); | 127 | matchinfosize, IP6T_ALIGN(sizeof(struct ip6t_frag))); |
128 | return 0; | 128 | return 0; |
129 | } | 129 | } |
130 | if (fraginfo->invflags & ~IP6T_FRAG_INV_MASK) { | 130 | if (fraginfo->invflags & ~IP6T_FRAG_INV_MASK) { |
131 | DEBUGP("ip6t_frag: unknown flags %X\n", | 131 | DEBUGP("ip6t_frag: unknown flags %X\n", fraginfo->invflags); |
132 | fraginfo->invflags); | 132 | return 0; |
133 | return 0; | 133 | } |
134 | } | 134 | |
135 | 135 | return 1; | |
136 | return 1; | ||
137 | } | 136 | } |
138 | 137 | ||
139 | static struct ip6t_match frag_match = { | 138 | static struct ip6t_match frag_match = { |
@@ -145,12 +144,12 @@ static struct ip6t_match frag_match = { | |||
145 | 144 | ||
146 | static int __init init(void) | 145 | static int __init init(void) |
147 | { | 146 | { |
148 | return ip6t_register_match(&frag_match); | 147 | return ip6t_register_match(&frag_match); |
149 | } | 148 | } |
150 | 149 | ||
151 | static void __exit cleanup(void) | 150 | static void __exit cleanup(void) |
152 | { | 151 | { |
153 | ip6t_unregister_match(&frag_match); | 152 | ip6t_unregister_match(&frag_match); |
154 | } | 153 | } |
155 | 154 | ||
156 | module_init(init); | 155 | module_init(init); |
diff --git a/net/ipv6/netfilter/ip6t_hbh.c b/net/ipv6/netfilter/ip6t_hbh.c index ed8ded18bbd4..37a8474a7e0c 100644 --- a/net/ipv6/netfilter/ip6t_hbh.c +++ b/net/ipv6/netfilter/ip6t_hbh.c | |||
@@ -36,19 +36,19 @@ MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>"); | |||
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | /* | 38 | /* |
39 | * (Type & 0xC0) >> 6 | 39 | * (Type & 0xC0) >> 6 |
40 | * 0 -> ignorable | 40 | * 0 -> ignorable |
41 | * 1 -> must drop the packet | 41 | * 1 -> must drop the packet |
42 | * 2 -> send ICMP PARM PROB regardless and drop packet | 42 | * 2 -> send ICMP PARM PROB regardless and drop packet |
43 | * 3 -> Send ICMP if not a multicast address and drop packet | 43 | * 3 -> Send ICMP if not a multicast address and drop packet |
44 | * (Type & 0x20) >> 5 | 44 | * (Type & 0x20) >> 5 |
45 | * 0 -> invariant | 45 | * 0 -> invariant |
46 | * 1 -> can change the routing | 46 | * 1 -> can change the routing |
47 | * (Type & 0x1F) Type | 47 | * (Type & 0x1F) Type |
48 | * 0 -> Pad1 (only 1 byte!) | 48 | * 0 -> Pad1 (only 1 byte!) |
49 | * 1 -> PadN LENGTH info (total length = length + 2) | 49 | * 1 -> PadN LENGTH info (total length = length + 2) |
50 | * C0 | 2 -> JUMBO 4 x x x x ( xxxx > 64k ) | 50 | * C0 | 2 -> JUMBO 4 x x x x ( xxxx > 64k ) |
51 | * 5 -> RTALERT 2 x x | 51 | * 5 -> RTALERT 2 x x |
52 | */ | 52 | */ |
53 | 53 | ||
54 | static int | 54 | static int |
@@ -60,16 +60,16 @@ match(const struct sk_buff *skb, | |||
60 | unsigned int protoff, | 60 | unsigned int protoff, |
61 | int *hotdrop) | 61 | int *hotdrop) |
62 | { | 62 | { |
63 | struct ipv6_opt_hdr _optsh, *oh; | 63 | struct ipv6_opt_hdr _optsh, *oh; |
64 | const struct ip6t_opts *optinfo = matchinfo; | 64 | const struct ip6t_opts *optinfo = matchinfo; |
65 | unsigned int temp; | 65 | unsigned int temp; |
66 | unsigned int ptr; | 66 | unsigned int ptr; |
67 | unsigned int hdrlen = 0; | 67 | unsigned int hdrlen = 0; |
68 | unsigned int ret = 0; | 68 | unsigned int ret = 0; |
69 | u8 _opttype, *tp = NULL; | 69 | u8 _opttype, *tp = NULL; |
70 | u8 _optlen, *lp = NULL; | 70 | u8 _optlen, *lp = NULL; |
71 | unsigned int optlen; | 71 | unsigned int optlen; |
72 | 72 | ||
73 | #if HOPBYHOP | 73 | #if HOPBYHOP |
74 | if (ipv6_find_hdr(skb, &ptr, NEXTHDR_HOP, NULL) < 0) | 74 | if (ipv6_find_hdr(skb, &ptr, NEXTHDR_HOP, NULL) < 0) |
75 | #else | 75 | #else |
@@ -77,42 +77,41 @@ match(const struct sk_buff *skb, | |||
77 | #endif | 77 | #endif |
78 | return 0; | 78 | return 0; |
79 | 79 | ||
80 | oh = skb_header_pointer(skb, ptr, sizeof(_optsh), &_optsh); | 80 | oh = skb_header_pointer(skb, ptr, sizeof(_optsh), &_optsh); |
81 | if (oh == NULL){ | 81 | if (oh == NULL) { |
82 | *hotdrop = 1; | 82 | *hotdrop = 1; |
83 | return 0; | 83 | return 0; |
84 | } | 84 | } |
85 | 85 | ||
86 | hdrlen = ipv6_optlen(oh); | 86 | hdrlen = ipv6_optlen(oh); |
87 | if (skb->len - ptr < hdrlen){ | 87 | if (skb->len - ptr < hdrlen) { |
88 | /* Packet smaller than it's length field */ | 88 | /* Packet smaller than it's length field */ |
89 | return 0; | 89 | return 0; |
90 | } | 90 | } |
91 | 91 | ||
92 | DEBUGP("IPv6 OPTS LEN %u %u ", hdrlen, oh->hdrlen); | 92 | DEBUGP("IPv6 OPTS LEN %u %u ", hdrlen, oh->hdrlen); |
93 | 93 | ||
94 | DEBUGP("len %02X %04X %02X ", | 94 | DEBUGP("len %02X %04X %02X ", |
95 | optinfo->hdrlen, hdrlen, | 95 | optinfo->hdrlen, hdrlen, |
96 | (!(optinfo->flags & IP6T_OPTS_LEN) || | 96 | (!(optinfo->flags & IP6T_OPTS_LEN) || |
97 | ((optinfo->hdrlen == hdrlen) ^ | 97 | ((optinfo->hdrlen == hdrlen) ^ |
98 | !!(optinfo->invflags & IP6T_OPTS_INV_LEN)))); | 98 | !!(optinfo->invflags & IP6T_OPTS_INV_LEN)))); |
99 | 99 | ||
100 | ret = (oh != NULL) | 100 | ret = (oh != NULL) && |
101 | && | 101 | (!(optinfo->flags & IP6T_OPTS_LEN) || |
102 | (!(optinfo->flags & IP6T_OPTS_LEN) || | 102 | ((optinfo->hdrlen == hdrlen) ^ |
103 | ((optinfo->hdrlen == hdrlen) ^ | 103 | !!(optinfo->invflags & IP6T_OPTS_INV_LEN))); |
104 | !!(optinfo->invflags & IP6T_OPTS_INV_LEN))); | 104 | |
105 | 105 | ptr += 2; | |
106 | ptr += 2; | 106 | hdrlen -= 2; |
107 | hdrlen -= 2; | 107 | if (!(optinfo->flags & IP6T_OPTS_OPTS)) { |
108 | if ( !(optinfo->flags & IP6T_OPTS_OPTS) ){ | 108 | return ret; |
109 | return ret; | ||
110 | } else if (optinfo->flags & IP6T_OPTS_NSTRICT) { | 109 | } else if (optinfo->flags & IP6T_OPTS_NSTRICT) { |
111 | DEBUGP("Not strict - not implemented"); | 110 | DEBUGP("Not strict - not implemented"); |
112 | } else { | 111 | } else { |
113 | DEBUGP("Strict "); | 112 | DEBUGP("Strict "); |
114 | DEBUGP("#%d ",optinfo->optsnr); | 113 | DEBUGP("#%d ", optinfo->optsnr); |
115 | for(temp=0; temp<optinfo->optsnr; temp++){ | 114 | for (temp = 0; temp < optinfo->optsnr; temp++) { |
116 | /* type field exists ? */ | 115 | /* type field exists ? */ |
117 | if (hdrlen < 1) | 116 | if (hdrlen < 1) |
118 | break; | 117 | break; |
@@ -122,10 +121,10 @@ match(const struct sk_buff *skb, | |||
122 | break; | 121 | break; |
123 | 122 | ||
124 | /* Type check */ | 123 | /* Type check */ |
125 | if (*tp != (optinfo->opts[temp] & 0xFF00)>>8){ | 124 | if (*tp != (optinfo->opts[temp] & 0xFF00) >> 8) { |
126 | DEBUGP("Tbad %02X %02X\n", | 125 | DEBUGP("Tbad %02X %02X\n", |
127 | *tp, | 126 | *tp, |
128 | (optinfo->opts[temp] & 0xFF00)>>8); | 127 | (optinfo->opts[temp] & 0xFF00) >> 8); |
129 | return 0; | 128 | return 0; |
130 | } else { | 129 | } else { |
131 | DEBUGP("Tok "); | 130 | DEBUGP("Tok "); |
@@ -169,7 +168,8 @@ match(const struct sk_buff *skb, | |||
169 | } | 168 | } |
170 | if (temp == optinfo->optsnr) | 169 | if (temp == optinfo->optsnr) |
171 | return ret; | 170 | return ret; |
172 | else return 0; | 171 | else |
172 | return 0; | ||
173 | } | 173 | } |
174 | 174 | ||
175 | return 0; | 175 | return 0; |
@@ -178,25 +178,24 @@ match(const struct sk_buff *skb, | |||
178 | /* Called when user tries to insert an entry of this type. */ | 178 | /* Called when user tries to insert an entry of this type. */ |
179 | static int | 179 | static int |
180 | checkentry(const char *tablename, | 180 | checkentry(const char *tablename, |
181 | const void *entry, | 181 | const void *entry, |
182 | void *matchinfo, | 182 | void *matchinfo, |
183 | unsigned int matchinfosize, | 183 | unsigned int matchinfosize, |
184 | unsigned int hook_mask) | 184 | unsigned int hook_mask) |
185 | { | 185 | { |
186 | const struct ip6t_opts *optsinfo = matchinfo; | 186 | const struct ip6t_opts *optsinfo = matchinfo; |
187 | 187 | ||
188 | if (matchinfosize != IP6T_ALIGN(sizeof(struct ip6t_opts))) { | 188 | if (matchinfosize != IP6T_ALIGN(sizeof(struct ip6t_opts))) { |
189 | DEBUGP("ip6t_opts: matchsize %u != %u\n", | 189 | DEBUGP("ip6t_opts: matchsize %u != %u\n", |
190 | matchinfosize, IP6T_ALIGN(sizeof(struct ip6t_opts))); | 190 | matchinfosize, IP6T_ALIGN(sizeof(struct ip6t_opts))); |
191 | return 0; | 191 | return 0; |
192 | } | 192 | } |
193 | if (optsinfo->invflags & ~IP6T_OPTS_INV_MASK) { | 193 | if (optsinfo->invflags & ~IP6T_OPTS_INV_MASK) { |
194 | DEBUGP("ip6t_opts: unknown flags %X\n", | 194 | DEBUGP("ip6t_opts: unknown flags %X\n", optsinfo->invflags); |
195 | optsinfo->invflags); | 195 | return 0; |
196 | return 0; | 196 | } |
197 | } | 197 | |
198 | 198 | return 1; | |
199 | return 1; | ||
200 | } | 199 | } |
201 | 200 | ||
202 | static struct ip6t_match opts_match = { | 201 | static struct ip6t_match opts_match = { |
@@ -212,12 +211,12 @@ static struct ip6t_match opts_match = { | |||
212 | 211 | ||
213 | static int __init init(void) | 212 | static int __init init(void) |
214 | { | 213 | { |
215 | return ip6t_register_match(&opts_match); | 214 | return ip6t_register_match(&opts_match); |
216 | } | 215 | } |
217 | 216 | ||
218 | static void __exit cleanup(void) | 217 | static void __exit cleanup(void) |
219 | { | 218 | { |
220 | ip6t_unregister_match(&opts_match); | 219 | ip6t_unregister_match(&opts_match); |
221 | } | 220 | } |
222 | 221 | ||
223 | module_init(init); | 222 | module_init(init); |
diff --git a/net/ipv6/netfilter/ip6t_ipv6header.c b/net/ipv6/netfilter/ip6t_ipv6header.c index fda1ceaf5a29..83ad6b272f7e 100644 --- a/net/ipv6/netfilter/ip6t_ipv6header.c +++ b/net/ipv6/netfilter/ip6t_ipv6header.c | |||
@@ -50,20 +50,20 @@ ipv6header_match(const struct sk_buff *skb, | |||
50 | len = skb->len - ptr; | 50 | len = skb->len - ptr; |
51 | temp = 0; | 51 | temp = 0; |
52 | 52 | ||
53 | while (ip6t_ext_hdr(nexthdr)) { | 53 | while (ip6t_ext_hdr(nexthdr)) { |
54 | struct ipv6_opt_hdr _hdr, *hp; | 54 | struct ipv6_opt_hdr _hdr, *hp; |
55 | int hdrlen; | 55 | int hdrlen; |
56 | 56 | ||
57 | /* Is there enough space for the next ext header? */ | 57 | /* Is there enough space for the next ext header? */ |
58 | if (len < (int)sizeof(struct ipv6_opt_hdr)) | 58 | if (len < (int)sizeof(struct ipv6_opt_hdr)) |
59 | return 0; | 59 | return 0; |
60 | /* No more exthdr -> evaluate */ | 60 | /* No more exthdr -> evaluate */ |
61 | if (nexthdr == NEXTHDR_NONE) { | 61 | if (nexthdr == NEXTHDR_NONE) { |
62 | temp |= MASK_NONE; | 62 | temp |= MASK_NONE; |
63 | break; | 63 | break; |
64 | } | 64 | } |
65 | /* ESP -> evaluate */ | 65 | /* ESP -> evaluate */ |
66 | if (nexthdr == NEXTHDR_ESP) { | 66 | if (nexthdr == NEXTHDR_ESP) { |
67 | temp |= MASK_ESP; | 67 | temp |= MASK_ESP; |
68 | break; | 68 | break; |
69 | } | 69 | } |
@@ -72,43 +72,43 @@ ipv6header_match(const struct sk_buff *skb, | |||
72 | BUG_ON(hp == NULL); | 72 | BUG_ON(hp == NULL); |
73 | 73 | ||
74 | /* Calculate the header length */ | 74 | /* Calculate the header length */ |
75 | if (nexthdr == NEXTHDR_FRAGMENT) { | 75 | if (nexthdr == NEXTHDR_FRAGMENT) { |
76 | hdrlen = 8; | 76 | hdrlen = 8; |
77 | } else if (nexthdr == NEXTHDR_AUTH) | 77 | } else if (nexthdr == NEXTHDR_AUTH) |
78 | hdrlen = (hp->hdrlen+2)<<2; | 78 | hdrlen = (hp->hdrlen + 2) << 2; |
79 | else | 79 | else |
80 | hdrlen = ipv6_optlen(hp); | 80 | hdrlen = ipv6_optlen(hp); |
81 | 81 | ||
82 | /* set the flag */ | 82 | /* set the flag */ |
83 | switch (nexthdr){ | 83 | switch (nexthdr) { |
84 | case NEXTHDR_HOP: | 84 | case NEXTHDR_HOP: |
85 | temp |= MASK_HOPOPTS; | 85 | temp |= MASK_HOPOPTS; |
86 | break; | 86 | break; |
87 | case NEXTHDR_ROUTING: | 87 | case NEXTHDR_ROUTING: |
88 | temp |= MASK_ROUTING; | 88 | temp |= MASK_ROUTING; |
89 | break; | 89 | break; |
90 | case NEXTHDR_FRAGMENT: | 90 | case NEXTHDR_FRAGMENT: |
91 | temp |= MASK_FRAGMENT; | 91 | temp |= MASK_FRAGMENT; |
92 | break; | 92 | break; |
93 | case NEXTHDR_AUTH: | 93 | case NEXTHDR_AUTH: |
94 | temp |= MASK_AH; | 94 | temp |= MASK_AH; |
95 | break; | 95 | break; |
96 | case NEXTHDR_DEST: | 96 | case NEXTHDR_DEST: |
97 | temp |= MASK_DSTOPTS; | 97 | temp |= MASK_DSTOPTS; |
98 | break; | 98 | break; |
99 | default: | 99 | default: |
100 | return 0; | 100 | return 0; |
101 | break; | 101 | break; |
102 | } | 102 | } |
103 | 103 | ||
104 | nexthdr = hp->nexthdr; | 104 | nexthdr = hp->nexthdr; |
105 | len -= hdrlen; | 105 | len -= hdrlen; |
106 | ptr += hdrlen; | 106 | ptr += hdrlen; |
107 | if (ptr > skb->len) | 107 | if (ptr > skb->len) |
108 | break; | 108 | break; |
109 | } | 109 | } |
110 | 110 | ||
111 | if ( (nexthdr != NEXTHDR_NONE ) && (nexthdr != NEXTHDR_ESP) ) | 111 | if ((nexthdr != NEXTHDR_NONE) && (nexthdr != NEXTHDR_ESP)) |
112 | temp |= MASK_PROTO; | 112 | temp |= MASK_PROTO; |
113 | 113 | ||
114 | if (info->modeflag) | 114 | if (info->modeflag) |
@@ -137,8 +137,8 @@ ipv6header_checkentry(const char *tablename, | |||
137 | return 0; | 137 | return 0; |
138 | 138 | ||
139 | /* invflags is 0 or 0xff in hard mode */ | 139 | /* invflags is 0 or 0xff in hard mode */ |
140 | if ((!info->modeflag) && info->invflags != 0x00 | 140 | if ((!info->modeflag) && info->invflags != 0x00 && |
141 | && info->invflags != 0xFF) | 141 | info->invflags != 0xFF) |
142 | return 0; | 142 | return 0; |
143 | 143 | ||
144 | return 1; | 144 | return 1; |
@@ -152,7 +152,7 @@ static struct ip6t_match ip6t_ipv6header_match = { | |||
152 | .me = THIS_MODULE, | 152 | .me = THIS_MODULE, |
153 | }; | 153 | }; |
154 | 154 | ||
155 | static int __init ipv6header_init(void) | 155 | static int __init ipv6header_init(void) |
156 | { | 156 | { |
157 | return ip6t_register_match(&ip6t_ipv6header_match); | 157 | return ip6t_register_match(&ip6t_ipv6header_match); |
158 | } | 158 | } |
@@ -164,4 +164,3 @@ static void __exit ipv6header_exit(void) | |||
164 | 164 | ||
165 | module_init(ipv6header_init); | 165 | module_init(ipv6header_init); |
166 | module_exit(ipv6header_exit); | 166 | module_exit(ipv6header_exit); |
167 | |||
diff --git a/net/ipv6/netfilter/ip6t_owner.c b/net/ipv6/netfilter/ip6t_owner.c index 5409b375b512..8c8a4c7ec934 100644 --- a/net/ipv6/netfilter/ip6t_owner.c +++ b/net/ipv6/netfilter/ip6t_owner.c | |||
@@ -36,14 +36,14 @@ match(const struct sk_buff *skb, | |||
36 | if (!skb->sk || !skb->sk->sk_socket || !skb->sk->sk_socket->file) | 36 | if (!skb->sk || !skb->sk->sk_socket || !skb->sk->sk_socket->file) |
37 | return 0; | 37 | return 0; |
38 | 38 | ||
39 | if(info->match & IP6T_OWNER_UID) { | 39 | if (info->match & IP6T_OWNER_UID) { |
40 | if((skb->sk->sk_socket->file->f_uid != info->uid) ^ | 40 | if ((skb->sk->sk_socket->file->f_uid != info->uid) ^ |
41 | !!(info->invert & IP6T_OWNER_UID)) | 41 | !!(info->invert & IP6T_OWNER_UID)) |
42 | return 0; | 42 | return 0; |
43 | } | 43 | } |
44 | 44 | ||
45 | if(info->match & IP6T_OWNER_GID) { | 45 | if (info->match & IP6T_OWNER_GID) { |
46 | if((skb->sk->sk_socket->file->f_gid != info->gid) ^ | 46 | if ((skb->sk->sk_socket->file->f_gid != info->gid) ^ |
47 | !!(info->invert & IP6T_OWNER_GID)) | 47 | !!(info->invert & IP6T_OWNER_GID)) |
48 | return 0; | 48 | return 0; |
49 | } | 49 | } |
@@ -53,23 +53,23 @@ match(const struct sk_buff *skb, | |||
53 | 53 | ||
54 | static int | 54 | static int |
55 | checkentry(const char *tablename, | 55 | checkentry(const char *tablename, |
56 | const void *ip, | 56 | const void *ip, |
57 | void *matchinfo, | 57 | void *matchinfo, |
58 | unsigned int matchsize, | 58 | unsigned int matchsize, |
59 | unsigned int hook_mask) | 59 | unsigned int hook_mask) |
60 | { | 60 | { |
61 | const struct ip6t_owner_info *info = matchinfo; | 61 | const struct ip6t_owner_info *info = matchinfo; |
62 | 62 | ||
63 | if (hook_mask | 63 | if (hook_mask |
64 | & ~((1 << NF_IP6_LOCAL_OUT) | (1 << NF_IP6_POST_ROUTING))) { | 64 | & ~((1 << NF_IP6_LOCAL_OUT) | (1 << NF_IP6_POST_ROUTING))) { |
65 | printk("ip6t_owner: only valid for LOCAL_OUT or POST_ROUTING.\n"); | 65 | printk("ip6t_owner: only valid for LOCAL_OUT or POST_ROUTING.\n"); |
66 | return 0; | 66 | return 0; |
67 | } | 67 | } |
68 | 68 | ||
69 | if (matchsize != IP6T_ALIGN(sizeof(struct ip6t_owner_info))) | 69 | if (matchsize != IP6T_ALIGN(sizeof(struct ip6t_owner_info))) |
70 | return 0; | 70 | return 0; |
71 | 71 | ||
72 | if (info->match & (IP6T_OWNER_PID|IP6T_OWNER_SID)) { | 72 | if (info->match & (IP6T_OWNER_PID | IP6T_OWNER_SID)) { |
73 | printk("ipt_owner: pid and sid matching " | 73 | printk("ipt_owner: pid and sid matching " |
74 | "not supported anymore\n"); | 74 | "not supported anymore\n"); |
75 | return 0; | 75 | return 0; |
diff --git a/net/ipv6/netfilter/ip6t_policy.c b/net/ipv6/netfilter/ip6t_policy.c index 13fedad48c1d..afe1cc4c18a5 100644 --- a/net/ipv6/netfilter/ip6t_policy.c +++ b/net/ipv6/netfilter/ip6t_policy.c | |||
@@ -118,7 +118,7 @@ static int match(const struct sk_buff *skb, | |||
118 | return ret; | 118 | return ret; |
119 | } | 119 | } |
120 | 120 | ||
121 | static int checkentry(const char *tablename, const struct ip6t_ip6 *ip, | 121 | static int checkentry(const char *tablename, const void *ip_void, |
122 | void *matchinfo, unsigned int matchsize, | 122 | void *matchinfo, unsigned int matchsize, |
123 | unsigned int hook_mask) | 123 | unsigned int hook_mask) |
124 | { | 124 | { |
diff --git a/net/ipv6/netfilter/ip6t_rt.c b/net/ipv6/netfilter/ip6t_rt.c index 8465b4375855..8f82476dc89e 100644 --- a/net/ipv6/netfilter/ip6t_rt.c +++ b/net/ipv6/netfilter/ip6t_rt.c | |||
@@ -33,12 +33,12 @@ MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>"); | |||
33 | static inline int | 33 | static inline int |
34 | segsleft_match(u_int32_t min, u_int32_t max, u_int32_t id, int invert) | 34 | segsleft_match(u_int32_t min, u_int32_t max, u_int32_t id, int invert) |
35 | { | 35 | { |
36 | int r=0; | 36 | int r = 0; |
37 | DEBUGP("rt segsleft_match:%c 0x%x <= 0x%x <= 0x%x",invert? '!':' ', | 37 | DEBUGP("rt segsleft_match:%c 0x%x <= 0x%x <= 0x%x", |
38 | min,id,max); | 38 | invert ? '!' : ' ', min, id, max); |
39 | r=(id >= min && id <= max) ^ invert; | 39 | r = (id >= min && id <= max) ^ invert; |
40 | DEBUGP(" result %s\n",r? "PASS" : "FAILED"); | 40 | DEBUGP(" result %s\n", r ? "PASS" : "FAILED"); |
41 | return r; | 41 | return r; |
42 | } | 42 | } |
43 | 43 | ||
44 | static int | 44 | static int |
@@ -50,87 +50,93 @@ match(const struct sk_buff *skb, | |||
50 | unsigned int protoff, | 50 | unsigned int protoff, |
51 | int *hotdrop) | 51 | int *hotdrop) |
52 | { | 52 | { |
53 | struct ipv6_rt_hdr _route, *rh; | 53 | struct ipv6_rt_hdr _route, *rh; |
54 | const struct ip6t_rt *rtinfo = matchinfo; | 54 | const struct ip6t_rt *rtinfo = matchinfo; |
55 | unsigned int temp; | 55 | unsigned int temp; |
56 | unsigned int ptr; | 56 | unsigned int ptr; |
57 | unsigned int hdrlen = 0; | 57 | unsigned int hdrlen = 0; |
58 | unsigned int ret = 0; | 58 | unsigned int ret = 0; |
59 | struct in6_addr *ap, _addr; | 59 | struct in6_addr *ap, _addr; |
60 | 60 | ||
61 | if (ipv6_find_hdr(skb, &ptr, NEXTHDR_ROUTING, NULL) < 0) | 61 | if (ipv6_find_hdr(skb, &ptr, NEXTHDR_ROUTING, NULL) < 0) |
62 | return 0; | 62 | return 0; |
63 | 63 | ||
64 | rh = skb_header_pointer(skb, ptr, sizeof(_route), &_route); | 64 | rh = skb_header_pointer(skb, ptr, sizeof(_route), &_route); |
65 | if (rh == NULL){ | 65 | if (rh == NULL) { |
66 | *hotdrop = 1; | 66 | *hotdrop = 1; |
67 | return 0; | 67 | return 0; |
68 | } | 68 | } |
69 | 69 | ||
70 | hdrlen = ipv6_optlen(rh); | 70 | hdrlen = ipv6_optlen(rh); |
71 | if (skb->len - ptr < hdrlen){ | 71 | if (skb->len - ptr < hdrlen) { |
72 | /* Pcket smaller than its length field */ | 72 | /* Pcket smaller than its length field */ |
73 | return 0; | 73 | return 0; |
74 | } | 74 | } |
75 | 75 | ||
76 | DEBUGP("IPv6 RT LEN %u %u ", hdrlen, rh->hdrlen); | 76 | DEBUGP("IPv6 RT LEN %u %u ", hdrlen, rh->hdrlen); |
77 | DEBUGP("TYPE %04X ", rh->type); | 77 | DEBUGP("TYPE %04X ", rh->type); |
78 | DEBUGP("SGS_LEFT %u %02X\n", rh->segments_left, rh->segments_left); | 78 | DEBUGP("SGS_LEFT %u %02X\n", rh->segments_left, rh->segments_left); |
79 | 79 | ||
80 | DEBUGP("IPv6 RT segsleft %02X ", | 80 | DEBUGP("IPv6 RT segsleft %02X ", |
81 | (segsleft_match(rtinfo->segsleft[0], rtinfo->segsleft[1], | 81 | (segsleft_match(rtinfo->segsleft[0], rtinfo->segsleft[1], |
82 | rh->segments_left, | 82 | rh->segments_left, |
83 | !!(rtinfo->invflags & IP6T_RT_INV_SGS)))); | 83 | !!(rtinfo->invflags & IP6T_RT_INV_SGS)))); |
84 | DEBUGP("type %02X %02X %02X ", | 84 | DEBUGP("type %02X %02X %02X ", |
85 | rtinfo->rt_type, rh->type, | 85 | rtinfo->rt_type, rh->type, |
86 | (!(rtinfo->flags & IP6T_RT_TYP) || | 86 | (!(rtinfo->flags & IP6T_RT_TYP) || |
87 | ((rtinfo->rt_type == rh->type) ^ | 87 | ((rtinfo->rt_type == rh->type) ^ |
88 | !!(rtinfo->invflags & IP6T_RT_INV_TYP)))); | 88 | !!(rtinfo->invflags & IP6T_RT_INV_TYP)))); |
89 | DEBUGP("len %02X %04X %02X ", | 89 | DEBUGP("len %02X %04X %02X ", |
90 | rtinfo->hdrlen, hdrlen, | 90 | rtinfo->hdrlen, hdrlen, |
91 | (!(rtinfo->flags & IP6T_RT_LEN) || | 91 | (!(rtinfo->flags & IP6T_RT_LEN) || |
92 | ((rtinfo->hdrlen == hdrlen) ^ | 92 | ((rtinfo->hdrlen == hdrlen) ^ |
93 | !!(rtinfo->invflags & IP6T_RT_INV_LEN)))); | 93 | !!(rtinfo->invflags & IP6T_RT_INV_LEN)))); |
94 | DEBUGP("res %02X %02X %02X ", | 94 | DEBUGP("res %02X %02X %02X ", |
95 | (rtinfo->flags & IP6T_RT_RES), ((struct rt0_hdr *)rh)->reserved, | 95 | (rtinfo->flags & IP6T_RT_RES), |
96 | !((rtinfo->flags & IP6T_RT_RES) && (((struct rt0_hdr *)rh)->reserved))); | 96 | ((struct rt0_hdr *)rh)->reserved, |
97 | 97 | !((rtinfo->flags & IP6T_RT_RES) && | |
98 | ret = (rh != NULL) | 98 | (((struct rt0_hdr *)rh)->reserved))); |
99 | && | 99 | |
100 | (segsleft_match(rtinfo->segsleft[0], rtinfo->segsleft[1], | 100 | ret = (rh != NULL) |
101 | rh->segments_left, | 101 | && |
102 | !!(rtinfo->invflags & IP6T_RT_INV_SGS))) | 102 | (segsleft_match(rtinfo->segsleft[0], rtinfo->segsleft[1], |
103 | && | 103 | rh->segments_left, |
104 | (!(rtinfo->flags & IP6T_RT_LEN) || | 104 | !!(rtinfo->invflags & IP6T_RT_INV_SGS))) |
105 | ((rtinfo->hdrlen == hdrlen) ^ | 105 | && |
106 | !!(rtinfo->invflags & IP6T_RT_INV_LEN))) | 106 | (!(rtinfo->flags & IP6T_RT_LEN) || |
107 | && | 107 | ((rtinfo->hdrlen == hdrlen) ^ |
108 | (!(rtinfo->flags & IP6T_RT_TYP) || | 108 | !!(rtinfo->invflags & IP6T_RT_INV_LEN))) |
109 | ((rtinfo->rt_type == rh->type) ^ | 109 | && |
110 | !!(rtinfo->invflags & IP6T_RT_INV_TYP))); | 110 | (!(rtinfo->flags & IP6T_RT_TYP) || |
111 | ((rtinfo->rt_type == rh->type) ^ | ||
112 | !!(rtinfo->invflags & IP6T_RT_INV_TYP))); | ||
111 | 113 | ||
112 | if (ret && (rtinfo->flags & IP6T_RT_RES)) { | 114 | if (ret && (rtinfo->flags & IP6T_RT_RES)) { |
113 | u_int32_t *rp, _reserved; | 115 | u_int32_t *rp, _reserved; |
114 | rp = skb_header_pointer(skb, | 116 | rp = skb_header_pointer(skb, |
115 | ptr + offsetof(struct rt0_hdr, reserved), | 117 | ptr + offsetof(struct rt0_hdr, |
116 | sizeof(_reserved), &_reserved); | 118 | reserved), |
119 | sizeof(_reserved), | ||
120 | &_reserved); | ||
117 | 121 | ||
118 | ret = (*rp == 0); | 122 | ret = (*rp == 0); |
119 | } | 123 | } |
120 | 124 | ||
121 | DEBUGP("#%d ",rtinfo->addrnr); | 125 | DEBUGP("#%d ", rtinfo->addrnr); |
122 | if ( !(rtinfo->flags & IP6T_RT_FST) ){ | 126 | if (!(rtinfo->flags & IP6T_RT_FST)) { |
123 | return ret; | 127 | return ret; |
124 | } else if (rtinfo->flags & IP6T_RT_FST_NSTRICT) { | 128 | } else if (rtinfo->flags & IP6T_RT_FST_NSTRICT) { |
125 | DEBUGP("Not strict "); | 129 | DEBUGP("Not strict "); |
126 | if ( rtinfo->addrnr > (unsigned int)((hdrlen-8)/16) ){ | 130 | if (rtinfo->addrnr > (unsigned int)((hdrlen - 8) / 16)) { |
127 | DEBUGP("There isn't enough space\n"); | 131 | DEBUGP("There isn't enough space\n"); |
128 | return 0; | 132 | return 0; |
129 | } else { | 133 | } else { |
130 | unsigned int i = 0; | 134 | unsigned int i = 0; |
131 | 135 | ||
132 | DEBUGP("#%d ",rtinfo->addrnr); | 136 | DEBUGP("#%d ", rtinfo->addrnr); |
133 | for(temp=0; temp<(unsigned int)((hdrlen-8)/16); temp++){ | 137 | for (temp = 0; |
138 | temp < (unsigned int)((hdrlen - 8) / 16); | ||
139 | temp++) { | ||
134 | ap = skb_header_pointer(skb, | 140 | ap = skb_header_pointer(skb, |
135 | ptr | 141 | ptr |
136 | + sizeof(struct rt0_hdr) | 142 | + sizeof(struct rt0_hdr) |
@@ -141,24 +147,26 @@ match(const struct sk_buff *skb, | |||
141 | BUG_ON(ap == NULL); | 147 | BUG_ON(ap == NULL); |
142 | 148 | ||
143 | if (ipv6_addr_equal(ap, &rtinfo->addrs[i])) { | 149 | if (ipv6_addr_equal(ap, &rtinfo->addrs[i])) { |
144 | DEBUGP("i=%d temp=%d;\n",i,temp); | 150 | DEBUGP("i=%d temp=%d;\n", i, temp); |
145 | i++; | 151 | i++; |
146 | } | 152 | } |
147 | if (i==rtinfo->addrnr) break; | 153 | if (i == rtinfo->addrnr) |
154 | break; | ||
148 | } | 155 | } |
149 | DEBUGP("i=%d #%d\n", i, rtinfo->addrnr); | 156 | DEBUGP("i=%d #%d\n", i, rtinfo->addrnr); |
150 | if (i == rtinfo->addrnr) | 157 | if (i == rtinfo->addrnr) |
151 | return ret; | 158 | return ret; |
152 | else return 0; | 159 | else |
160 | return 0; | ||
153 | } | 161 | } |
154 | } else { | 162 | } else { |
155 | DEBUGP("Strict "); | 163 | DEBUGP("Strict "); |
156 | if ( rtinfo->addrnr > (unsigned int)((hdrlen-8)/16) ){ | 164 | if (rtinfo->addrnr > (unsigned int)((hdrlen - 8) / 16)) { |
157 | DEBUGP("There isn't enough space\n"); | 165 | DEBUGP("There isn't enough space\n"); |
158 | return 0; | 166 | return 0; |
159 | } else { | 167 | } else { |
160 | DEBUGP("#%d ",rtinfo->addrnr); | 168 | DEBUGP("#%d ", rtinfo->addrnr); |
161 | for(temp=0; temp<rtinfo->addrnr; temp++){ | 169 | for (temp = 0; temp < rtinfo->addrnr; temp++) { |
162 | ap = skb_header_pointer(skb, | 170 | ap = skb_header_pointer(skb, |
163 | ptr | 171 | ptr |
164 | + sizeof(struct rt0_hdr) | 172 | + sizeof(struct rt0_hdr) |
@@ -171,9 +179,11 @@ match(const struct sk_buff *skb, | |||
171 | break; | 179 | break; |
172 | } | 180 | } |
173 | DEBUGP("temp=%d #%d\n", temp, rtinfo->addrnr); | 181 | DEBUGP("temp=%d #%d\n", temp, rtinfo->addrnr); |
174 | if ((temp == rtinfo->addrnr) && (temp == (unsigned int)((hdrlen-8)/16))) | 182 | if ((temp == rtinfo->addrnr) && |
183 | (temp == (unsigned int)((hdrlen - 8) / 16))) | ||
175 | return ret; | 184 | return ret; |
176 | else return 0; | 185 | else |
186 | return 0; | ||
177 | } | 187 | } |
178 | } | 188 | } |
179 | 189 | ||
@@ -183,32 +193,31 @@ match(const struct sk_buff *skb, | |||
183 | /* Called when user tries to insert an entry of this type. */ | 193 | /* Called when user tries to insert an entry of this type. */ |
184 | static int | 194 | static int |
185 | checkentry(const char *tablename, | 195 | checkentry(const char *tablename, |
186 | const void *entry, | 196 | const void *entry, |
187 | void *matchinfo, | 197 | void *matchinfo, |
188 | unsigned int matchinfosize, | 198 | unsigned int matchinfosize, |
189 | unsigned int hook_mask) | 199 | unsigned int hook_mask) |
190 | { | 200 | { |
191 | const struct ip6t_rt *rtinfo = matchinfo; | 201 | const struct ip6t_rt *rtinfo = matchinfo; |
192 | 202 | ||
193 | if (matchinfosize != IP6T_ALIGN(sizeof(struct ip6t_rt))) { | 203 | if (matchinfosize != IP6T_ALIGN(sizeof(struct ip6t_rt))) { |
194 | DEBUGP("ip6t_rt: matchsize %u != %u\n", | 204 | DEBUGP("ip6t_rt: matchsize %u != %u\n", |
195 | matchinfosize, IP6T_ALIGN(sizeof(struct ip6t_rt))); | 205 | matchinfosize, IP6T_ALIGN(sizeof(struct ip6t_rt))); |
196 | return 0; | 206 | return 0; |
197 | } | 207 | } |
198 | if (rtinfo->invflags & ~IP6T_RT_INV_MASK) { | 208 | if (rtinfo->invflags & ~IP6T_RT_INV_MASK) { |
199 | DEBUGP("ip6t_rt: unknown flags %X\n", | 209 | DEBUGP("ip6t_rt: unknown flags %X\n", rtinfo->invflags); |
200 | rtinfo->invflags); | 210 | return 0; |
201 | return 0; | 211 | } |
202 | } | 212 | if ((rtinfo->flags & (IP6T_RT_RES | IP6T_RT_FST_MASK)) && |
203 | if ( (rtinfo->flags & (IP6T_RT_RES|IP6T_RT_FST_MASK)) && | 213 | (!(rtinfo->flags & IP6T_RT_TYP) || |
204 | (!(rtinfo->flags & IP6T_RT_TYP) || | 214 | (rtinfo->rt_type != 0) || |
205 | (rtinfo->rt_type != 0) || | 215 | (rtinfo->invflags & IP6T_RT_INV_TYP))) { |
206 | (rtinfo->invflags & IP6T_RT_INV_TYP)) ) { | 216 | DEBUGP("`--rt-type 0' required before `--rt-0-*'"); |
207 | DEBUGP("`--rt-type 0' required before `--rt-0-*'"); | 217 | return 0; |
208 | return 0; | 218 | } |
209 | } | 219 | |
210 | 220 | return 1; | |
211 | return 1; | ||
212 | } | 221 | } |
213 | 222 | ||
214 | static struct ip6t_match rt_match = { | 223 | static struct ip6t_match rt_match = { |
@@ -220,12 +229,12 @@ static struct ip6t_match rt_match = { | |||
220 | 229 | ||
221 | static int __init init(void) | 230 | static int __init init(void) |
222 | { | 231 | { |
223 | return ip6t_register_match(&rt_match); | 232 | return ip6t_register_match(&rt_match); |
224 | } | 233 | } |
225 | 234 | ||
226 | static void __exit cleanup(void) | 235 | static void __exit cleanup(void) |
227 | { | 236 | { |
228 | ip6t_unregister_match(&rt_match); | 237 | ip6t_unregister_match(&rt_match); |
229 | } | 238 | } |
230 | 239 | ||
231 | module_init(init); | 240 | module_init(init); |
diff --git a/net/rxrpc/krxtimod.c b/net/rxrpc/krxtimod.c index 3ac81cdd1211..3e7466900bd4 100644 --- a/net/rxrpc/krxtimod.c +++ b/net/rxrpc/krxtimod.c | |||
@@ -81,7 +81,7 @@ static int krxtimod(void *arg) | |||
81 | 81 | ||
82 | for (;;) { | 82 | for (;;) { |
83 | unsigned long jif; | 83 | unsigned long jif; |
84 | signed long timeout; | 84 | long timeout; |
85 | 85 | ||
86 | /* deal with the server being asked to die */ | 86 | /* deal with the server being asked to die */ |
87 | if (krxtimod_die) { | 87 | if (krxtimod_die) { |
diff --git a/net/rxrpc/proc.c b/net/rxrpc/proc.c index 3b5ecd8e2401..29975d99d864 100644 --- a/net/rxrpc/proc.c +++ b/net/rxrpc/proc.c | |||
@@ -361,7 +361,7 @@ static void rxrpc_proc_peers_stop(struct seq_file *p, void *v) | |||
361 | static int rxrpc_proc_peers_show(struct seq_file *m, void *v) | 361 | static int rxrpc_proc_peers_show(struct seq_file *m, void *v) |
362 | { | 362 | { |
363 | struct rxrpc_peer *peer = list_entry(v, struct rxrpc_peer, proc_link); | 363 | struct rxrpc_peer *peer = list_entry(v, struct rxrpc_peer, proc_link); |
364 | signed long timeout; | 364 | long timeout; |
365 | 365 | ||
366 | /* display header on line 1 */ | 366 | /* display header on line 1 */ |
367 | if (v == SEQ_START_TOKEN) { | 367 | if (v == SEQ_START_TOKEN) { |
@@ -373,8 +373,8 @@ static int rxrpc_proc_peers_show(struct seq_file *m, void *v) | |||
373 | /* display one peer per line on subsequent lines */ | 373 | /* display one peer per line on subsequent lines */ |
374 | timeout = 0; | 374 | timeout = 0; |
375 | if (!list_empty(&peer->timeout.link)) | 375 | if (!list_empty(&peer->timeout.link)) |
376 | timeout = (signed long) peer->timeout.timo_jif - | 376 | timeout = (long) peer->timeout.timo_jif - |
377 | (signed long) jiffies; | 377 | (long) jiffies; |
378 | 378 | ||
379 | seq_printf(m, "%5hu %08x %5d %5d %8ld %5Zu %7lu\n", | 379 | seq_printf(m, "%5hu %08x %5d %5d %8ld %5Zu %7lu\n", |
380 | peer->trans->port, | 380 | peer->trans->port, |
@@ -468,7 +468,7 @@ static void rxrpc_proc_conns_stop(struct seq_file *p, void *v) | |||
468 | static int rxrpc_proc_conns_show(struct seq_file *m, void *v) | 468 | static int rxrpc_proc_conns_show(struct seq_file *m, void *v) |
469 | { | 469 | { |
470 | struct rxrpc_connection *conn; | 470 | struct rxrpc_connection *conn; |
471 | signed long timeout; | 471 | long timeout; |
472 | 472 | ||
473 | conn = list_entry(v, struct rxrpc_connection, proc_link); | 473 | conn = list_entry(v, struct rxrpc_connection, proc_link); |
474 | 474 | ||
@@ -484,8 +484,8 @@ static int rxrpc_proc_conns_show(struct seq_file *m, void *v) | |||
484 | /* display one conn per line on subsequent lines */ | 484 | /* display one conn per line on subsequent lines */ |
485 | timeout = 0; | 485 | timeout = 0; |
486 | if (!list_empty(&conn->timeout.link)) | 486 | if (!list_empty(&conn->timeout.link)) |
487 | timeout = (signed long) conn->timeout.timo_jif - | 487 | timeout = (long) conn->timeout.timo_jif - |
488 | (signed long) jiffies; | 488 | (long) jiffies; |
489 | 489 | ||
490 | seq_printf(m, | 490 | seq_printf(m, |
491 | "%5hu %08x %5hu %04hx %08x %-3.3s %08x %08x %5Zu %8ld\n", | 491 | "%5hu %08x %5hu %04hx %08x %-3.3s %08x %08x %5Zu %8ld\n", |
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c index 5b3a3e48ed92..1641db33a994 100644 --- a/net/sched/sch_prio.c +++ b/net/sched/sch_prio.c | |||
@@ -228,14 +228,13 @@ static int prio_tune(struct Qdisc *sch, struct rtattr *opt) | |||
228 | } | 228 | } |
229 | sch_tree_unlock(sch); | 229 | sch_tree_unlock(sch); |
230 | 230 | ||
231 | for (i=0; i<=TC_PRIO_MAX; i++) { | 231 | for (i=0; i<q->bands; i++) { |
232 | int band = q->prio2band[i]; | 232 | if (q->queues[i] == &noop_qdisc) { |
233 | if (q->queues[band] == &noop_qdisc) { | ||
234 | struct Qdisc *child; | 233 | struct Qdisc *child; |
235 | child = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops); | 234 | child = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops); |
236 | if (child) { | 235 | if (child) { |
237 | sch_tree_lock(sch); | 236 | sch_tree_lock(sch); |
238 | child = xchg(&q->queues[band], child); | 237 | child = xchg(&q->queues[i], child); |
239 | 238 | ||
240 | if (child != &noop_qdisc) | 239 | if (child != &noop_qdisc) |
241 | qdisc_destroy(child); | 240 | qdisc_destroy(child); |
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c index 8734bb7280e3..86d8da0cbd02 100644 --- a/net/sched/sch_sfq.c +++ b/net/sched/sch_sfq.c | |||
@@ -144,6 +144,8 @@ static unsigned sfq_hash(struct sfq_sched_data *q, struct sk_buff *skb) | |||
144 | if (!(iph->frag_off&htons(IP_MF|IP_OFFSET)) && | 144 | if (!(iph->frag_off&htons(IP_MF|IP_OFFSET)) && |
145 | (iph->protocol == IPPROTO_TCP || | 145 | (iph->protocol == IPPROTO_TCP || |
146 | iph->protocol == IPPROTO_UDP || | 146 | iph->protocol == IPPROTO_UDP || |
147 | iph->protocol == IPPROTO_SCTP || | ||
148 | iph->protocol == IPPROTO_DCCP || | ||
147 | iph->protocol == IPPROTO_ESP)) | 149 | iph->protocol == IPPROTO_ESP)) |
148 | h2 ^= *(((u32*)iph) + iph->ihl); | 150 | h2 ^= *(((u32*)iph) + iph->ihl); |
149 | break; | 151 | break; |
@@ -155,6 +157,8 @@ static unsigned sfq_hash(struct sfq_sched_data *q, struct sk_buff *skb) | |||
155 | h2 = iph->saddr.s6_addr32[3]^iph->nexthdr; | 157 | h2 = iph->saddr.s6_addr32[3]^iph->nexthdr; |
156 | if (iph->nexthdr == IPPROTO_TCP || | 158 | if (iph->nexthdr == IPPROTO_TCP || |
157 | iph->nexthdr == IPPROTO_UDP || | 159 | iph->nexthdr == IPPROTO_UDP || |
160 | iph->nexthdr == IPPROTO_SCTP || | ||
161 | iph->nexthdr == IPPROTO_DCCP || | ||
158 | iph->nexthdr == IPPROTO_ESP) | 162 | iph->nexthdr == IPPROTO_ESP) |
159 | h2 ^= *(u32*)&iph[1]; | 163 | h2 ^= *(u32*)&iph[1]; |
160 | break; | 164 | break; |