mirror of
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git
synced 2026-01-26 14:13:24 +00:00
Merge remote-tracking branch 'main/main' into next
Signed-off-by: David Ahern <dsahern@kernel.org>
This commit is contained in:
commit
f900302f32
@ -2329,7 +2329,7 @@ static int dl_argv_dry_parse(struct dl *dl, uint64_t o_required,
|
||||
return err;
|
||||
}
|
||||
|
||||
/* List of extented handles with two slashes. */
|
||||
/* List of extended handles with two slashes. */
|
||||
static const uint64_t dl_opt_extended_handle[] = {
|
||||
DL_OPT_HANDLEP,
|
||||
DL_OPT_HANDLE_REGION,
|
||||
|
||||
@ -15,4 +15,4 @@ with syntax and features:
|
||||
|
||||
Note: Users should use new BTF way to defined the maps, the examples
|
||||
in legacy folder which is using struct bpf_elf_map defined maps is not
|
||||
recommanded.
|
||||
recommended.
|
||||
|
||||
@ -267,7 +267,7 @@ static int ctrl_list(int cmd, int argc, char **argv)
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "Wrong number of params\n");
|
||||
return -1;
|
||||
goto ctrl_done;
|
||||
}
|
||||
|
||||
if (matches(*argv, "name") == 0) {
|
||||
@ -334,8 +334,9 @@ static int ctrl_listen(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (rtnl_listen(&rth, print_ctrl, (void *) stdout) < 0)
|
||||
return -1;
|
||||
|
||||
exit(2);
|
||||
|
||||
rtnl_close(&rth);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -253,7 +253,7 @@ static int BPF_FUNC(skb_set_tunnel_opt, struct __sk_buff *skb,
|
||||
# define memmove(d, s, n) __builtin_memmove((d), (s), (n))
|
||||
#endif
|
||||
|
||||
/* FIXME: __builtin_memcmp() is not yet fully useable unless llvm bug
|
||||
/* FIXME: __builtin_memcmp() is not yet fully usable unless llvm bug
|
||||
* https://llvm.org/bugs/show_bug.cgi?id=26218 gets resolved. Also
|
||||
* this one would generate a reloc entry (non-map), otherwise.
|
||||
*/
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
# define XT_LIB_DIR "/lib/xtables"
|
||||
#endif
|
||||
|
||||
/* protocol family dependent informations */
|
||||
/* protocol family dependent information */
|
||||
struct afinfo {
|
||||
/* protocol family */
|
||||
int family;
|
||||
|
||||
8
ip/ip.c
8
ip/ip.c
@ -61,16 +61,16 @@ static void usage(void)
|
||||
fprintf(stderr,
|
||||
"Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }\n"
|
||||
" ip [ -force ] -batch filename\n"
|
||||
"where OBJECT := { address | addrlabel | amt | fou | help | ila | ioam | l2tp |\n"
|
||||
" link | macsec | maddress | monitor | mptcp | mroute | mrule |\n"
|
||||
"where OBJECT := { address | addrlabel | fou | help | ila | ioam | l2tp | link |\n"
|
||||
" macsec | maddress | monitor | mptcp | mroute | mrule |\n"
|
||||
" neighbor | neighbour | netconf | netns | nexthop | ntable |\n"
|
||||
" ntbl | route | rule | sr | tap | tcpmetrics |\n"
|
||||
" ntbl | route | rule | sr | stats | tap | tcpmetrics |\n"
|
||||
" token | tunnel | tuntap | vrf | xfrm }\n"
|
||||
" OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |\n"
|
||||
" -h[uman-readable] | -iec | -j[son] | -p[retty] |\n"
|
||||
" -f[amily] { inet | inet6 | mpls | bridge | link } |\n"
|
||||
" -4 | -6 | -M | -B | -0 |\n"
|
||||
" -l[oops] { maximum-addr-flush-attempts } | -br[ief] |\n"
|
||||
" -l[oops] { maximum-addr-flush-attempts } | -echo | -br[ief] |\n"
|
||||
" -o[neline] | -t[imestamp] | -ts[hort] | -b[atch] [filename] |\n"
|
||||
" -rc[vbuf] [size] | -n[etns] name | -N[umeric] | -a[ll] |\n"
|
||||
" -c[olor]}\n");
|
||||
|
||||
@ -193,7 +193,8 @@ static int do_show(int argc, char **argv)
|
||||
perror("Can not send request");
|
||||
exit(1);
|
||||
}
|
||||
rtnl_listen(&rth, print_netconf, stdout);
|
||||
if (rtnl_listen(&rth, print_netconf, stdout) < 0)
|
||||
exit(2);
|
||||
} else {
|
||||
rth.flags = RTNL_HANDLE_F_SUPPRESS_NLERR;
|
||||
dump:
|
||||
|
||||
@ -96,7 +96,8 @@ static int ipnetns_have_nsid(void)
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
rtnl_listen(&rth, ipnetns_accept_msg, NULL);
|
||||
if (rtnl_listen(&rth, ipnetns_accept_msg, NULL) < 0)
|
||||
exit(2);
|
||||
close(fd);
|
||||
}
|
||||
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
#include <stdarg.h>
|
||||
#include <limits.h>
|
||||
#include <assert.h>
|
||||
#include <libgen.h>
|
||||
|
||||
#ifdef HAVE_ELF
|
||||
#include <libelf.h>
|
||||
@ -971,8 +972,8 @@ int bpf_load_common(struct bpf_cfg_in *cfg, const struct bpf_cfg_ops *ops,
|
||||
ops->cbpf_cb(nl, cfg->opcodes, cfg->n_opcodes);
|
||||
if (cfg->mode == EBPF_OBJECT || cfg->mode == EBPF_PINNED) {
|
||||
snprintf(annotation, sizeof(annotation), "%s:[%s]",
|
||||
basename(cfg->object), cfg->mode == EBPF_PINNED ?
|
||||
"*fsobj" : cfg->section);
|
||||
basename(strdupa(cfg->object)),
|
||||
cfg->mode == EBPF_PINNED ? "*fsobj" : cfg->section);
|
||||
ops->ebpf_cb(nl, cfg->prog_fd, annotation);
|
||||
}
|
||||
|
||||
|
||||
@ -140,6 +140,9 @@ int color_fprintf(FILE *fp, enum color_attr attr, const char *fmt, ...)
|
||||
int ret = 0;
|
||||
va_list args;
|
||||
|
||||
if (fmt == NULL)
|
||||
return 0;
|
||||
|
||||
va_start(args, fmt);
|
||||
|
||||
if (!color_is_enabled || attr == COLOR_NONE) {
|
||||
|
||||
@ -217,7 +217,7 @@ int print_color_bool(enum output_type type,
|
||||
|
||||
/* In JSON mode, acts like print_color_bool.
|
||||
* Otherwise, will print key with prefix of "no" if false.
|
||||
* The show flag is used to suppres printing in non-JSON mode
|
||||
* The show flag is used to suppress printing in non-JSON mode
|
||||
*/
|
||||
int print_color_bool_opt(enum output_type type,
|
||||
enum color_attr color,
|
||||
|
||||
@ -1582,7 +1582,7 @@ size_t strlcat(char *dst, const char *src, size_t size)
|
||||
void drop_cap(void)
|
||||
{
|
||||
#ifdef HAVE_LIBCAP
|
||||
/* don't harmstring root/sudo */
|
||||
/* don't hamstring root/sudo */
|
||||
if (getuid() != 0 && geteuid() != 0) {
|
||||
cap_t capabilities;
|
||||
cap_value_t net_admin = CAP_NET_ADMIN;
|
||||
|
||||
@ -149,7 +149,7 @@ These parameter accept integer meaning weight or priority of a node.
|
||||
- set rate object parent to existing node with name \fINODE_NAME\fR or unset
|
||||
parent. Rate limits of the parent node applied to all it's children. Actual
|
||||
behaviour is details of driver's implementation. Setting parent to empty ("")
|
||||
name due to the kernel logic threated as parent unset.
|
||||
name due to the kernel logic treated as parent unset.
|
||||
|
||||
.SS devlink port function rate add - create node rate object with specified parameters.
|
||||
Creates rate object of type node and sets parameters. Parameters same as for the
|
||||
|
||||
@ -392,7 +392,7 @@ If L2TP is being used over IPv6, use the IPv6 defrag module.
|
||||
.SH INTEROPERABILITY
|
||||
.PP
|
||||
Unmanaged (static) L2TPv3 tunnels are supported by some network
|
||||
equipment equipment vendors such as Cisco.
|
||||
equipment vendors such as Cisco.
|
||||
.PP
|
||||
In Linux, L2TP Hello messages are not supported in unmanaged
|
||||
tunnels. Hello messages are used by L2TP clients and servers to detect
|
||||
|
||||
@ -36,7 +36,7 @@ bytes
|
||||
|
||||
.SH DESCRIPTION
|
||||
HTB allows control of the outbound bandwidth on a given link.
|
||||
It allows simulating simulating several slower links and to send different
|
||||
It allows simulating several slower links and to send different
|
||||
kinds of traffic on different simulated links. In both cases, you have
|
||||
to specify how to divide the physical link into simulated links and
|
||||
how to decide which simulated link to use for a given packet to be sent.
|
||||
|
||||
@ -67,7 +67,7 @@ the number of non-responsive flows, M. It is (1 - (1 - (1 / 16.0)) ** M) **8,
|
||||
so for example with 10 non-responsive flows approximately 0.2% of responsive flows
|
||||
will be misidentified.
|
||||
|
||||
To mitigate this, SFB performs performs periodic re-hashing to avoid
|
||||
To mitigate this, SFB performs periodic re-hashing to avoid
|
||||
misclassification for prolonged periods of time.
|
||||
|
||||
The default hashing method will use source and destination ip addresses and port numbers
|
||||
|
||||
@ -49,13 +49,13 @@ provided by a port.
|
||||
.B Lower
|
||||
.br
|
||||
The lower bound of the 32-bit instance field of the port name.
|
||||
The instance field is often used as as a sub-class indicator.
|
||||
The instance field is often used as a sub-class indicator.
|
||||
|
||||
.TP
|
||||
.B Upper
|
||||
.br
|
||||
The upper bound of the 32-bit instance field of the port name.
|
||||
The instance field is often used as as a sub-class indicator.
|
||||
The instance field is often used as a sub-class indicator.
|
||||
A difference in
|
||||
.BR "lower " "and " upper
|
||||
means the socket is bound to the port name range [lower,upper]
|
||||
|
||||
@ -58,7 +58,7 @@ struct ifstat_ent {
|
||||
struct ifstat_ent *next;
|
||||
char *name;
|
||||
int ifindex;
|
||||
__u64 val[MAXS];
|
||||
unsigned long long val[MAXS];
|
||||
double rate[MAXS];
|
||||
__u32 ival[MAXS];
|
||||
};
|
||||
@ -117,16 +117,20 @@ static int get_nlmsg_extended(struct nlmsghdr *m, void *arg)
|
||||
return 0;
|
||||
|
||||
len -= NLMSG_LENGTH(sizeof(*ifsm));
|
||||
if (len < 0)
|
||||
if (len < 0) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
parse_rtattr(tb, IFLA_STATS_MAX, IFLA_STATS_RTA(ifsm), len);
|
||||
if (tb[filter_type] == NULL)
|
||||
return 0;
|
||||
|
||||
n = malloc(sizeof(*n));
|
||||
if (!n)
|
||||
abort();
|
||||
if (!n) {
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
n->ifindex = ifsm->ifindex;
|
||||
n->name = strdup(ll_index_to_name(ifsm->ifindex));
|
||||
@ -161,8 +165,10 @@ static int get_nlmsg(struct nlmsghdr *m, void *arg)
|
||||
return 0;
|
||||
|
||||
len -= NLMSG_LENGTH(sizeof(*ifi));
|
||||
if (len < 0)
|
||||
if (len < 0) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(ifi->ifi_flags&IFF_UP))
|
||||
return 0;
|
||||
@ -172,8 +178,10 @@ static int get_nlmsg(struct nlmsghdr *m, void *arg)
|
||||
return 0;
|
||||
|
||||
n = malloc(sizeof(*n));
|
||||
if (!n)
|
||||
abort();
|
||||
if (!n) {
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
n->ifindex = ifi->ifi_index;
|
||||
n->name = strdup(RTA_DATA(tb[IFLA_IFNAME]));
|
||||
memcpy(&n->ival, RTA_DATA(tb[IFLA_STATS]), sizeof(n->ival));
|
||||
@ -204,7 +212,7 @@ static void load_info(void)
|
||||
}
|
||||
|
||||
if (rtnl_dump_filter(&rth, get_nlmsg_extended, NULL) < 0) {
|
||||
fprintf(stderr, "Dump terminated\n");
|
||||
perror("Dump terminated\n");
|
||||
exit(1);
|
||||
}
|
||||
} else {
|
||||
@ -214,7 +222,7 @@ static void load_info(void)
|
||||
}
|
||||
|
||||
if (rtnl_dump_filter(&rth, get_nlmsg, NULL) < 0) {
|
||||
fprintf(stderr, "Dump terminated\n");
|
||||
perror("Dump terminated\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ struct filter_entry {
|
||||
char *key;
|
||||
char *value;
|
||||
/*
|
||||
* This field means that we can try to issue .doit calback
|
||||
* This field means that we can try to issue .doit callback
|
||||
* on value above. This value can be converted to integer
|
||||
* with simple atoi(). Otherwise "is_doit" will be false.
|
||||
*/
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
#include <inttypes.h>
|
||||
#include "m_ematch.h"
|
||||
|
||||
#define EM_CANID_RULES_MAX 400 /* Main reason for this number is Nelink
|
||||
#define EM_CANID_RULES_MAX 400 /* Main reason for this number is Netlink
|
||||
message size limit equal to Single memory page size. When dump()
|
||||
is invoked, there are even some ematch related headers sent from
|
||||
kernel to userspace together with em_canid configuration --
|
||||
|
||||
22
tc/f_fw.c
22
tc/f_fw.c
@ -124,18 +124,25 @@ static int fw_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt, __u
|
||||
if (handle || tb[TCA_FW_MASK]) {
|
||||
__u32 mark = 0, mask = 0;
|
||||
|
||||
open_json_object("handle");
|
||||
if (handle)
|
||||
mark = handle;
|
||||
if (tb[TCA_FW_MASK] &&
|
||||
(mask = rta_getattr_u32(tb[TCA_FW_MASK])) != 0xFFFFFFFF)
|
||||
fprintf(f, "handle 0x%x/0x%x ", mark, mask);
|
||||
else
|
||||
fprintf(f, "handle 0x%x ", handle);
|
||||
(mask = rta_getattr_u32(tb[TCA_FW_MASK])) != 0xFFFFFFFF) {
|
||||
print_hex(PRINT_ANY, "mark", "handle 0x%x", mark);
|
||||
print_hex(PRINT_ANY, "mask", "/0x%x ", mask);
|
||||
} else {
|
||||
print_hex(PRINT_ANY, "mark", "handle 0x%x ", mark);
|
||||
print_hex(PRINT_JSON, "mask", NULL, 0xFFFFFFFF);
|
||||
}
|
||||
close_json_object();
|
||||
}
|
||||
|
||||
if (tb[TCA_FW_CLASSID]) {
|
||||
SPRINT_BUF(b1);
|
||||
fprintf(f, "classid %s ", sprint_tc_classid(rta_getattr_u32(tb[TCA_FW_CLASSID]), b1));
|
||||
print_string(PRINT_ANY, "classid", "classid %s ",
|
||||
sprint_tc_classid(
|
||||
rta_getattr_u32(tb[TCA_FW_CLASSID]), b1));
|
||||
}
|
||||
|
||||
if (tb[TCA_FW_POLICE])
|
||||
@ -143,11 +150,12 @@ static int fw_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt, __u
|
||||
if (tb[TCA_FW_INDEV]) {
|
||||
struct rtattr *idev = tb[TCA_FW_INDEV];
|
||||
|
||||
fprintf(f, "input dev %s ", rta_getattr_str(idev));
|
||||
print_string(PRINT_ANY, "indev", "input dev %s ",
|
||||
rta_getattr_str(idev));
|
||||
}
|
||||
|
||||
if (tb[TCA_FW_ACT]) {
|
||||
fprintf(f, "\n");
|
||||
print_string(PRINT_FP, NULL, "\n", "");
|
||||
tc_print_action(f, tb[TCA_FW_ACT], 0);
|
||||
}
|
||||
return 0;
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
@ -87,6 +88,7 @@ static char *sprint_u32_handle(__u32 handle, char *buf)
|
||||
if (htid) {
|
||||
int l = snprintf(b, bsize, "%x:", htid>>20);
|
||||
|
||||
assert(l > 0 && l < bsize);
|
||||
bsize -= l;
|
||||
b += l;
|
||||
}
|
||||
@ -94,12 +96,14 @@ static char *sprint_u32_handle(__u32 handle, char *buf)
|
||||
if (hash) {
|
||||
int l = snprintf(b, bsize, "%x", hash);
|
||||
|
||||
assert(l > 0 && l < bsize);
|
||||
bsize -= l;
|
||||
b += l;
|
||||
}
|
||||
if (nodeid) {
|
||||
int l = snprintf(b, bsize, ":%x", nodeid);
|
||||
|
||||
assert(l > 0 && l < bsize);
|
||||
bsize -= l;
|
||||
b += l;
|
||||
}
|
||||
@ -1300,7 +1304,7 @@ static int u32_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt,
|
||||
|
||||
if (tb[TCA_U32_PCNT]) {
|
||||
if (RTA_PAYLOAD(tb[TCA_U32_PCNT]) < sizeof(*pf)) {
|
||||
fprintf(f, "Broken perf counters\n");
|
||||
fprintf(stderr, "Broken perf counters\n");
|
||||
return -1;
|
||||
}
|
||||
pf = RTA_DATA(tb[TCA_U32_PCNT]);
|
||||
@ -1315,7 +1319,7 @@ static int u32_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt,
|
||||
struct tc_u32_mark *mark = RTA_DATA(tb[TCA_U32_MARK]);
|
||||
|
||||
if (RTA_PAYLOAD(tb[TCA_U32_MARK]) < sizeof(*mark)) {
|
||||
fprintf(f, "\n Invalid mark (kernel&iproute2 mismatch)\n");
|
||||
fprintf(stderr, "Invalid mark (kernel&iproute2 mismatch)\n");
|
||||
} else {
|
||||
print_nl();
|
||||
print_0xhex(PRINT_ANY, "fwmark_value", " mark 0x%04x ", mark->val);
|
||||
|
||||
@ -62,7 +62,7 @@ static void act_usage(void)
|
||||
static int print_noaopt(struct action_util *au, FILE *f, struct rtattr *opt)
|
||||
{
|
||||
if (opt && RTA_PAYLOAD(opt))
|
||||
fprintf(f, "[Unknown action, optlen=%u] ",
|
||||
fprintf(stderr, "[Unknown action, optlen=%u] ",
|
||||
(unsigned int) RTA_PAYLOAD(opt));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -204,7 +204,7 @@ static int bpf_print_opt(struct action_util *au, FILE *f, struct rtattr *arg)
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(f, "\n ");
|
||||
print_string(PRINT_FP, NULL, "%s", "\n ");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
#include "tc_util.h"
|
||||
#include <linux/tc_act/tc_gact.h>
|
||||
|
||||
/* define to turn on probablity stuff */
|
||||
/* define to turn on probability stuff */
|
||||
|
||||
#ifdef CONFIG_GACT_PROB
|
||||
static const char *prob_n2a(int p)
|
||||
|
||||
@ -224,7 +224,7 @@ static int htb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv,
|
||||
opt.ceil.rate = (ceil64 >= (1ULL << 32)) ? ~0U : ceil64;
|
||||
|
||||
/* compute minimal allowed burst from rate; mtu is added here to make
|
||||
sute that buffer is larger than mtu and to have some safeguard space */
|
||||
sure that buffer is larger than mtu and to have some safeguard space */
|
||||
if (!buffer)
|
||||
buffer = rate64 / get_hz() + mtu;
|
||||
if (!cbuffer)
|
||||
|
||||
@ -117,7 +117,7 @@ static void print_corr(bool present, __u32 value)
|
||||
}
|
||||
|
||||
/*
|
||||
* Simplistic file parser for distrbution data.
|
||||
* Simplistic file parser for distribution data.
|
||||
* Format is:
|
||||
* # comment line(s)
|
||||
* data0 data1 ...
|
||||
|
||||
@ -113,7 +113,6 @@ void print_action_control(FILE *f, const char *prefix,
|
||||
int action, const char *suffix);
|
||||
int police_print_xstats(struct action_util *a, FILE *f, struct rtattr *tb);
|
||||
int tc_print_action(FILE *f, const struct rtattr *tb, unsigned short tot_acts);
|
||||
int tc_print_ipt(FILE *f, const struct rtattr *tb);
|
||||
int parse_action(int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n);
|
||||
void print_tm(FILE *f, const struct tcf_t *tm);
|
||||
int prio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt);
|
||||
|
||||
@ -13,10 +13,10 @@ possible to create a vlan named "help" with the ip tool, but it's impossible
|
||||
to remove it, the command just shows help. This is an effect of treating
|
||||
bare words specially.
|
||||
|
||||
Help texts are not dynamically generated. That is, we do not pass datastructures
|
||||
Help texts are not dynamically generated. That is, we do not pass data structures
|
||||
like command list or option lists and print them dynamically. This is
|
||||
intentional. There is always that exception and when it comes to help texts
|
||||
these exceptions are normally neglected at the expence of usability.
|
||||
these exceptions are normally neglected at the expense of usability.
|
||||
|
||||
KEY-VALUE
|
||||
~~~~~~~~~
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user