Merge branch 'master' into net-next
This commit is contained in:
commit
d54e3ab985
10
bridge/fdb.c
10
bridge/fdb.c
|
|
@ -100,11 +100,6 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
|||
if (filter_index && filter_index != r->ndm_ifindex)
|
||||
return 0;
|
||||
|
||||
if (jw_global) {
|
||||
jsonw_pretty(jw_global, 1);
|
||||
jsonw_start_object(jw_global);
|
||||
}
|
||||
|
||||
parse_rtattr(tb, NDA_MAX, NDA_RTA(r),
|
||||
n->nlmsg_len - NLMSG_LENGTH(sizeof(*r)));
|
||||
|
||||
|
|
@ -114,6 +109,11 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
|||
if (filter_vlan && filter_vlan != vid)
|
||||
return 0;
|
||||
|
||||
if (jw_global) {
|
||||
jsonw_pretty(jw_global, 1);
|
||||
jsonw_start_object(jw_global);
|
||||
}
|
||||
|
||||
if (n->nlmsg_type == RTM_DELNEIGH) {
|
||||
if (jw_global)
|
||||
jsonw_string_field(jw_global, "opCode", "deleted");
|
||||
|
|
|
|||
|
|
@ -83,11 +83,9 @@ struct link_util {
|
|||
struct rtattr *);
|
||||
void (*print_help)(struct link_util *, int, char **,
|
||||
FILE *);
|
||||
bool slave;
|
||||
};
|
||||
|
||||
struct link_util *get_link_kind(const char *kind);
|
||||
struct link_util *get_link_slave_kind(const char *slave_kind);
|
||||
|
||||
void br_dump_bridge_id(const struct ifla_bridge_id *id, char *buf, size_t len);
|
||||
|
||||
|
|
|
|||
|
|
@ -232,6 +232,7 @@ static void print_linktype(FILE *fp, struct rtattr *tb)
|
|||
struct rtattr *linkinfo[IFLA_INFO_MAX+1];
|
||||
struct link_util *lu;
|
||||
struct link_util *slave_lu;
|
||||
char slave[32];
|
||||
char *kind;
|
||||
char *slave_kind;
|
||||
|
||||
|
|
@ -265,8 +266,9 @@ static void print_linktype(FILE *fp, struct rtattr *tb)
|
|||
|
||||
fprintf(fp, "%s", _SL_);
|
||||
fprintf(fp, " %s_slave ", slave_kind);
|
||||
snprintf(slave, sizeof(slave), "%s_slave", slave_kind);
|
||||
|
||||
slave_lu = get_link_slave_kind(slave_kind);
|
||||
slave_lu = get_link_kind(slave);
|
||||
if (slave_lu && slave_lu->print_opt) {
|
||||
struct rtattr *attr[slave_lu->maxattr+1], **data = NULL;
|
||||
|
||||
|
|
@ -1216,7 +1218,7 @@ static int print_selected_addrinfo(struct ifinfomsg *ifi,
|
|||
if (n->nlmsg_type != RTM_NEWADDR)
|
||||
continue;
|
||||
|
||||
if (n->nlmsg_len < NLMSG_LENGTH(sizeof(ifa)))
|
||||
if (n->nlmsg_len < NLMSG_LENGTH(sizeof(*ifa)))
|
||||
return -1;
|
||||
|
||||
if (ifa->ifa_index != ifi->ifi_index ||
|
||||
|
|
|
|||
36
ip/iplink.c
36
ip/iplink.c
|
|
@ -119,15 +119,14 @@ static int on_off(const char *msg, const char *realval)
|
|||
static void *BODY; /* cached dlopen(NULL) handle */
|
||||
static struct link_util *linkutil_list;
|
||||
|
||||
static struct link_util *__get_link_kind(const char *id, bool slave)
|
||||
struct link_util *get_link_kind(const char *id)
|
||||
{
|
||||
void *dlh;
|
||||
char buf[256];
|
||||
struct link_util *l;
|
||||
|
||||
for (l = linkutil_list; l; l = l->next)
|
||||
if (strcmp(l->id, id) == 0 &&
|
||||
l->slave == slave)
|
||||
if (strcmp(l->id, id) == 0)
|
||||
return l;
|
||||
|
||||
snprintf(buf, sizeof(buf), LIBDIR "/ip/link_%s.so", id);
|
||||
|
|
@ -142,10 +141,7 @@ static struct link_util *__get_link_kind(const char *id, bool slave)
|
|||
}
|
||||
}
|
||||
|
||||
if (slave)
|
||||
snprintf(buf, sizeof(buf), "%s_slave_link_util", id);
|
||||
else
|
||||
snprintf(buf, sizeof(buf), "%s_link_util", id);
|
||||
snprintf(buf, sizeof(buf), "%s_link_util", id);
|
||||
l = dlsym(dlh, buf);
|
||||
if (l == NULL)
|
||||
return NULL;
|
||||
|
|
@ -155,16 +151,6 @@ static struct link_util *__get_link_kind(const char *id, bool slave)
|
|||
return l;
|
||||
}
|
||||
|
||||
struct link_util *get_link_kind(const char *id)
|
||||
{
|
||||
return __get_link_kind(id, false);
|
||||
}
|
||||
|
||||
struct link_util *get_link_slave_kind(const char *id)
|
||||
{
|
||||
return __get_link_kind(id, true);
|
||||
}
|
||||
|
||||
static int get_link_mode(const char *mode)
|
||||
{
|
||||
if (strcasecmp(mode, "default") == 0)
|
||||
|
|
@ -872,26 +858,18 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
|
|||
|
||||
if (type) {
|
||||
struct rtattr *linkinfo;
|
||||
char slavebuf[128], *ulinep = strchr(type, '_');
|
||||
char *ulinep = strchr(type, '_');
|
||||
int iflatype;
|
||||
|
||||
linkinfo = addattr_nest(&req.n, sizeof(req), IFLA_LINKINFO);
|
||||
addattr_l(&req.n, sizeof(req), IFLA_INFO_KIND, type,
|
||||
strlen(type));
|
||||
|
||||
if (ulinep && !strcmp(ulinep, "_slave")) {
|
||||
strncpy(slavebuf, type, sizeof(slavebuf));
|
||||
slavebuf[sizeof(slavebuf) - 1] = '\0';
|
||||
ulinep = strchr(slavebuf, '_');
|
||||
/* check in case it was after sizeof(slavebuf) - 1*/
|
||||
if (ulinep)
|
||||
*ulinep = '\0';
|
||||
lu = get_link_slave_kind(slavebuf);
|
||||
lu = get_link_kind(type);
|
||||
if (ulinep && !strcmp(ulinep, "_slave"))
|
||||
iflatype = IFLA_INFO_SLAVE_DATA;
|
||||
} else {
|
||||
lu = get_link_kind(type);
|
||||
else
|
||||
iflatype = IFLA_INFO_DATA;
|
||||
}
|
||||
if (lu && argc) {
|
||||
struct rtattr *data = addattr_nest(&req.n,
|
||||
sizeof(req), iflatype);
|
||||
|
|
|
|||
|
|
@ -130,10 +130,9 @@ static void bond_slave_print_help(struct link_util *lu, int argc, char **argv,
|
|||
}
|
||||
|
||||
struct link_util bond_slave_link_util = {
|
||||
.id = "bond",
|
||||
.id = "bond_slave",
|
||||
.maxattr = IFLA_BOND_SLAVE_MAX,
|
||||
.print_opt = bond_slave_print_opt,
|
||||
.parse_opt = bond_slave_parse_opt,
|
||||
.print_help = bond_slave_print_help,
|
||||
.slave = true,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -293,10 +293,9 @@ static void bridge_slave_print_help(struct link_util *lu, int argc, char **argv,
|
|||
}
|
||||
|
||||
struct link_util bridge_slave_link_util = {
|
||||
.id = "bridge",
|
||||
.id = "bridge_slave",
|
||||
.maxattr = IFLA_BRPORT_MAX,
|
||||
.print_opt = bridge_slave_print_opt,
|
||||
.parse_opt = bridge_slave_parse_opt,
|
||||
.print_help = bridge_slave_print_help,
|
||||
.slave = true,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -91,10 +91,9 @@ struct link_util vrf_link_util = {
|
|||
};
|
||||
|
||||
struct link_util vrf_slave_link_util = {
|
||||
.id = "vrf",
|
||||
.id = "vrf_slave",
|
||||
.maxattr = IFLA_VRF_PORT_MAX,
|
||||
.print_opt = vrf_slave_print_opt,
|
||||
.slave = true,
|
||||
};
|
||||
|
||||
/* returns table id if name is a VRF device */
|
||||
|
|
|
|||
|
|
@ -1265,5 +1265,4 @@ struct link_util macsec_link_util = {
|
|||
.parse_opt = macsec_parse_opt,
|
||||
.print_help = macsec_print_help,
|
||||
.print_opt = macsec_print_opt,
|
||||
.slave = false,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ int ll_remember_index(const struct sockaddr_nl *who,
|
|||
if (n->nlmsg_type != RTM_NEWLINK && n->nlmsg_type != RTM_DELLINK)
|
||||
return 0;
|
||||
|
||||
if (n->nlmsg_len < NLMSG_LENGTH(sizeof(ifi)))
|
||||
if (n->nlmsg_len < NLMSG_LENGTH(sizeof(*ifi)))
|
||||
return -1;
|
||||
|
||||
im = ll_get_by_index(ifi->ifi_index);
|
||||
|
|
|
|||
|
|
@ -1071,7 +1071,7 @@ static int u32_parse_opt(struct filter_util *qu, char *handle,
|
|||
fprintf(stderr, "\"link\" must be a hash table.\n");
|
||||
return -1;
|
||||
}
|
||||
addattr_l(n, MAX_MSG, TCA_U32_LINK, &handle, 4);
|
||||
addattr_l(n, MAX_MSG, TCA_U32_LINK, &linkid, 4);
|
||||
} else if (strcmp(*argv, "ht") == 0) {
|
||||
unsigned int ht;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue