diff options
author | David S. Miller <davem@davemloft.net> | 2015-12-17 22:08:28 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-12-17 22:08:28 -0500 |
commit | b3e0d3d7bab14f2544a3314bec53a23dc7dd2206 (patch) | |
tree | 2bd3c1c1d128e0c362655fa70a6eea02fc856f62 /net/mpls | |
parent | 3268e5cb494d8778a5a67a9fa2b1bdb0243b77ad (diff) | |
parent | 73796d8bf27372e26c2b79881947304c14c2d353 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts:
drivers/net/geneve.c
Here we had an overlapping change, where in 'net' the extraneous stats
bump was being removed whilst in 'net-next' the final argument to
udp_tunnel6_xmit_skb() was being changed.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mpls')
-rw-r--r-- | net/mpls/af_mpls.c | 43 | ||||
-rw-r--r-- | net/mpls/mpls_iptunnel.c | 4 |
2 files changed, 33 insertions, 14 deletions
diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c index 4b3b9b310c3a..b18c5ed42d95 100644 --- a/net/mpls/af_mpls.c +++ b/net/mpls/af_mpls.c | |||
@@ -27,6 +27,8 @@ | |||
27 | */ | 27 | */ |
28 | #define MAX_MP_SELECT_LABELS 4 | 28 | #define MAX_MP_SELECT_LABELS 4 |
29 | 29 | ||
30 | #define MPLS_NEIGH_TABLE_UNSPEC (NEIGH_LINK_TABLE + 1) | ||
31 | |||
30 | static int zero = 0; | 32 | static int zero = 0; |
31 | static int label_limit = (1 << 20) - 1; | 33 | static int label_limit = (1 << 20) - 1; |
32 | 34 | ||
@@ -341,7 +343,13 @@ static int mpls_forward(struct sk_buff *skb, struct net_device *dev, | |||
341 | } | 343 | } |
342 | } | 344 | } |
343 | 345 | ||
344 | err = neigh_xmit(nh->nh_via_table, out_dev, mpls_nh_via(rt, nh), skb); | 346 | /* If via wasn't specified then send out using device address */ |
347 | if (nh->nh_via_table == MPLS_NEIGH_TABLE_UNSPEC) | ||
348 | err = neigh_xmit(NEIGH_LINK_TABLE, out_dev, | ||
349 | out_dev->dev_addr, skb); | ||
350 | else | ||
351 | err = neigh_xmit(nh->nh_via_table, out_dev, | ||
352 | mpls_nh_via(rt, nh), skb); | ||
345 | if (err) | 353 | if (err) |
346 | net_dbg_ratelimited("%s: packet transmission failed: %d\n", | 354 | net_dbg_ratelimited("%s: packet transmission failed: %d\n", |
347 | __func__, err); | 355 | __func__, err); |
@@ -559,6 +567,10 @@ static int mpls_nh_assign_dev(struct net *net, struct mpls_route *rt, | |||
559 | if (!mpls_dev_get(dev)) | 567 | if (!mpls_dev_get(dev)) |
560 | goto errout; | 568 | goto errout; |
561 | 569 | ||
570 | if ((nh->nh_via_table == NEIGH_LINK_TABLE) && | ||
571 | (dev->addr_len != nh->nh_via_alen)) | ||
572 | goto errout; | ||
573 | |||
562 | RCU_INIT_POINTER(nh->nh_dev, dev); | 574 | RCU_INIT_POINTER(nh->nh_dev, dev); |
563 | 575 | ||
564 | if (!(dev->flags & IFF_UP)) { | 576 | if (!(dev->flags & IFF_UP)) { |
@@ -630,10 +642,14 @@ static int mpls_nh_build(struct net *net, struct mpls_route *rt, | |||
630 | goto errout; | 642 | goto errout; |
631 | } | 643 | } |
632 | 644 | ||
633 | err = nla_get_via(via, &nh->nh_via_alen, &nh->nh_via_table, | 645 | if (via) { |
634 | __mpls_nh_via(rt, nh)); | 646 | err = nla_get_via(via, &nh->nh_via_alen, &nh->nh_via_table, |
635 | if (err) | 647 | __mpls_nh_via(rt, nh)); |
636 | goto errout; | 648 | if (err) |
649 | goto errout; | ||
650 | } else { | ||
651 | nh->nh_via_table = MPLS_NEIGH_TABLE_UNSPEC; | ||
652 | } | ||
637 | 653 | ||
638 | err = mpls_nh_assign_dev(net, rt, nh, oif); | 654 | err = mpls_nh_assign_dev(net, rt, nh, oif); |
639 | if (err) | 655 | if (err) |
@@ -715,9 +731,6 @@ static int mpls_nh_build_multi(struct mpls_route_config *cfg, | |||
715 | nla_newdst = nla_find(attrs, attrlen, RTA_NEWDST); | 731 | nla_newdst = nla_find(attrs, attrlen, RTA_NEWDST); |
716 | } | 732 | } |
717 | 733 | ||
718 | if (!nla_via) | ||
719 | goto errout; | ||
720 | |||
721 | err = mpls_nh_build(cfg->rc_nlinfo.nl_net, rt, nh, | 734 | err = mpls_nh_build(cfg->rc_nlinfo.nl_net, rt, nh, |
722 | rtnh->rtnh_ifindex, nla_via, nla_newdst); | 735 | rtnh->rtnh_ifindex, nla_via, nla_newdst); |
723 | if (err) | 736 | if (err) |
@@ -1227,6 +1240,7 @@ static int rtm_to_route_config(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
1227 | 1240 | ||
1228 | cfg->rc_label = LABEL_NOT_SPECIFIED; | 1241 | cfg->rc_label = LABEL_NOT_SPECIFIED; |
1229 | cfg->rc_protocol = rtm->rtm_protocol; | 1242 | cfg->rc_protocol = rtm->rtm_protocol; |
1243 | cfg->rc_via_table = MPLS_NEIGH_TABLE_UNSPEC; | ||
1230 | cfg->rc_nlflags = nlh->nlmsg_flags; | 1244 | cfg->rc_nlflags = nlh->nlmsg_flags; |
1231 | cfg->rc_nlinfo.portid = NETLINK_CB(skb).portid; | 1245 | cfg->rc_nlinfo.portid = NETLINK_CB(skb).portid; |
1232 | cfg->rc_nlinfo.nlh = nlh; | 1246 | cfg->rc_nlinfo.nlh = nlh; |
@@ -1340,7 +1354,8 @@ static int mpls_dump_route(struct sk_buff *skb, u32 portid, u32 seq, int event, | |||
1340 | nla_put_labels(skb, RTA_NEWDST, nh->nh_labels, | 1354 | nla_put_labels(skb, RTA_NEWDST, nh->nh_labels, |
1341 | nh->nh_label)) | 1355 | nh->nh_label)) |
1342 | goto nla_put_failure; | 1356 | goto nla_put_failure; |
1343 | if (nla_put_via(skb, nh->nh_via_table, mpls_nh_via(rt, nh), | 1357 | if (nh->nh_via_table != MPLS_NEIGH_TABLE_UNSPEC && |
1358 | nla_put_via(skb, nh->nh_via_table, mpls_nh_via(rt, nh), | ||
1344 | nh->nh_via_alen)) | 1359 | nh->nh_via_alen)) |
1345 | goto nla_put_failure; | 1360 | goto nla_put_failure; |
1346 | dev = rtnl_dereference(nh->nh_dev); | 1361 | dev = rtnl_dereference(nh->nh_dev); |
@@ -1381,7 +1396,8 @@ static int mpls_dump_route(struct sk_buff *skb, u32 portid, u32 seq, int event, | |||
1381 | nh->nh_labels, | 1396 | nh->nh_labels, |
1382 | nh->nh_label)) | 1397 | nh->nh_label)) |
1383 | goto nla_put_failure; | 1398 | goto nla_put_failure; |
1384 | if (nla_put_via(skb, nh->nh_via_table, | 1399 | if (nh->nh_via_table != MPLS_NEIGH_TABLE_UNSPEC && |
1400 | nla_put_via(skb, nh->nh_via_table, | ||
1385 | mpls_nh_via(rt, nh), | 1401 | mpls_nh_via(rt, nh), |
1386 | nh->nh_via_alen)) | 1402 | nh->nh_via_alen)) |
1387 | goto nla_put_failure; | 1403 | goto nla_put_failure; |
@@ -1448,7 +1464,8 @@ static inline size_t lfib_nlmsg_size(struct mpls_route *rt) | |||
1448 | 1464 | ||
1449 | if (nh->nh_dev) | 1465 | if (nh->nh_dev) |
1450 | payload += nla_total_size(4); /* RTA_OIF */ | 1466 | payload += nla_total_size(4); /* RTA_OIF */ |
1451 | payload += nla_total_size(2 + nh->nh_via_alen); /* RTA_VIA */ | 1467 | if (nh->nh_via_table != MPLS_NEIGH_TABLE_UNSPEC) /* RTA_VIA */ |
1468 | payload += nla_total_size(2 + nh->nh_via_alen); | ||
1452 | if (nh->nh_labels) /* RTA_NEWDST */ | 1469 | if (nh->nh_labels) /* RTA_NEWDST */ |
1453 | payload += nla_total_size(nh->nh_labels * 4); | 1470 | payload += nla_total_size(nh->nh_labels * 4); |
1454 | } else { | 1471 | } else { |
@@ -1457,7 +1474,9 @@ static inline size_t lfib_nlmsg_size(struct mpls_route *rt) | |||
1457 | 1474 | ||
1458 | for_nexthops(rt) { | 1475 | for_nexthops(rt) { |
1459 | nhsize += nla_total_size(sizeof(struct rtnexthop)); | 1476 | nhsize += nla_total_size(sizeof(struct rtnexthop)); |
1460 | nhsize += nla_total_size(2 + nh->nh_via_alen); | 1477 | /* RTA_VIA */ |
1478 | if (nh->nh_via_table != MPLS_NEIGH_TABLE_UNSPEC) | ||
1479 | nhsize += nla_total_size(2 + nh->nh_via_alen); | ||
1461 | if (nh->nh_labels) | 1480 | if (nh->nh_labels) |
1462 | nhsize += nla_total_size(nh->nh_labels * 4); | 1481 | nhsize += nla_total_size(nh->nh_labels * 4); |
1463 | } endfor_nexthops(rt); | 1482 | } endfor_nexthops(rt); |
diff --git a/net/mpls/mpls_iptunnel.c b/net/mpls/mpls_iptunnel.c index cdd01e6416db..fb31aa87de81 100644 --- a/net/mpls/mpls_iptunnel.c +++ b/net/mpls/mpls_iptunnel.c | |||
@@ -54,10 +54,10 @@ static int mpls_output(struct net *net, struct sock *sk, struct sk_buff *skb) | |||
54 | unsigned int ttl; | 54 | unsigned int ttl; |
55 | 55 | ||
56 | /* Obtain the ttl */ | 56 | /* Obtain the ttl */ |
57 | if (skb->protocol == htons(ETH_P_IP)) { | 57 | if (dst->ops->family == AF_INET) { |
58 | ttl = ip_hdr(skb)->ttl; | 58 | ttl = ip_hdr(skb)->ttl; |
59 | rt = (struct rtable *)dst; | 59 | rt = (struct rtable *)dst; |
60 | } else if (skb->protocol == htons(ETH_P_IPV6)) { | 60 | } else if (dst->ops->family == AF_INET6) { |
61 | ttl = ipv6_hdr(skb)->hop_limit; | 61 | ttl = ipv6_hdr(skb)->hop_limit; |
62 | rt6 = (struct rt6_info *)dst; | 62 | rt6 = (struct rt6_info *)dst; |
63 | } else { | 63 | } else { |