mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2025-10-19 19:35:21 +00:00
Merge branch 'master' into net-next
This commit is contained in:
commit
51dd3455a3
@ -16,4 +16,3 @@ install: all
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(BROBJ) bridge
|
rm -f $(BROBJ) bridge
|
||||||
|
|
||||||
|
32
bridge/fdb.c
32
bridge/fdb.c
@ -29,7 +29,7 @@
|
|||||||
#include "rt_names.h"
|
#include "rt_names.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
static unsigned int filter_index, filter_vlan;
|
static unsigned int filter_index, filter_vlan, filter_state;
|
||||||
|
|
||||||
json_writer_t *jw_global;
|
json_writer_t *jw_global;
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ static void usage(void)
|
|||||||
" [ self ] [ master ] [ use ] [ router ]\n"
|
" [ self ] [ master ] [ use ] [ router ]\n"
|
||||||
" [ local | static | dynamic ] [ dst IPADDR ] [ vlan VID ]\n"
|
" [ local | static | dynamic ] [ dst IPADDR ] [ vlan VID ]\n"
|
||||||
" [ port PORT] [ vni VNI ] [ via DEV ]\n");
|
" [ port PORT] [ vni VNI ] [ via DEV ]\n");
|
||||||
fprintf(stderr, " bridge fdb [ show [ br BRDEV ] [ brport DEV ] [ vlan VID ] ]\n");
|
fprintf(stderr, " bridge fdb [ show [ br BRDEV ] [ brport DEV ] [ vlan VID ] [ state STATE ] ]\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,6 +63,24 @@ static const char *state_n2a(unsigned int s)
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int state_a2n(unsigned int *s, const char *arg)
|
||||||
|
{
|
||||||
|
if (matches(arg, "permanent") == 0)
|
||||||
|
*s = NUD_PERMANENT;
|
||||||
|
else if (matches(arg, "static") == 0 || matches(arg, "temp") == 0)
|
||||||
|
*s = NUD_NOARP;
|
||||||
|
else if (matches(arg, "stale") == 0)
|
||||||
|
*s = NUD_STALE;
|
||||||
|
else if (matches(arg, "reachable") == 0 || matches(arg, "dynamic") == 0)
|
||||||
|
*s = NUD_REACHABLE;
|
||||||
|
else if (strcmp(arg, "all") == 0)
|
||||||
|
*s = ~0;
|
||||||
|
else if (get_unsigned(s, arg, 0))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void start_json_fdb_flags_array(bool *fdb_flags)
|
static void start_json_fdb_flags_array(bool *fdb_flags)
|
||||||
{
|
{
|
||||||
if (*fdb_flags)
|
if (*fdb_flags)
|
||||||
@ -100,6 +118,9 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
|||||||
if (filter_index && filter_index != r->ndm_ifindex)
|
if (filter_index && filter_index != r->ndm_ifindex)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (filter_state && !(r->ndm_state & filter_state))
|
||||||
|
return 0;
|
||||||
|
|
||||||
parse_rtattr(tb, NDA_MAX, NDA_RTA(r),
|
parse_rtattr(tb, NDA_MAX, NDA_RTA(r),
|
||||||
n->nlmsg_len - NLMSG_LENGTH(sizeof(*r)));
|
n->nlmsg_len - NLMSG_LENGTH(sizeof(*r)));
|
||||||
|
|
||||||
@ -310,6 +331,13 @@ static int fdb_show(int argc, char **argv)
|
|||||||
if (filter_vlan)
|
if (filter_vlan)
|
||||||
duparg("vlan", *argv);
|
duparg("vlan", *argv);
|
||||||
filter_vlan = atoi(*argv);
|
filter_vlan = atoi(*argv);
|
||||||
|
} else if (strcmp(*argv, "state") == 0) {
|
||||||
|
unsigned int state;
|
||||||
|
|
||||||
|
NEXT_ARG();
|
||||||
|
if (state_a2n(&state, *argv))
|
||||||
|
invarg("invalid state", *argv);
|
||||||
|
filter_state |= state;
|
||||||
} else {
|
} else {
|
||||||
if (matches(*argv, "help") == 0)
|
if (matches(*argv, "help") == 0)
|
||||||
usage();
|
usage();
|
||||||
|
2
etc/iproute2/rt_protos.d/README
Normal file
2
etc/iproute2/rt_protos.d/README
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Each file in this directory is an rt_protos configuration file. iproute2
|
||||||
|
commands scan this directory processing all files that end in '.conf'.
|
@ -1,3 +1,2 @@
|
|||||||
Each file in this directory is an rt_tables configuration file. iproute2
|
Each file in this directory is an rt_tables configuration file. iproute2
|
||||||
commands scan this directory processing all files that end in '.conf'.
|
commands scan this directory processing all files that end in '.conf'.
|
||||||
|
|
||||||
|
@ -111,16 +111,17 @@ static void print_tunnel(struct ip6_tnl_parm2 *p)
|
|||||||
if (p->flags & IP6_TNL_F_RCV_DSCP_COPY)
|
if (p->flags & IP6_TNL_F_RCV_DSCP_COPY)
|
||||||
printf(" dscp inherit");
|
printf(" dscp inherit");
|
||||||
|
|
||||||
if (p->proto == IPPROTO_GRE) {
|
if ((p->i_flags & GRE_KEY) && (p->o_flags & GRE_KEY) &&
|
||||||
if ((p->i_flags & GRE_KEY) && (p->o_flags & GRE_KEY) && p->o_key == p->i_key)
|
p->o_key == p->i_key)
|
||||||
printf(" key %u", ntohl(p->i_key));
|
printf(" key %u", ntohl(p->i_key));
|
||||||
else if ((p->i_flags | p->o_flags) & GRE_KEY) {
|
else {
|
||||||
if (p->i_flags & GRE_KEY)
|
if (p->i_flags & GRE_KEY)
|
||||||
printf(" ikey %u", ntohl(p->i_key));
|
printf(" ikey %u", ntohl(p->i_key));
|
||||||
if (p->o_flags & GRE_KEY)
|
if (p->o_flags & GRE_KEY)
|
||||||
printf(" okey %u", ntohl(p->o_key));
|
printf(" okey %u", ntohl(p->o_key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (p->proto == IPPROTO_GRE) {
|
||||||
if (p->i_flags & GRE_SEQ)
|
if (p->i_flags & GRE_SEQ)
|
||||||
printf("%s Drop packets out of sequence.", _SL_);
|
printf("%s Drop packets out of sequence.", _SL_);
|
||||||
if (p->i_flags & GRE_CSUM)
|
if (p->i_flags & GRE_CSUM)
|
||||||
|
@ -181,7 +181,11 @@ static int vrf_configure_cgroup(const char *path, int ifindex)
|
|||||||
if (prog_fd < 0) {
|
if (prog_fd < 0) {
|
||||||
fprintf(stderr, "Failed to load BPF prog: '%s'\n",
|
fprintf(stderr, "Failed to load BPF prog: '%s'\n",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
fprintf(stderr, "Kernel compiled with CGROUP_BPF enabled?\n");
|
|
||||||
|
if (errno != EPERM) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"Kernel compiled with CGROUP_BPF enabled?\n");
|
||||||
|
}
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,4 +24,3 @@ install:
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(NLOBJ) $(UTILOBJ) $(ADDLIB) libnetlink.a libutil.a
|
rm -f $(NLOBJ) $(UTILOBJ) $(ADDLIB) libnetlink.a libutil.a
|
||||||
|
|
||||||
|
14
lib/fs.c
14
lib/fs.c
@ -80,13 +80,21 @@ char *find_cgroup2_mount(void)
|
|||||||
|
|
||||||
if (mount("none", mnt, CGROUP2_FS_NAME, 0, NULL)) {
|
if (mount("none", mnt, CGROUP2_FS_NAME, 0, NULL)) {
|
||||||
/* EBUSY means already mounted */
|
/* EBUSY means already mounted */
|
||||||
if (errno != EBUSY) {
|
if (errno == EBUSY)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
if (errno == ENODEV) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Failed to mount cgroup2. Are CGROUPS enabled in your kernel?\n");
|
"Failed to mount cgroup2. Are CGROUPS enabled in your kernel?\n");
|
||||||
|
} else {
|
||||||
|
fprintf(stderr,
|
||||||
|
"Failed to mount cgroup2: %s\n",
|
||||||
|
strerror(errno));
|
||||||
|
}
|
||||||
free(mnt);
|
free(mnt);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
out:
|
||||||
return mnt;
|
return mnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,7 +129,7 @@ int make_path(const char *path, mode_t mode)
|
|||||||
|
|
||||||
if (mkdir(dir, mode) != 0) {
|
if (mkdir(dir, mode) != 0) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"mkdir failed for %s: %s",
|
"mkdir failed for %s: %s\n",
|
||||||
dir, strerror(errno));
|
dir, strerror(errno));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -142,9 +142,36 @@ static int rtnl_rtprot_init;
|
|||||||
|
|
||||||
static void rtnl_rtprot_initialize(void)
|
static void rtnl_rtprot_initialize(void)
|
||||||
{
|
{
|
||||||
|
struct dirent *de;
|
||||||
|
DIR *d;
|
||||||
|
|
||||||
rtnl_rtprot_init = 1;
|
rtnl_rtprot_init = 1;
|
||||||
rtnl_tab_initialize(CONFDIR "/rt_protos",
|
rtnl_tab_initialize(CONFDIR "/rt_protos",
|
||||||
rtnl_rtprot_tab, 256);
|
rtnl_rtprot_tab, 256);
|
||||||
|
|
||||||
|
d = opendir(CONFDIR "/rt_protos.d");
|
||||||
|
if (!d)
|
||||||
|
return;
|
||||||
|
|
||||||
|
while ((de = readdir(d)) != NULL) {
|
||||||
|
char path[PATH_MAX];
|
||||||
|
size_t len;
|
||||||
|
|
||||||
|
if (*de->d_name == '.')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* only consider filenames ending in '.conf' */
|
||||||
|
len = strlen(de->d_name);
|
||||||
|
if (len <= 5)
|
||||||
|
continue;
|
||||||
|
if (strcmp(de->d_name + len - 5, ".conf"))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
snprintf(path, sizeof(path), CONFDIR "/rt_protos.d/%s",
|
||||||
|
de->d_name);
|
||||||
|
rtnl_tab_initialize(path, rtnl_rtprot_tab, 256);
|
||||||
|
}
|
||||||
|
closedir(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *rtnl_rtprot_n2a(int id, char *buf, int len)
|
const char *rtnl_rtprot_n2a(int id, char *buf, int len)
|
||||||
@ -404,7 +431,7 @@ int rtnl_rttable_a2n(__u32 *id, const char *arg)
|
|||||||
static unsigned long res;
|
static unsigned long res;
|
||||||
struct rtnl_hash_entry *entry;
|
struct rtnl_hash_entry *entry;
|
||||||
char *end;
|
char *end;
|
||||||
__u32 i;
|
unsigned long i;
|
||||||
|
|
||||||
if (cache && strcmp(cache, arg) == 0) {
|
if (cache && strcmp(cache, arg) == 0) {
|
||||||
*id = res;
|
*id = res;
|
||||||
|
1
man/man8/.gitignore
vendored
1
man/man8/.gitignore
vendored
@ -2,4 +2,3 @@
|
|||||||
ip-address.8
|
ip-address.8
|
||||||
ip-link.8
|
ip-link.8
|
||||||
ip-route.8
|
ip-route.8
|
||||||
|
|
||||||
|
@ -70,7 +70,15 @@ bridge \- show / manipulate bridge addresses and devices
|
|||||||
.ti -8
|
.ti -8
|
||||||
.BR "bridge fdb" " [ " show " ] [ "
|
.BR "bridge fdb" " [ " show " ] [ "
|
||||||
.B dev
|
.B dev
|
||||||
.IR DEV " ]"
|
.IR DEV " ] [ "
|
||||||
|
.B br
|
||||||
|
.IR BRDEV " ] [ "
|
||||||
|
.B brport
|
||||||
|
.IR DEV " ] [ "
|
||||||
|
.B vlan
|
||||||
|
.IR VID " ] [ "
|
||||||
|
.B state
|
||||||
|
.IR STATE " ]"
|
||||||
|
|
||||||
.ti -8
|
.ti -8
|
||||||
.BR "bridge mdb" " { " add " | " del " } "
|
.BR "bridge mdb" " { " add " | " del " } "
|
||||||
|
@ -99,7 +99,7 @@ classification so that it will match ICMP on the next rule, at prio 3:
|
|||||||
# tc filter add dev eth0 parent ffff: prio 2 protocol 0xdead \\
|
# tc filter add dev eth0 parent ffff: prio 2 protocol 0xdead \\
|
||||||
u32 match u32 0 0 flowid 1:1 \\
|
u32 match u32 0 0 flowid 1:1 \\
|
||||||
action ife decode reclassify
|
action ife decode reclassify
|
||||||
# tc filter add dev eth0 parent ffff: priod 3 protocol ip \\
|
# tc filter add dev eth0 parent ffff: prio 3 protocol ip \\
|
||||||
u32 match ip protocol 0xff flowid 1:1 \\
|
u32 match ip protocol 0xff flowid 1:1 \\
|
||||||
action continue
|
action continue
|
||||||
.EE
|
.EE
|
||||||
|
@ -77,6 +77,9 @@ static struct xtables_globals tcipt_globals = {
|
|||||||
.orig_opts = original_opts,
|
.orig_opts = original_opts,
|
||||||
.opts = original_opts,
|
.opts = original_opts,
|
||||||
.exit_err = NULL,
|
.exit_err = NULL,
|
||||||
|
#if (XTABLES_VERSION_CODE >= 11)
|
||||||
|
.compat_rev = xtables_compatible_revision,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user