Merge branch 'master' into net-next
This commit is contained in:
commit
a9c990b6d7
|
|
@ -313,10 +313,10 @@ static int ip6_tnl_parm_match(const struct ip6_tnl_parm2 *p1,
|
||||||
{
|
{
|
||||||
return ((!p1->link || p1->link == p2->link) &&
|
return ((!p1->link || p1->link == p2->link) &&
|
||||||
(!p1->name[0] || strcmp(p1->name, p2->name) == 0) &&
|
(!p1->name[0] || strcmp(p1->name, p2->name) == 0) &&
|
||||||
(memcmp(&p1->laddr, &in6addr_any, sizeof(p1->laddr)) == 0 ||
|
(IN6_IS_ADDR_UNSPECIFIED(&p1->laddr) ||
|
||||||
memcmp(&p1->laddr, &p2->laddr, sizeof(p1->laddr)) == 0) &&
|
IN6_ARE_ADDR_EQUAL(&p1->laddr, &p2->laddr)) &&
|
||||||
(memcmp(&p1->raddr, &in6addr_any, sizeof(p1->raddr)) == 0 ||
|
(IN6_IS_ADDR_UNSPECIFIED(&p1->raddr) ||
|
||||||
memcmp(&p1->raddr, &p2->raddr, sizeof(p1->raddr)) == 0) &&
|
IN6_ARE_ADDR_EQUAL(&p1->raddr, &p2->raddr)) &&
|
||||||
(!p1->proto || !p2->proto || p1->proto == p2->proto) &&
|
(!p1->proto || !p2->proto || p1->proto == p2->proto) &&
|
||||||
(!p1->encap_limit || p1->encap_limit == p2->encap_limit) &&
|
(!p1->encap_limit || p1->encap_limit == p2->encap_limit) &&
|
||||||
(!p1->hop_limit || p1->hop_limit == p2->hop_limit) &&
|
(!p1->hop_limit || p1->hop_limit == p2->hop_limit) &&
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ static int geneve_parse_opt(struct link_util *lu, int argc, char **argv,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!daddr && memcmp(&daddr6, &in6addr_any, sizeof(daddr6)) == 0) {
|
if (!daddr && IN6_IS_ADDR_UNSPECIFIED(&daddr6)) {
|
||||||
fprintf(stderr, "geneve: remote link partner not specified\n");
|
fprintf(stderr, "geneve: remote link partner not specified\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -159,7 +159,7 @@ static int geneve_parse_opt(struct link_util *lu, int argc, char **argv,
|
||||||
addattr32(n, 1024, IFLA_GENEVE_ID, vni);
|
addattr32(n, 1024, IFLA_GENEVE_ID, vni);
|
||||||
if (daddr)
|
if (daddr)
|
||||||
addattr_l(n, 1024, IFLA_GENEVE_REMOTE, &daddr, 4);
|
addattr_l(n, 1024, IFLA_GENEVE_REMOTE, &daddr, 4);
|
||||||
if (memcmp(&daddr6, &in6addr_any, sizeof(daddr6)) != 0)
|
if (!IN6_IS_ADDR_UNSPECIFIED(&daddr6))
|
||||||
addattr_l(n, 1024, IFLA_GENEVE_REMOTE6, &daddr6, sizeof(struct in6_addr));
|
addattr_l(n, 1024, IFLA_GENEVE_REMOTE6, &daddr6, sizeof(struct in6_addr));
|
||||||
addattr32(n, 1024, IFLA_GENEVE_LABEL, label);
|
addattr32(n, 1024, IFLA_GENEVE_LABEL, label);
|
||||||
addattr8(n, 1024, IFLA_GENEVE_TTL, ttl);
|
addattr8(n, 1024, IFLA_GENEVE_TTL, ttl);
|
||||||
|
|
@ -203,7 +203,7 @@ static void geneve_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
||||||
struct in6_addr addr;
|
struct in6_addr addr;
|
||||||
|
|
||||||
memcpy(&addr, RTA_DATA(tb[IFLA_GENEVE_REMOTE6]), sizeof(struct in6_addr));
|
memcpy(&addr, RTA_DATA(tb[IFLA_GENEVE_REMOTE6]), sizeof(struct in6_addr));
|
||||||
if (memcmp(&addr, &in6addr_any, sizeof(addr)) != 0) {
|
if (!IN6_IS_ADDR_UNSPECIFIED(&addr)) {
|
||||||
if (!IN6_IS_ADDR_MULTICAST(&addr))
|
if (!IN6_IS_ADDR_MULTICAST(&addr))
|
||||||
fprintf(f, "remote %s ",
|
fprintf(f, "remote %s ",
|
||||||
format_host(AF_INET6, sizeof(struct in6_addr), &addr));
|
format_host(AF_INET6, sizeof(struct in6_addr), &addr));
|
||||||
|
|
|
||||||
|
|
@ -260,8 +260,8 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((gaddr && daddr) ||
|
if ((gaddr && daddr) ||
|
||||||
(memcmp(&gaddr6, &in6addr_any, sizeof(gaddr6)) &&
|
(!IN6_IS_ADDR_UNSPECIFIED(&gaddr6) &&
|
||||||
memcmp(&daddr6, &in6addr_any, sizeof(daddr6)))) {
|
!IN6_IS_ADDR_UNSPECIFIED(&daddr6))) {
|
||||||
fprintf(stderr, "vxlan: both group and remote cannot be specified\n");
|
fprintf(stderr, "vxlan: both group and remote cannot be specified\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -286,14 +286,14 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
|
||||||
addattr_l(n, 1024, IFLA_VXLAN_GROUP, &gaddr, 4);
|
addattr_l(n, 1024, IFLA_VXLAN_GROUP, &gaddr, 4);
|
||||||
else if (daddr)
|
else if (daddr)
|
||||||
addattr_l(n, 1024, IFLA_VXLAN_GROUP, &daddr, 4);
|
addattr_l(n, 1024, IFLA_VXLAN_GROUP, &daddr, 4);
|
||||||
if (memcmp(&gaddr6, &in6addr_any, sizeof(gaddr6)) != 0)
|
if (!IN6_IS_ADDR_UNSPECIFIED(&gaddr6))
|
||||||
addattr_l(n, 1024, IFLA_VXLAN_GROUP6, &gaddr6, sizeof(struct in6_addr));
|
addattr_l(n, 1024, IFLA_VXLAN_GROUP6, &gaddr6, sizeof(struct in6_addr));
|
||||||
else if (memcmp(&daddr6, &in6addr_any, sizeof(daddr6)) != 0)
|
else if (!IN6_IS_ADDR_UNSPECIFIED(&daddr6))
|
||||||
addattr_l(n, 1024, IFLA_VXLAN_GROUP6, &daddr6, sizeof(struct in6_addr));
|
addattr_l(n, 1024, IFLA_VXLAN_GROUP6, &daddr6, sizeof(struct in6_addr));
|
||||||
|
|
||||||
if (saddr)
|
if (saddr)
|
||||||
addattr_l(n, 1024, IFLA_VXLAN_LOCAL, &saddr, 4);
|
addattr_l(n, 1024, IFLA_VXLAN_LOCAL, &saddr, 4);
|
||||||
else if (memcmp(&saddr6, &in6addr_any, sizeof(saddr6)) != 0)
|
else if (!IN6_IS_ADDR_UNSPECIFIED(&saddr6))
|
||||||
addattr_l(n, 1024, IFLA_VXLAN_LOCAL6, &saddr6, sizeof(struct in6_addr));
|
addattr_l(n, 1024, IFLA_VXLAN_LOCAL6, &saddr6, sizeof(struct in6_addr));
|
||||||
|
|
||||||
if (link)
|
if (link)
|
||||||
|
|
@ -370,7 +370,7 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
||||||
struct in6_addr addr;
|
struct in6_addr addr;
|
||||||
|
|
||||||
memcpy(&addr, RTA_DATA(tb[IFLA_VXLAN_GROUP6]), sizeof(struct in6_addr));
|
memcpy(&addr, RTA_DATA(tb[IFLA_VXLAN_GROUP6]), sizeof(struct in6_addr));
|
||||||
if (memcmp(&addr, &in6addr_any, sizeof(addr)) != 0) {
|
if (!IN6_IS_ADDR_UNSPECIFIED(&addr)) {
|
||||||
if (IN6_IS_ADDR_MULTICAST(&addr))
|
if (IN6_IS_ADDR_MULTICAST(&addr))
|
||||||
fprintf(f, "group %s ",
|
fprintf(f, "group %s ",
|
||||||
format_host(AF_INET6, sizeof(struct in6_addr), &addr));
|
format_host(AF_INET6, sizeof(struct in6_addr), &addr));
|
||||||
|
|
@ -390,7 +390,7 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
||||||
struct in6_addr addr;
|
struct in6_addr addr;
|
||||||
|
|
||||||
memcpy(&addr, RTA_DATA(tb[IFLA_VXLAN_LOCAL6]), sizeof(struct in6_addr));
|
memcpy(&addr, RTA_DATA(tb[IFLA_VXLAN_LOCAL6]), sizeof(struct in6_addr));
|
||||||
if (memcmp(&addr, &in6addr_any, sizeof(addr)) != 0)
|
if (!IN6_IS_ADDR_UNSPECIFIED(&addr))
|
||||||
fprintf(f, "local %s ",
|
fprintf(f, "local %s ",
|
||||||
format_host(AF_INET6, sizeof(struct in6_addr), &addr));
|
format_host(AF_INET6, sizeof(struct in6_addr), &addr));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,8 +72,8 @@ static int ipnetns_have_nsid(void)
|
||||||
if (have_rtnl_getnsid < 0) {
|
if (have_rtnl_getnsid < 0) {
|
||||||
fd = open("/proc/self/ns/net", O_RDONLY);
|
fd = open("/proc/self/ns/net", O_RDONLY);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
perror("open(\"/proc/self/ns/net\")");
|
have_rtnl_getnsid = 0;
|
||||||
exit(1);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
addattr32(&req.n, 1024, NETNSA_FD, fd);
|
addattr32(&req.n, 1024, NETNSA_FD, fd);
|
||||||
|
|
|
||||||
10
ip/iproute.c
10
ip/iproute.c
|
|
@ -1862,6 +1862,11 @@ static int iproute_restore(void)
|
||||||
exit(-1);
|
exit(-1);
|
||||||
|
|
||||||
pos = ftell(stdin);
|
pos = ftell(stdin);
|
||||||
|
if (pos == -1) {
|
||||||
|
perror("Failed to restore: ftell");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
for (prio = 0; prio < 3; prio++) {
|
for (prio = 0; prio < 3; prio++) {
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
|
@ -1869,7 +1874,10 @@ static int iproute_restore(void)
|
||||||
if (err)
|
if (err)
|
||||||
exit(err);
|
exit(err);
|
||||||
|
|
||||||
fseek(stdin, pos, SEEK_SET);
|
if (fseek(stdin, pos, SEEK_SET) == -1) {
|
||||||
|
perror("Failed to restore: fseek");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue