Merge branch 'main' into next
Signed-off-by: David Ahern <dsahern@kernel.org>
This commit is contained in:
commit
e1e089d1f2
|
|
@ -917,7 +917,13 @@ static int strtobool(const char *str, bool *p_val)
|
|||
|
||||
static int __dl_argv_handle(char *str, char **p_bus_name, char **p_dev_name)
|
||||
{
|
||||
str_split_by_char(str, p_bus_name, p_dev_name, '/');
|
||||
int err;
|
||||
|
||||
err = str_split_by_char(str, p_bus_name, p_dev_name, '/');
|
||||
if (err) {
|
||||
pr_err("Devlink identification (\"bus_name/dev_name\") \"%s\" is invalid\n", str);
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ extern int do_command4(int argc, char *argv[], char **table,
|
|||
struct xtc_handle **handle, bool restore);
|
||||
extern int delete_chain4(const xt_chainlabel chain, int verbose,
|
||||
struct xtc_handle *handle);
|
||||
extern int flush_entries4(const xt_chainlabel chain, int verbose,
|
||||
extern int flush_entries4(const xt_chainlabel chain, int verbose,
|
||||
struct xtc_handle *handle);
|
||||
extern int for_each_chain4(int (*fn)(const xt_chainlabel, int, struct xtc_handle *),
|
||||
int verbose, int builtinstoo, struct xtc_handle *handle);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
|
||||
/*
|
||||
* vdpa device management interface
|
||||
* Copyright (c) 2020 Mellanox Technologies Ltd. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_VDPA_H_
|
||||
#define _LINUX_VDPA_H_
|
||||
|
||||
#define VDPA_GENL_NAME "vdpa"
|
||||
#define VDPA_GENL_VERSION 0x1
|
||||
|
||||
enum vdpa_command {
|
||||
VDPA_CMD_UNSPEC,
|
||||
VDPA_CMD_MGMTDEV_NEW,
|
||||
VDPA_CMD_MGMTDEV_GET, /* can dump */
|
||||
VDPA_CMD_DEV_NEW,
|
||||
VDPA_CMD_DEV_DEL,
|
||||
VDPA_CMD_DEV_GET, /* can dump */
|
||||
};
|
||||
|
||||
enum vdpa_attr {
|
||||
VDPA_ATTR_UNSPEC,
|
||||
|
||||
/* bus name (optional) + dev name together make the parent device handle */
|
||||
VDPA_ATTR_MGMTDEV_BUS_NAME, /* string */
|
||||
VDPA_ATTR_MGMTDEV_DEV_NAME, /* string */
|
||||
VDPA_ATTR_MGMTDEV_SUPPORTED_CLASSES, /* u64 */
|
||||
|
||||
VDPA_ATTR_DEV_NAME, /* string */
|
||||
VDPA_ATTR_DEV_ID, /* u32 */
|
||||
VDPA_ATTR_DEV_VENDOR_ID, /* u32 */
|
||||
VDPA_ATTR_DEV_MAX_VQS, /* u32 */
|
||||
VDPA_ATTR_DEV_MAX_VQ_SIZE, /* u16 */
|
||||
|
||||
/* new attributes must be added above here */
|
||||
VDPA_ATTR_MAX,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
#ifndef _LINUX_VIRTIO_IDS_H
|
||||
#define _LINUX_VIRTIO_IDS_H
|
||||
/*
|
||||
* Virtio IDs
|
||||
*
|
||||
* This header is BSD licensed so anyone can use the definitions to implement
|
||||
* compatible drivers/servers.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of IBM nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE. */
|
||||
|
||||
#define VIRTIO_ID_NET 1 /* virtio net */
|
||||
#define VIRTIO_ID_BLOCK 2 /* virtio block */
|
||||
#define VIRTIO_ID_CONSOLE 3 /* virtio console */
|
||||
#define VIRTIO_ID_RNG 4 /* virtio rng */
|
||||
#define VIRTIO_ID_BALLOON 5 /* virtio balloon */
|
||||
#define VIRTIO_ID_IOMEM 6 /* virtio ioMemory */
|
||||
#define VIRTIO_ID_RPMSG 7 /* virtio remote processor messaging */
|
||||
#define VIRTIO_ID_SCSI 8 /* virtio scsi */
|
||||
#define VIRTIO_ID_9P 9 /* 9p virtio console */
|
||||
#define VIRTIO_ID_MAC80211_WLAN 10 /* virtio WLAN MAC */
|
||||
#define VIRTIO_ID_RPROC_SERIAL 11 /* virtio remoteproc serial link */
|
||||
#define VIRTIO_ID_CAIF 12 /* Virtio caif */
|
||||
#define VIRTIO_ID_MEMORY_BALLOON 13 /* virtio memory balloon */
|
||||
#define VIRTIO_ID_GPU 16 /* virtio GPU */
|
||||
#define VIRTIO_ID_CLOCK 17 /* virtio clock/timer */
|
||||
#define VIRTIO_ID_INPUT 18 /* virtio input */
|
||||
#define VIRTIO_ID_VSOCK 19 /* virtio vsock transport */
|
||||
#define VIRTIO_ID_CRYPTO 20 /* virtio crypto */
|
||||
#define VIRTIO_ID_SIGNAL_DIST 21 /* virtio signal distribution device */
|
||||
#define VIRTIO_ID_PSTORE 22 /* virtio pstore device */
|
||||
#define VIRTIO_ID_IOMMU 23 /* virtio IOMMU */
|
||||
#define VIRTIO_ID_MEM 24 /* virtio mem */
|
||||
#define VIRTIO_ID_FS 26 /* virtio filesystem */
|
||||
#define VIRTIO_ID_PMEM 27 /* virtio pmem */
|
||||
#define VIRTIO_ID_MAC80211_HWSIM 29 /* virtio mac80211-hwsim */
|
||||
|
||||
#endif /* _LINUX_VIRTIO_IDS_H */
|
||||
|
|
@ -1 +1 @@
|
|||
static const char version[] = "5.11.0";
|
||||
static const char version[] = "5.12.0";
|
||||
|
|
|
|||
1
ip/ip.c
1
ip/ip.c
|
|
@ -157,6 +157,7 @@ static int batch(const char *name)
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
batch_mode = 1;
|
||||
ret = do_batch(name, force, ip_batch_cmd, &orig_family);
|
||||
|
||||
rtnl_close(&rth);
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ static int macvlan_parse_opt(struct link_util *lu, int argc, char **argv,
|
|||
} else if (matches(*argv, "bcqueuelen") == 0) {
|
||||
__u32 bc_queue_len;
|
||||
NEXT_ARG();
|
||||
|
||||
|
||||
if (get_u32(&bc_queue_len, *argv, 0)) {
|
||||
return bc_queue_len_arg(*argv);
|
||||
}
|
||||
|
|
|
|||
38
ip/ipnetns.c
38
ip/ipnetns.c
|
|
@ -579,18 +579,18 @@ static int netns_pids(int argc, char **argv)
|
|||
{
|
||||
const char *name;
|
||||
char net_path[PATH_MAX];
|
||||
int netns;
|
||||
int netns = -1, ret = -1;
|
||||
struct stat netst;
|
||||
DIR *dir;
|
||||
struct dirent *entry;
|
||||
|
||||
if (argc < 1) {
|
||||
fprintf(stderr, "No netns name specified\n");
|
||||
return -1;
|
||||
goto out;
|
||||
}
|
||||
if (argc > 1) {
|
||||
fprintf(stderr, "extra arguments specified\n");
|
||||
return -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
name = argv[0];
|
||||
|
|
@ -599,18 +599,18 @@ static int netns_pids(int argc, char **argv)
|
|||
if (netns < 0) {
|
||||
fprintf(stderr, "Cannot open network namespace: %s\n",
|
||||
strerror(errno));
|
||||
return -1;
|
||||
goto out;
|
||||
}
|
||||
if (fstat(netns, &netst) < 0) {
|
||||
fprintf(stderr, "Stat of netns failed: %s\n",
|
||||
strerror(errno));
|
||||
return -1;
|
||||
goto out;
|
||||
}
|
||||
dir = opendir("/proc/");
|
||||
if (!dir) {
|
||||
fprintf(stderr, "Open of /proc failed: %s\n",
|
||||
strerror(errno));
|
||||
return -1;
|
||||
goto out;
|
||||
}
|
||||
while ((entry = readdir(dir))) {
|
||||
char pid_net_path[PATH_MAX];
|
||||
|
|
@ -627,15 +627,19 @@ static int netns_pids(int argc, char **argv)
|
|||
printf("%s\n", entry->d_name);
|
||||
}
|
||||
}
|
||||
ret = 0;
|
||||
closedir(dir);
|
||||
return 0;
|
||||
out:
|
||||
if (netns >= 0)
|
||||
close(netns);
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
int netns_identify_pid(const char *pidstr, char *name, int len)
|
||||
{
|
||||
char net_path[PATH_MAX];
|
||||
int netns;
|
||||
int netns = -1, ret = -1;
|
||||
struct stat netst;
|
||||
DIR *dir;
|
||||
struct dirent *entry;
|
||||
|
|
@ -647,22 +651,24 @@ int netns_identify_pid(const char *pidstr, char *name, int len)
|
|||
if (netns < 0) {
|
||||
fprintf(stderr, "Cannot open network namespace: %s\n",
|
||||
strerror(errno));
|
||||
return -1;
|
||||
goto out;
|
||||
}
|
||||
if (fstat(netns, &netst) < 0) {
|
||||
fprintf(stderr, "Stat of netns failed: %s\n",
|
||||
strerror(errno));
|
||||
return -1;
|
||||
goto out;
|
||||
}
|
||||
dir = opendir(NETNS_RUN_DIR);
|
||||
if (!dir) {
|
||||
/* Succeed treat a missing directory as an empty directory */
|
||||
if (errno == ENOENT)
|
||||
return 0;
|
||||
if (errno == ENOENT) {
|
||||
ret = 0;
|
||||
goto out;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Failed to open directory %s:%s\n",
|
||||
NETNS_RUN_DIR, strerror(errno));
|
||||
return -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
while ((entry = readdir(dir))) {
|
||||
|
|
@ -685,8 +691,12 @@ int netns_identify_pid(const char *pidstr, char *name, int len)
|
|||
strlcpy(name, entry->d_name, len);
|
||||
}
|
||||
}
|
||||
ret = 0;
|
||||
closedir(dir);
|
||||
return 0;
|
||||
out:
|
||||
if (netns >= 0)
|
||||
close(netns);
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -454,8 +454,9 @@ int print_nexthop_bucket(struct nlmsghdr *n, void *arg)
|
|||
|
||||
static int add_nh_group_attr(struct nlmsghdr *n, int maxlen, char *argv)
|
||||
{
|
||||
struct nexthop_grp *grps;
|
||||
struct nexthop_grp *grps = NULL;
|
||||
int count = 0, i;
|
||||
int err = -1;
|
||||
char *sep, *wsep;
|
||||
|
||||
if (*argv != '\0')
|
||||
|
|
@ -469,11 +470,11 @@ static int add_nh_group_attr(struct nlmsghdr *n, int maxlen, char *argv)
|
|||
}
|
||||
|
||||
if (count == 0)
|
||||
return -1;
|
||||
goto out;
|
||||
|
||||
grps = calloc(count, sizeof(*grps));
|
||||
if (!grps)
|
||||
return -1;
|
||||
goto out;
|
||||
|
||||
for (i = 0; i < count; ++i) {
|
||||
sep = strchr(argv, '/');
|
||||
|
|
@ -485,7 +486,7 @@ static int add_nh_group_attr(struct nlmsghdr *n, int maxlen, char *argv)
|
|||
*wsep = '\0';
|
||||
|
||||
if (get_unsigned(&grps[i].id, argv, 0))
|
||||
return -1;
|
||||
goto out;
|
||||
if (wsep) {
|
||||
unsigned int w;
|
||||
|
||||
|
|
@ -501,7 +502,10 @@ static int add_nh_group_attr(struct nlmsghdr *n, int maxlen, char *argv)
|
|||
argv = sep + 1;
|
||||
}
|
||||
|
||||
return addattr_l(n, maxlen, NHA_GROUP, grps, count * sizeof(*grps));
|
||||
err = addattr_l(n, maxlen, NHA_GROUP, grps, count * sizeof(*grps));
|
||||
out:
|
||||
free(grps);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int read_nh_group_type(const char *name)
|
||||
|
|
|
|||
|
|
@ -536,10 +536,10 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
|||
|
||||
if (erspan_dir == 0)
|
||||
print_string(PRINT_ANY, "erspan_dir",
|
||||
"erspan_dir ingress ", NULL);
|
||||
"erspan_dir %s ", "ingress");
|
||||
else
|
||||
print_string(PRINT_ANY, "erspan_dir",
|
||||
"erspan_dir egress ", NULL);
|
||||
"erspan_dir %s ", "egress");
|
||||
}
|
||||
|
||||
if (tb[IFLA_GRE_ERSPAN_HWID]) {
|
||||
|
|
|
|||
|
|
@ -594,10 +594,10 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
|||
|
||||
if (erspan_dir == 0)
|
||||
print_string(PRINT_ANY, "erspan_dir",
|
||||
"erspan_dir ingress ", NULL);
|
||||
"erspan_dir %s ", "ingress");
|
||||
else
|
||||
print_string(PRINT_ANY, "erspan_dir",
|
||||
"erspan_dir egress ", NULL);
|
||||
"erspan_dir %s ", "egress");
|
||||
}
|
||||
|
||||
if (tb[IFLA_GRE_ERSPAN_HWID]) {
|
||||
|
|
|
|||
|
|
@ -2832,7 +2832,7 @@ static void bpf_get_cfg(struct bpf_elf_ctx *ctx)
|
|||
int fd;
|
||||
|
||||
fd = open(path_jit, O_RDONLY);
|
||||
if (fd > 0) {
|
||||
if (fd >= 0) {
|
||||
char tmp[16] = {};
|
||||
|
||||
if (read(fd, tmp, sizeof(tmp)) > 0)
|
||||
|
|
@ -3092,13 +3092,13 @@ int bpf_send_map_fds(const char *path, const char *obj)
|
|||
.st = &ctx->stat,
|
||||
.obj = obj,
|
||||
};
|
||||
int fd, ret;
|
||||
int fd, ret = -1;
|
||||
|
||||
fd = socket(AF_UNIX, SOCK_DGRAM, 0);
|
||||
if (fd < 0) {
|
||||
fprintf(stderr, "Cannot open socket: %s\n",
|
||||
strerror(errno));
|
||||
return -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
strlcpy(addr.sun_path, path, sizeof(addr.sun_path));
|
||||
|
|
@ -3107,7 +3107,7 @@ int bpf_send_map_fds(const char *path, const char *obj)
|
|||
if (ret < 0) {
|
||||
fprintf(stderr, "Cannot connect to %s: %s\n",
|
||||
path, strerror(errno));
|
||||
return -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = bpf_map_set_send(fd, &addr, sizeof(addr), &bpf_aux,
|
||||
|
|
@ -3117,7 +3117,9 @@ int bpf_send_map_fds(const char *path, const char *obj)
|
|||
path, strerror(errno));
|
||||
|
||||
bpf_maps_teardown(ctx);
|
||||
close(fd);
|
||||
out:
|
||||
if (fd >= 0)
|
||||
close(fd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -3125,13 +3127,13 @@ int bpf_recv_map_fds(const char *path, int *fds, struct bpf_map_aux *aux,
|
|||
unsigned int entries)
|
||||
{
|
||||
struct sockaddr_un addr = { .sun_family = AF_UNIX };
|
||||
int fd, ret;
|
||||
int fd, ret = -1;
|
||||
|
||||
fd = socket(AF_UNIX, SOCK_DGRAM, 0);
|
||||
if (fd < 0) {
|
||||
fprintf(stderr, "Cannot open socket: %s\n",
|
||||
strerror(errno));
|
||||
return -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
strlcpy(addr.sun_path, path, sizeof(addr.sun_path));
|
||||
|
|
@ -3140,7 +3142,7 @@ int bpf_recv_map_fds(const char *path, int *fds, struct bpf_map_aux *aux,
|
|||
if (ret < 0) {
|
||||
fprintf(stderr, "Cannot bind to socket: %s\n",
|
||||
strerror(errno));
|
||||
return -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = bpf_map_set_recv(fd, fds, aux, entries);
|
||||
|
|
@ -3149,7 +3151,10 @@ int bpf_recv_map_fds(const char *path, int *fds, struct bpf_map_aux *aux,
|
|||
path, strerror(errno));
|
||||
|
||||
unlink(addr.sun_path);
|
||||
close(fd);
|
||||
|
||||
out:
|
||||
if (fd >= 0)
|
||||
close(fd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ static int stat_qp_show_parse_cb(const struct nlmsghdr *nlh, void *data)
|
|||
struct rd *rd = data;
|
||||
const char *name;
|
||||
uint32_t idx;
|
||||
int ret;
|
||||
int ret = MNL_CB_OK;
|
||||
|
||||
mnl_attr_parse(nlh, 0, rd_attr_cb, tb);
|
||||
if (!tb[RDMA_NLDEV_ATTR_DEV_INDEX] || !tb[RDMA_NLDEV_ATTR_DEV_NAME] ||
|
||||
|
|
|
|||
|
|
@ -159,7 +159,9 @@ static int parse_bpf(struct exec_util *eu, int argc, char **argv)
|
|||
|
||||
envp_run[env_num - 1] = NULL;
|
||||
out:
|
||||
return execvpe(argv_run[0], argv_run, envp_run);
|
||||
ret = execvpe(argv_run[0], argv_run, envp_run);
|
||||
free(envp_run);
|
||||
return ret;
|
||||
|
||||
err_free_env:
|
||||
for (--i; i >= env_old; i--)
|
||||
|
|
|
|||
|
|
@ -299,8 +299,7 @@ static int cake_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||
|
||||
NEXT_ARG();
|
||||
overhead = strtol(*argv, &p, 10);
|
||||
if (!p || *p || !*argv ||
|
||||
overhead < -64 || overhead > 256) {
|
||||
if (!p || *p || overhead < -64 || overhead > 256) {
|
||||
fprintf(stderr,
|
||||
"Illegal \"overhead\", valid range is -64 to 256\\n");
|
||||
return -1;
|
||||
|
|
@ -312,7 +311,7 @@ static int cake_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||
|
||||
NEXT_ARG();
|
||||
mpu = strtol(*argv, &p, 10);
|
||||
if (!p || *p || !*argv || mpu < 0 || mpu > 256) {
|
||||
if (!p || *p || mpu < 0 || mpu > 256) {
|
||||
fprintf(stderr,
|
||||
"Illegal \"mpu\", valid range is 0 to 256\\n");
|
||||
return -1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue