History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

Pull networkign fixes from David Miller: "Networking bug fixes, Cacio e Pepe edition: 1) BNX2X accidently accesses chip rev specific registers without an appropriate guard, fix from Ariel Elior. 2) When we removed the routing cache, we set ip_rt_max_size to ~0 just to keep reporting a value to userspace via sysfs. But the ipv4 IPSEC layer was using this to tune itself which is completely bogus to now do. Fix from Steffen Klassert. 3) Missing initialization in netfilter ipset code from Jozsef Kadlecsik. 4) Check CTA_TIMEOUT_NAME length properly in netfilter cttimeout code, fix from Florian Westphal. 5) After removing the routing cache, we inadvertantly are caching multicast routes that end up looping back locally, we cannot do that legitimately any more. Fix from Julian Anastasov. 6) Revert a race fix for 8139cp qemu/kvm that doesn't actually work properly on real hardware. From Francois Romieu. 7) Fixup errors in example command lines in VXLAN device docs." * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: bnx2x: remove redundant warning log vxlan: fix command usage in its doc 8139cp: revert "set ring address before enabling receiver" ipv4: do not cache looped multicasts netfilter: cttimeout: fix buffer overflow netfilter: ipset: Fix range bug in hash:ip,port,net xfrm: Fix the gc threshold value for ipv4

Linus Torvalds committed 13 years ago

Commit eb5aaed2 parents f3a443a 4a2541711 files · +43 −46Browse files

Unified · Split

11 files
  1. Documentation/networking/vxlan.txt +2 −2
  2. drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +7 −4
  3. drivers/net/ethernet/realtek/8139cp.c +11 −11
  4. include/net/xfrm.h +1 −1
  5. net/ipv4/route.c +6 −3
  6. net/ipv4/xfrm4_policy.c +1 −12
  7. net/netfilter/ipset/ip_set_hash_ip.c +2 −2
  8. net/netfilter/ipset/ip_set_hash_ipport.c +3 −4
  9. net/netfilter/ipset/ip_set_hash_ipportip.c +3 −4
  10. net/netfilter/ipset/ip_set_hash_ipportnet.c +5 −2
  11. net/netfilter/nfnetlink_cttimeout.c +2 −1
Documentation/networking/vxlan.txt+2−2
@@ -32,7 +32,7 @@ no entry is in the forwarding table. · 31 unmodified lines
32 # ip link delete vxlan032 # ip link delete vxlan0
33 33
343. Show vxlan info343. Show vxlan info
35 # ip -d show vxlan035 # ip -d link show vxlan0
36 36
37It is possible to create, destroy and display the vxlan37It is possible to create, destroy and display the vxlan
38forwarding table using the new bridge command.38forwarding table using the new bridge command.
@@ -41,7 +41,7 @@ forwarding table using the new bridge command. · 2 unmodified lines
41 # bridge fdb add to 00:17:42:8a:b4:05 dst 192.19.0.2 dev vxlan041 # bridge fdb add to 00:17:42:8a:b4:05 dst 192.19.0.2 dev vxlan0
42 42
432. Delete forwarding table entry432. Delete forwarding table entry
44 # bridge fdb delete 00:17:42:8a:b4:0544 # bridge fdb delete 00:17:42:8a:b4:05 dev vxlan0
45 45
463. Show forwarding table463. Show forwarding table
47 # bridge fdb show dev vxlan047 # bridge fdb show dev vxlan0
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c+7−4
@@ -9545,10 +9545,13 @@ static int __devinit bnx2x_prev_unload_common(struct bnx2x *bp) · 9544 unmodified lines
9545 */9545 */
9546static void __devinit bnx2x_prev_interrupted_dmae(struct bnx2x *bp)9546static void __devinit bnx2x_prev_interrupted_dmae(struct bnx2x *bp)
9547{9547{
9548 u32 val = REG_RD(bp, PGLUE_B_REG_PGLUE_B_INT_STS);9548 if (!CHIP_IS_E1x(bp)) {
9549 if (val & PGLUE_B_PGLUE_B_INT_STS_REG_WAS_ERROR_ATTN) {9549 u32 val = REG_RD(bp, PGLUE_B_REG_PGLUE_B_INT_STS);
9550 BNX2X_ERR("was error bit was found to be set in pglueb upon startup. Clearing");9550 if (val & PGLUE_B_PGLUE_B_INT_STS_REG_WAS_ERROR_ATTN) {
9551 REG_WR(bp, PGLUE_B_REG_WAS_ERROR_PF_7_0_CLR, 1 << BP_FUNC(bp));9551 BNX2X_ERR("was error bit was found to be set in pglueb upon startup. Clearing");
9552 REG_WR(bp, PGLUE_B_REG_WAS_ERROR_PF_7_0_CLR,
9553 1 << BP_FUNC(bp));
9554 }
9552 }9555 }
9553}9556}
9554 9557
drivers/net/ethernet/realtek/8139cp.c+11−11
@@ -979,17 +979,6 @@ static void cp_init_hw (struct cp_private *cp) · 978 unmodified lines
979 cpw32_f (MAC0 + 0, le32_to_cpu (*(__le32 *) (dev->dev_addr + 0)));979 cpw32_f (MAC0 + 0, le32_to_cpu (*(__le32 *) (dev->dev_addr + 0)));
980 cpw32_f (MAC0 + 4, le32_to_cpu (*(__le32 *) (dev->dev_addr + 4)));980 cpw32_f (MAC0 + 4, le32_to_cpu (*(__le32 *) (dev->dev_addr + 4)));
981 981
982 cpw32_f(HiTxRingAddr, 0);
983 cpw32_f(HiTxRingAddr + 4, 0);
984
985 ring_dma = cp->ring_dma;
986 cpw32_f(RxRingAddr, ring_dma & 0xffffffff);
987 cpw32_f(RxRingAddr + 4, (ring_dma >> 16) >> 16);
988
989 ring_dma += sizeof(struct cp_desc) * CP_RX_RING_SIZE;
990 cpw32_f(TxRingAddr, ring_dma & 0xffffffff);
991 cpw32_f(TxRingAddr + 4, (ring_dma >> 16) >> 16);
992
993 cp_start_hw(cp);982 cp_start_hw(cp);
994 cpw8(TxThresh, 0x06); /* XXX convert magic num to a constant */983 cpw8(TxThresh, 0x06); /* XXX convert magic num to a constant */
995 984
@@ -1003,6 +992,17 @@ static void cp_init_hw (struct cp_private *cp) · 7 unmodified lines
1003 992
1004 cpw8(Config5, cpr8(Config5) & PMEStatus);993 cpw8(Config5, cpr8(Config5) & PMEStatus);
1005 994
995 cpw32_f(HiTxRingAddr, 0);
996 cpw32_f(HiTxRingAddr + 4, 0);
997
998 ring_dma = cp->ring_dma;
999 cpw32_f(RxRingAddr, ring_dma & 0xffffffff);
1000 cpw32_f(RxRingAddr + 4, (ring_dma >> 16) >> 16);
1001
1002 ring_dma += sizeof(struct cp_desc) * CP_RX_RING_SIZE;
1003 cpw32_f(TxRingAddr, ring_dma & 0xffffffff);
1004 cpw32_f(TxRingAddr + 4, (ring_dma >> 16) >> 16);
1005
1006 cpw16(MultiIntr, 0);1006 cpw16(MultiIntr, 0);
1007 1007
1008 cpw8_f(Cfg9346, Cfg9346_Lock);1008 cpw8_f(Cfg9346, Cfg9346_Lock);
include/net/xfrm.h+1−1
@@ -1351,7 +1351,7 @@ struct xfrm6_tunnel { · 1350 unmodified lines
1351};1351};
1352 1352
1353extern void xfrm_init(void);1353extern void xfrm_init(void);
1354extern void xfrm4_init(int rt_hash_size);1354extern void xfrm4_init(void);
1355extern int xfrm_state_init(struct net *net);1355extern int xfrm_state_init(struct net *net);
1356extern void xfrm_state_fini(struct net *net);1356extern void xfrm_state_fini(struct net *net);
1357extern void xfrm4_state_init(void);1357extern void xfrm4_state_init(void);
net/ipv4/route.c+6−3
@@ -1785,6 +1785,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res, · 1784 unmodified lines
1785 if (dev_out->flags & IFF_LOOPBACK)1785 if (dev_out->flags & IFF_LOOPBACK)
1786 flags |= RTCF_LOCAL;1786 flags |= RTCF_LOCAL;
1787 1787
1788 do_cache = true;
1788 if (type == RTN_BROADCAST) {1789 if (type == RTN_BROADCAST) {
1789 flags |= RTCF_BROADCAST | RTCF_LOCAL;1790 flags |= RTCF_BROADCAST | RTCF_LOCAL;
1790 fi = NULL;1791 fi = NULL;
@@ -1793,6 +1794,8 @@ static struct rtable *__mkroute_output(const struct fib_result *res, · 2 unmodified lines
1793 if (!ip_check_mc_rcu(in_dev, fl4->daddr, fl4->saddr,1794 if (!ip_check_mc_rcu(in_dev, fl4->daddr, fl4->saddr,
1794 fl4->flowi4_proto))1795 fl4->flowi4_proto))
1795 flags &= ~RTCF_LOCAL;1796 flags &= ~RTCF_LOCAL;
1797 else
1798 do_cache = false;
1796 /* If multicast route do not exist use1799 /* If multicast route do not exist use
1797 * default one, but do not gateway in this case.1800 * default one, but do not gateway in this case.
1798 * Yes, it is hack.1801 * Yes, it is hack.
@@ -1802,8 +1805,8 @@ static struct rtable *__mkroute_output(const struct fib_result *res, · 3 unmodified lines
1802 }1805 }
1803 1806
1804 fnhe = NULL;1807 fnhe = NULL;
1805 do_cache = fi != NULL;1808 do_cache &= fi != NULL;
1806 if (fi) {1809 if (do_cache) {
1807 struct rtable __rcu **prth;1810 struct rtable __rcu **prth;
1808 struct fib_nh *nh = &FIB_RES_NH(*res);1811 struct fib_nh *nh = &FIB_RES_NH(*res);
1809 1812
@@ -2597,7 +2600,7 @@ int __init ip_rt_init(void) · 787 unmodified lines
2597 pr_err("Unable to create route proc files\n");2600 pr_err("Unable to create route proc files\n");
2598#ifdef CONFIG_XFRM2601#ifdef CONFIG_XFRM
2599 xfrm_init();2602 xfrm_init();
2600 xfrm4_init(ip_rt_max_size);2603 xfrm4_init();
2601#endif2604#endif
2602 rtnl_register(PF_INET, RTM_GETROUTE, inet_rtm_getroute, NULL, NULL);2605 rtnl_register(PF_INET, RTM_GETROUTE, inet_rtm_getroute, NULL, NULL);
2603 2606
net/ipv4/xfrm4_policy.c+1−12
@@ -279,19 +279,8 @@ static void __exit xfrm4_policy_fini(void) · 278 unmodified lines
279 xfrm_policy_unregister_afinfo(&xfrm4_policy_afinfo);279 xfrm_policy_unregister_afinfo(&xfrm4_policy_afinfo);
280}280}
281 281
282void __init xfrm4_init(int rt_max_size)282void __init xfrm4_init(void)
283{283{
284 /*
285 * Select a default value for the gc_thresh based on the main route
286 * table hash size. It seems to me the worst case scenario is when
287 * we have ipsec operating in transport mode, in which we create a
288 * dst_entry per socket. The xfrm gc algorithm starts trying to remove
289 * entries at gc_thresh, and prevents new allocations as 2*gc_thresh
290 * so lets set an initial xfrm gc_thresh value at the rt_max_size/2.
291 * That will let us store an ipsec connection per route table entry,
292 * and start cleaning when were 1/2 full
293 */
294 xfrm4_dst_ops.gc_thresh = rt_max_size/2;
295 dst_entries_init(&xfrm4_dst_ops);284 dst_entries_init(&xfrm4_dst_ops);
296 285
297 xfrm4_state_init();286 xfrm4_state_init();
net/netfilter/ipset/ip_set_hash_ip.c+2−2
@@ -173,6 +173,7 @@ hash_ip4_uadt(struct ip_set *set, struct nlattr *tb[], · 172 unmodified lines
173 return adtfn(set, &nip, timeout, flags);173 return adtfn(set, &nip, timeout, flags);
174 }174 }
175 175
176 ip_to = ip;
176 if (tb[IPSET_ATTR_IP_TO]) {177 if (tb[IPSET_ATTR_IP_TO]) {
177 ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP_TO], &ip_to);178 ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP_TO], &ip_to);
178 if (ret)179 if (ret)
@@ -185,8 +186,7 @@ hash_ip4_uadt(struct ip_set *set, struct nlattr *tb[], · 6 unmodified lines
185 if (!cidr || cidr > 32)186 if (!cidr || cidr > 32)
186 return -IPSET_ERR_INVALID_CIDR;187 return -IPSET_ERR_INVALID_CIDR;
187 ip_set_mask_from_to(ip, ip_to, cidr);188 ip_set_mask_from_to(ip, ip_to, cidr);
188 } else189 }
189 ip_to = ip;
190 190
191 hosts = h->netmask == 32 ? 1 : 2 << (32 - h->netmask - 1);191 hosts = h->netmask == 32 ? 1 : 2 << (32 - h->netmask - 1);
192 192
net/netfilter/ipset/ip_set_hash_ipport.c+3−4
@@ -162,7 +162,7 @@ hash_ipport4_uadt(struct ip_set *set, struct nlattr *tb[], · 161 unmodified lines
162 const struct ip_set_hash *h = set->data;162 const struct ip_set_hash *h = set->data;
163 ipset_adtfn adtfn = set->variant->adt[adt];163 ipset_adtfn adtfn = set->variant->adt[adt];
164 struct hash_ipport4_elem data = { };164 struct hash_ipport4_elem data = { };
165 u32 ip, ip_to = 0, p = 0, port, port_to;165 u32 ip, ip_to, p = 0, port, port_to;
166 u32 timeout = h->timeout;166 u32 timeout = h->timeout;
167 bool with_ports = false;167 bool with_ports = false;
168 int ret;168 int ret;
@@ -210,7 +210,7 @@ hash_ipport4_uadt(struct ip_set *set, struct nlattr *tb[], · 41 unmodified lines
210 return ip_set_eexist(ret, flags) ? 0 : ret;210 return ip_set_eexist(ret, flags) ? 0 : ret;
211 }211 }
212 212
213 ip = ntohl(data.ip);213 ip_to = ip = ntohl(data.ip);
214 if (tb[IPSET_ATTR_IP_TO]) {214 if (tb[IPSET_ATTR_IP_TO]) {
215 ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP_TO], &ip_to);215 ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP_TO], &ip_to);
216 if (ret)216 if (ret)
@@ -223,8 +223,7 @@ hash_ipport4_uadt(struct ip_set *set, struct nlattr *tb[], · 6 unmodified lines
223 if (!cidr || cidr > 32)223 if (!cidr || cidr > 32)
224 return -IPSET_ERR_INVALID_CIDR;224 return -IPSET_ERR_INVALID_CIDR;
225 ip_set_mask_from_to(ip, ip_to, cidr);225 ip_set_mask_from_to(ip, ip_to, cidr);
226 } else226 }
227 ip_to = ip;
228 227
229 port_to = port = ntohs(data.port);228 port_to = port = ntohs(data.port);
230 if (with_ports && tb[IPSET_ATTR_PORT_TO]) {229 if (with_ports && tb[IPSET_ATTR_PORT_TO]) {
net/netfilter/ipset/ip_set_hash_ipportip.c+3−4
@@ -166,7 +166,7 @@ hash_ipportip4_uadt(struct ip_set *set, struct nlattr *tb[], · 165 unmodified lines
166 const struct ip_set_hash *h = set->data;166 const struct ip_set_hash *h = set->data;
167 ipset_adtfn adtfn = set->variant->adt[adt];167 ipset_adtfn adtfn = set->variant->adt[adt];
168 struct hash_ipportip4_elem data = { };168 struct hash_ipportip4_elem data = { };
169 u32 ip, ip_to = 0, p = 0, port, port_to;169 u32 ip, ip_to, p = 0, port, port_to;
170 u32 timeout = h->timeout;170 u32 timeout = h->timeout;
171 bool with_ports = false;171 bool with_ports = false;
172 int ret;172 int ret;
@@ -218,7 +218,7 @@ hash_ipportip4_uadt(struct ip_set *set, struct nlattr *tb[], · 45 unmodified lines
218 return ip_set_eexist(ret, flags) ? 0 : ret;218 return ip_set_eexist(ret, flags) ? 0 : ret;
219 }219 }
220 220
221 ip = ntohl(data.ip);221 ip_to = ip = ntohl(data.ip);
222 if (tb[IPSET_ATTR_IP_TO]) {222 if (tb[IPSET_ATTR_IP_TO]) {
223 ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP_TO], &ip_to);223 ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP_TO], &ip_to);
224 if (ret)224 if (ret)
@@ -231,8 +231,7 @@ hash_ipportip4_uadt(struct ip_set *set, struct nlattr *tb[], · 6 unmodified lines
231 if (!cidr || cidr > 32)231 if (!cidr || cidr > 32)
232 return -IPSET_ERR_INVALID_CIDR;232 return -IPSET_ERR_INVALID_CIDR;
233 ip_set_mask_from_to(ip, ip_to, cidr);233 ip_set_mask_from_to(ip, ip_to, cidr);
234 } else234 }
235 ip_to = ip;
236 235
237 port_to = port = ntohs(data.port);236 port_to = port = ntohs(data.port);
238 if (with_ports && tb[IPSET_ATTR_PORT_TO]) {237 if (with_ports && tb[IPSET_ATTR_PORT_TO]) {
net/netfilter/ipset/ip_set_hash_ipportnet.c+5−2
@@ -215,8 +215,8 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[], · 214 unmodified lines
215 const struct ip_set_hash *h = set->data;215 const struct ip_set_hash *h = set->data;
216 ipset_adtfn adtfn = set->variant->adt[adt];216 ipset_adtfn adtfn = set->variant->adt[adt];
217 struct hash_ipportnet4_elem data = { .cidr = HOST_MASK - 1 };217 struct hash_ipportnet4_elem data = { .cidr = HOST_MASK - 1 };
218 u32 ip, ip_to = 0, p = 0, port, port_to;218 u32 ip, ip_to, p = 0, port, port_to;
219 u32 ip2_from = 0, ip2_to, ip2_last, ip2;219 u32 ip2_from, ip2_to, ip2_last, ip2;
220 u32 timeout = h->timeout;220 u32 timeout = h->timeout;
221 bool with_ports = false;221 bool with_ports = false;
222 u8 cidr;222 u8 cidr;
@@ -286,6 +286,7 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[], · 63 unmodified lines
286 return ip_set_eexist(ret, flags) ? 0 : ret;286 return ip_set_eexist(ret, flags) ? 0 : ret;
287 }287 }
288 288
289 ip_to = ip;
289 if (tb[IPSET_ATTR_IP_TO]) {290 if (tb[IPSET_ATTR_IP_TO]) {
290 ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP_TO], &ip_to);291 ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP_TO], &ip_to);
291 if (ret)292 if (ret)
@@ -306,6 +307,8 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[], · 14 unmodified lines
306 if (port > port_to)307 if (port > port_to)
307 swap(port, port_to);308 swap(port, port_to);
308 }309 }
310
311 ip2_to = ip2_from;
309 if (tb[IPSET_ATTR_IP2_TO]) {312 if (tb[IPSET_ATTR_IP2_TO]) {
310 ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP2_TO], &ip2_to);313 ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP2_TO], &ip2_to);
311 if (ret)314 if (ret)
net/netfilter/nfnetlink_cttimeout.c+2−1
@@ -41,7 +41,8 @@ MODULE_DESCRIPTION("cttimeout: Extended Netfilter Connection Tracking timeout tu · 40 unmodified lines
41static LIST_HEAD(cttimeout_list);41static LIST_HEAD(cttimeout_list);
42 42
43static const struct nla_policy cttimeout_nla_policy[CTA_TIMEOUT_MAX+1] = {43static const struct nla_policy cttimeout_nla_policy[CTA_TIMEOUT_MAX+1] = {
44 [CTA_TIMEOUT_NAME] = { .type = NLA_NUL_STRING },44 [CTA_TIMEOUT_NAME] = { .type = NLA_NUL_STRING,
45 .len = CTNL_TIMEOUT_NAME_MAX - 1},
45 [CTA_TIMEOUT_L3PROTO] = { .type = NLA_U16 },46 [CTA_TIMEOUT_L3PROTO] = { .type = NLA_U16 },
46 [CTA_TIMEOUT_L4PROTO] = { .type = NLA_U8 },47 [CTA_TIMEOUT_L4PROTO] = { .type = NLA_U8 },
47 [CTA_TIMEOUT_DATA] = { .type = NLA_NESTED },48 [CTA_TIMEOUT_DATA] = { .type = NLA_NESTED },