Merge branch 'master' into next

Signed-off-by: David Ahern <dsahern@gmail.com>
This commit is contained in:
David Ahern 2020-01-29 15:16:54 +00:00
commit 8e66c8c112
28 changed files with 500 additions and 360 deletions

2
configure vendored
View File

@ -16,9 +16,11 @@ check_toolchain()
: ${PKG_CONFIG:=pkg-config}
: ${AR=ar}
: ${CC=gcc}
: ${YACC=bison}
echo "PKG_CONFIG:=${PKG_CONFIG}" >>$CONFIG
echo "AR:=${AR}" >>$CONFIG
echo "CC:=${CC}" >>$CONFIG
echo "YACC:=${YACC}" >>$CONFIG
}
check_atm()

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
static const char SNAPSHOT[] = "191125";
static const char SNAPSHOT[] = "200127";

View File

@ -31,6 +31,8 @@ enum output_type {
void new_json_obj(int json);
void delete_json_obj(void);
void new_json_obj_plain(int json);
void delete_json_obj_plain(void);
bool is_json_context(void);
@ -72,4 +74,11 @@ _PRINT_FUNC(lluint, unsigned long long)
_PRINT_FUNC(float, double)
#undef _PRINT_FUNC
#define _PRINT_NAME_VALUE_FUNC(type_name, type, format_char) \
void print_##type_name##_name_value(const char *name, type value) \
_PRINT_NAME_VALUE_FUNC(uint, unsigned int, u);
_PRINT_NAME_VALUE_FUNC(string, const char*, s);
#undef _PRINT_NAME_VALUE_FUNC
#endif /* _JSON_PRINT_H_ */

View File

@ -33,4 +33,6 @@ int ll_proto_a2n(unsigned short *id, const char *buf);
const char *nl_proto_n2a(int id, char *buf, int len);
int nl_proto_a2n(__u32 *id, const char *arg);
extern int numeric;
#endif

View File

@ -107,6 +107,10 @@ enum bpf_cmd {
BPF_MAP_LOOKUP_AND_DELETE_ELEM,
BPF_MAP_FREEZE,
BPF_BTF_GET_NEXT_ID,
BPF_MAP_LOOKUP_BATCH,
BPF_MAP_LOOKUP_AND_DELETE_BATCH,
BPF_MAP_UPDATE_BATCH,
BPF_MAP_DELETE_BATCH,
};
enum bpf_map_type {
@ -136,6 +140,7 @@ enum bpf_map_type {
BPF_MAP_TYPE_STACK,
BPF_MAP_TYPE_SK_STORAGE,
BPF_MAP_TYPE_DEVMAP_HASH,
BPF_MAP_TYPE_STRUCT_OPS,
};
/* Note that tracing related programs such as
@ -174,6 +179,8 @@ enum bpf_prog_type {
BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE,
BPF_PROG_TYPE_CGROUP_SOCKOPT,
BPF_PROG_TYPE_TRACING,
BPF_PROG_TYPE_STRUCT_OPS,
BPF_PROG_TYPE_EXT,
};
enum bpf_attach_type {
@ -357,7 +364,12 @@ enum bpf_attach_type {
/* Enable memory-mapping BPF map */
#define BPF_F_MMAPABLE (1U << 10)
/* flags for BPF_PROG_QUERY */
/* Flags for BPF_PROG_QUERY. */
/* Query effective (directly attached + inherited from ancestor cgroups)
* programs that will be executed for events within a cgroup.
* attach_flags with this flag are returned only for directly attached programs.
*/
#define BPF_F_QUERY_EFFECTIVE (1U << 0)
enum bpf_stack_build_id_status {
@ -397,6 +409,10 @@ union bpf_attr {
__u32 btf_fd; /* fd pointing to a BTF type data */
__u32 btf_key_type_id; /* BTF type_id of the key */
__u32 btf_value_type_id; /* BTF type_id of the value */
__u32 btf_vmlinux_value_type_id;/* BTF type_id of a kernel-
* struct stored as the
* map value
*/
};
struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */
@ -409,6 +425,23 @@ union bpf_attr {
__u64 flags;
};
struct { /* struct used by BPF_MAP_*_BATCH commands */
__aligned_u64 in_batch; /* start batch,
* NULL to start from beginning
*/
__aligned_u64 out_batch; /* output: next start batch */
__aligned_u64 keys;
__aligned_u64 values;
__u32 count; /* input/output:
* input: # of key/value
* elements
* output: # of filled elements
*/
__u32 map_fd;
__u64 elem_flags;
__u64 flags;
} batch;
struct { /* anonymous struct used by BPF_PROG_LOAD command */
__u32 prog_type; /* one of enum bpf_prog_type */
__u32 insn_cnt;
@ -2703,7 +2736,8 @@ union bpf_attr {
*
* int bpf_send_signal(u32 sig)
* Description
* Send signal *sig* to the current task.
* Send signal *sig* to the process of the current task.
* The signal may be delivered to any of this process's threads.
* Return
* 0 on success or successfully queued.
*
@ -2831,6 +2865,33 @@ union bpf_attr {
* Return
* On success, the strictly positive length of the string, including
* the trailing NUL character. On error, a negative value.
*
* int bpf_tcp_send_ack(void *tp, u32 rcv_nxt)
* Description
* Send out a tcp-ack. *tp* is the in-kernel struct tcp_sock.
* *rcv_nxt* is the ack_seq to be sent out.
* Return
* 0 on success, or a negative error in case of failure.
*
* int bpf_send_signal_thread(u32 sig)
* Description
* Send signal *sig* to the thread corresponding to the current task.
* Return
* 0 on success or successfully queued.
*
* **-EBUSY** if work queue under nmi is full.
*
* **-EINVAL** if *sig* is invalid.
*
* **-EPERM** if no permission to send the *sig*.
*
* **-EAGAIN** if bpf program can try again.
*
* u64 bpf_jiffies64(void)
* Description
* Obtain the 64bit jiffies
* Return
* The 64 bit jiffies
*/
#define __BPF_FUNC_MAPPER(FN) \
FN(unspec), \
@ -2948,7 +3009,10 @@ union bpf_attr {
FN(probe_read_user), \
FN(probe_read_kernel), \
FN(probe_read_user_str), \
FN(probe_read_kernel_str),
FN(probe_read_kernel_str), \
FN(tcp_send_ack), \
FN(send_signal_thread), \
FN(jiffies64),
/* integer value in 'imm' field of BPF_CALL instruction selects which helper
* function eBPF program intends to call
@ -3349,7 +3413,7 @@ struct bpf_map_info {
__u32 map_flags;
char name[BPF_OBJ_NAME_LEN];
__u32 ifindex;
__u32 :32;
__u32 btf_vmlinux_value_type_id;
__u64 netns_dev;
__u64 netns_ino;
__u32 btf_id;

View File

@ -146,6 +146,12 @@ enum {
BTF_VAR_GLOBAL_EXTERN = 2,
};
enum btf_func_linkage {
BTF_FUNC_STATIC = 0,
BTF_FUNC_GLOBAL = 1,
BTF_FUNC_EXTERN = 2,
};
/* BTF_KIND_VAR is followed by a single "struct btf_var" to describe
* additional information related to the variable such as its linkage.
*/

View File

@ -130,6 +130,7 @@ enum {
#define BRIDGE_VLAN_INFO_RANGE_BEGIN (1<<3) /* VLAN is start of vlan range */
#define BRIDGE_VLAN_INFO_RANGE_END (1<<4) /* VLAN is end of vlan range */
#define BRIDGE_VLAN_INFO_BRENTRY (1<<5) /* Global bridge VLAN entry */
#define BRIDGE_VLAN_INFO_ONLY_OPTS (1<<6) /* Skip create/delete/flags */
struct bridge_vlan_info {
__u16 flags;
@ -190,6 +191,7 @@ enum {
BRIDGE_VLANDB_ENTRY_UNSPEC,
BRIDGE_VLANDB_ENTRY_INFO,
BRIDGE_VLANDB_ENTRY_RANGE,
BRIDGE_VLANDB_ENTRY_STATE,
__BRIDGE_VLANDB_ENTRY_MAX,
};
#define BRIDGE_VLANDB_ENTRY_MAX (__BRIDGE_VLANDB_ENTRY_MAX - 1)

View File

@ -971,6 +971,37 @@ struct tc_pie_xstats {
__u32 ecn_mark; /* packets marked with ecn*/
};
/* FQ PIE */
enum {
TCA_FQ_PIE_UNSPEC,
TCA_FQ_PIE_LIMIT,
TCA_FQ_PIE_FLOWS,
TCA_FQ_PIE_TARGET,
TCA_FQ_PIE_TUPDATE,
TCA_FQ_PIE_ALPHA,
TCA_FQ_PIE_BETA,
TCA_FQ_PIE_QUANTUM,
TCA_FQ_PIE_MEMORY_LIMIT,
TCA_FQ_PIE_ECN_PROB,
TCA_FQ_PIE_ECN,
TCA_FQ_PIE_BYTEMODE,
TCA_FQ_PIE_DQ_RATE_ESTIMATOR,
__TCA_FQ_PIE_MAX
};
#define TCA_FQ_PIE_MAX (__TCA_FQ_PIE_MAX - 1)
struct tc_fq_pie_xstats {
__u32 packets_in; /* total number of packets enqueued */
__u32 dropped; /* packets dropped due to fq_pie_action */
__u32 overlimit; /* dropped due to lack of space in queue */
__u32 overmemory; /* dropped due to lack of memory in queue */
__u32 ecn_mark; /* packets marked with ecn */
__u32 new_flow_count; /* count of new flows created by packets */
__u32 new_flows_len; /* count of flows in new list */
__u32 old_flows_len; /* count of flows in old list */
__u32 memory_usage; /* total memory across all queues */
};
/* CBS */
struct tc_cbs_qopt {
__u8 offload;

View File

@ -285,6 +285,8 @@ enum
LINUX_MIB_TCPRCVQDROP, /* TCPRcvQDrop */
LINUX_MIB_TCPWQUEUETOOBIG, /* TCPWqueueTooBig */
LINUX_MIB_TCPFASTOPENPASSIVEALTKEY, /* TCPFastOpenPassiveAltKey */
LINUX_MIB_TCPTIMEOUTREHASH, /* TCPTimeoutRehash */
LINUX_MIB_TCPDUPLICATEDATAREHASH, /* TCPDuplicateDataRehash */
__LINUX_MIB_MAX
};

View File

@ -311,6 +311,7 @@ enum {
TCP_NLA_DSACK_DUPS, /* DSACK blocks received */
TCP_NLA_REORD_SEEN, /* reordering events seen */
TCP_NLA_SRTT, /* smoothed RTT in usecs */
TCP_NLA_TIMEOUT_REHASH, /* Timeout-triggered rehash attempts */
};
/* for TCP_MD5SIG socket option */

View File

@ -23,6 +23,7 @@
#include "ip_common.h"
#include "namespace.h"
#include "color.h"
#include "rt_names.h"
int preferred_family = AF_UNSPEC;
int human_readable;
@ -36,7 +37,6 @@ int timestamp;
int force;
int max_flush_loops = 10;
int batch_mode;
int numeric;
bool do_all;
struct rtnl_handle rth = { .fd = -1 };

View File

@ -1651,7 +1651,8 @@ static int show_handler(struct rtnl_ctrl_data *ctrl,
struct ifaddrmsg *ifa = NLMSG_DATA(n);
open_json_object(NULL);
print_int(PRINT_ANY, "index", "if%d:\n", ifa->ifa_index);
print_int(PRINT_ANY, "index", "if%d:", ifa->ifa_index);
print_nl();
print_addrinfo(n, stdout);
close_json_object();
return 0;

View File

@ -183,7 +183,8 @@ static void vlan_print_map(FILE *f,
int rem;
open_json_array(PRINT_JSON, name_json);
print_string(PRINT_FP, NULL, "\n %s { ", name_fp);
print_nl();
print_string(PRINT_FP, NULL, " %s { ", name_fp);
rem = RTA_PAYLOAD(attr);
for (i = RTA_DATA(attr); RTA_OK(i, rem); i = RTA_NEXT(i, rem)) {

View File

@ -20,7 +20,7 @@ static json_writer_t *_jw;
#define _IS_JSON_CONTEXT(type) ((type & PRINT_JSON || type & PRINT_ANY) && _jw)
#define _IS_FP_CONTEXT(type) (!_jw && (type & PRINT_FP || type & PRINT_ANY))
void new_json_obj(int json)
static void __new_json_obj(int json, bool have_array)
{
if (json) {
_jw = jsonw_new(stdout);
@ -30,16 +30,38 @@ void new_json_obj(int json)
}
if (pretty)
jsonw_pretty(_jw, true);
jsonw_start_array(_jw);
if (have_array)
jsonw_start_array(_jw);
}
}
static void __delete_json_obj(bool have_array)
{
if (_jw) {
if (have_array)
jsonw_end_array(_jw);
jsonw_destroy(&_jw);
}
}
void new_json_obj(int json)
{
__new_json_obj(json, true);
}
void delete_json_obj(void)
{
if (_jw) {
jsonw_end_array(_jw);
jsonw_destroy(&_jw);
}
__delete_json_obj(true);
}
void new_json_obj_plain(int json)
{
__new_json_obj(json, false);
}
void delete_json_obj_plain(void)
{
__delete_json_obj(false);
}
bool is_json_context(void)
@ -127,6 +149,19 @@ _PRINT_FUNC(lluint, unsigned long long);
_PRINT_FUNC(float, double);
#undef _PRINT_FUNC
#define _PRINT_NAME_VALUE_FUNC(type_name, type, format_char) \
void print_##type_name##_name_value(const char *name, type value)\
{ \
SPRINT_BUF(format); \
\
snprintf(format, SPRINT_BSIZE, \
"%s %%"#format_char, name); \
print_##type_name(PRINT_ANY, name, format, value); \
}
_PRINT_NAME_VALUE_FUNC(uint, unsigned int, u);
_PRINT_NAME_VALUE_FUNC(string, const char*, s);
#undef _PRINT_NAME_VALUE_FUNC
void print_color_string(enum output_type type,
enum color_attr color,
const char *key,

2
misc/.gitignore vendored
View File

@ -1,7 +1,7 @@
arpd
ifstat
ss
ssfilter.c
ssfilter.tab.c
nstat
lnstat
rtacct

View File

@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0
SSOBJ=ss.o ssfilter.o
SSOBJ=ss.o ssfilter.tab.o
LNSTATOBJ=lnstat.o lnstat_util.o
TARGETS=ss nstat ifstat rtacct lnstat
@ -27,8 +27,8 @@ rtacct: rtacct.c
arpd: arpd.c
$(QUIET_CC)$(CC) $(CFLAGS) -I$(DBM_INCLUDE) $(CPPFLAGS) $(LDFLAGS) -o arpd arpd.c $(LDLIBS) -ldb
ssfilter.c: ssfilter.y
$(QUIET_YACC)bison ssfilter.y -o ssfilter.c
ssfilter.tab.c: ssfilter.y
$(QUIET_YACC)$(YACC) -b ssfilter ssfilter.y
lnstat: $(LNSTATOBJ)
$(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@

View File

@ -35,6 +35,7 @@
#include "libnetlink.h"
#include "namespace.h"
#include "SNAPSHOT.h"
#include "rt_names.h"
#include <linux/tcp.h>
#include <linux/sock_diag.h>
@ -121,7 +122,6 @@ static int follow_events;
static int sctp_ino;
static int show_tipcinfo;
static int show_tos;
int numeric;
int oneline;
enum col_id {

4
tc/.gitignore vendored
View File

@ -1,5 +1,5 @@
*.yacc.c
*.tab.c
*.lex.c
*.output
*.yacc.h
*.tab.h
tc

View File

@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
TCOBJ= tc.o tc_qdisc.o tc_class.o tc_filter.o tc_util.o tc_monitor.o \
tc_exec.o m_police.o m_estimator.o m_action.o m_ematch.o \
emp_ematch.yacc.o emp_ematch.lex.o
emp_ematch.tab.o emp_ematch.lex.o
include ../config.mk
@ -126,7 +126,6 @@ ifneq ($(IPT_LIB_DIR),)
CFLAGS += -DIPT_LIB_DIR=\"$(IPT_LIB_DIR)\"
endif
YACC := bison
LEX := flex
CFLAGS += -DYY_NO_INPUT
@ -159,8 +158,8 @@ install: all
fi
clean:
rm -f $(TCOBJ) $(TCLIB) libtc.a tc *.so emp_ematch.yacc.h; \
rm -f emp_ematch.yacc.*
rm -f $(TCOBJ) $(TCLIB) libtc.a tc *.so emp_ematch.tab.h; \
rm -f emp_ematch.tab.*
q_atm.so: q_atm.c
$(QUIET_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -shared -fpic -o q_atm.so q_atm.c -latm
@ -179,8 +178,8 @@ ifeq ($(TC_CONFIG_XT),y)
LDLIBS += $$($(PKG_CONFIG) xtables --libs)
endif
%.yacc.c: %.y
$(QUIET_YACC)$(YACC) $(YACCFLAGS) -o $@ $<
%.tab.c: %.y
$(QUIET_YACC)$(YACC) $(YACCFLAGS) -p ematch_ -b $(basename $(basename $@)) $<
%.lex.c: %.l
$(QUIET_LEX)$(LEX) $(LEXFLAGS) -o$@ $<
@ -188,7 +187,7 @@ endif
# our lexer includes the header from yacc, so make sure
# we don't attempt to compile it before the header has
# been generated as part of the yacc step.
emp_ematch.lex.o: emp_ematch.yacc.c
emp_ematch.lex.o: emp_ematch.tab.c
ifneq ($(SHARED_LIBS),y)

View File

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 */
%{
#include "emp_ematch.yacc.h"
#include "emp_ematch.tab.h"
#include "m_ematch.h"
extern int ematch_argc;

View File

@ -6,11 +6,6 @@
#include "m_ematch.h"
%}
%locations
%token-table
%define parse.error verbose
%define api.prefix {ematch_}
%union {
unsigned int i;
struct bstr *b;

View File

@ -1599,7 +1599,8 @@ static void flower_print_eth_addr(char *name, struct rtattr *addr_attr,
sprintf(out + done, "/%d", bits);
}
sprintf(namefrm, "\n %s %%s", name);
print_nl();
sprintf(namefrm, " %s %%s", name);
print_string(PRINT_ANY, name, namefrm, out);
}
@ -1744,7 +1745,8 @@ static void flower_print_ip_addr(char *name, __be16 eth_type,
else if (bits < len * 8)
sprintf(out + done, "/%d", bits);
sprintf(namefrm, "\n %s %%s", name);
print_nl();
sprintf(namefrm, " %s %%s", name);
print_string(PRINT_ANY, name, namefrm, out);
}
static void flower_print_ip4_addr(char *name, struct rtattr *addr_attr,
@ -1778,7 +1780,8 @@ static void flower_print_port_range(char *name, struct rtattr *min_attr,
done = sprintf(out, "%u", rta_getattr_be16(min_attr));
sprintf(out + done, "-%u", rta_getattr_be16(max_attr));
sprintf(namefrm, "\n %s %%s", name);
print_nl();
sprintf(namefrm, " %s %%s", name);
print_string(PRINT_ANY, name, namefrm, out);
}
}
@ -1797,8 +1800,8 @@ static void flower_print_tcp_flags(const char *name, struct rtattr *flags_attr,
if (mask_attr)
sprintf(out + done, "/%x", rta_getattr_be16(mask_attr));
print_string(PRINT_FP, NULL, "%s ", _SL_);
sprintf(namefrm, "%s %%s", name);
print_nl();
sprintf(namefrm, " %s %%s", name);
print_string(PRINT_ANY, name, namefrm, out);
}
@ -2086,7 +2089,8 @@ static int flower_print_opt(struct filter_util *qu, FILE *f,
if (tb[TCA_FLOWER_INDEV]) {
struct rtattr *attr = tb[TCA_FLOWER_INDEV];
print_string(PRINT_ANY, "indev", "\n indev %s",
print_nl();
print_string(PRINT_ANY, "indev", " indev %s",
rta_getattr_str(attr));
}
@ -2277,7 +2281,6 @@ static int flower_print_opt(struct filter_util *qu, FILE *f,
print_nl();
print_bool(PRINT_ANY, "skip_sw", " skip_sw", true);
}
if (flags & TCA_CLS_FLAGS_IN_HW) {
print_nl();
print_bool(PRINT_ANY, "in_hw", " in_hw", true);

View File

@ -108,7 +108,7 @@ int prio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
return -1;
print_uint(PRINT_ANY, "bands", "bands %u ", qopt->bands);
open_json_array(PRINT_ANY, "priomap ");
open_json_array(PRINT_ANY, "priomap");
for (i = 0; i <= TC_PRIO_MAX; i++)
print_uint(PRINT_ANY, NULL, " %d", qopt->priomap[i]);
close_json_array(PRINT_ANY, "");

View File

@ -73,7 +73,8 @@ static int skbprio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
if (RTA_PAYLOAD(opt) < sizeof(*qopt))
return -1;
qopt = RTA_DATA(opt);
fprintf(f, "limit %u ", qopt->limit);
print_uint(PRINT_ANY, "limit", "limit %u ", qopt->limit);
return 0;
}

View File

@ -29,6 +29,7 @@
#include "tc_util.h"
#include "tc_common.h"
#include "namespace.h"
#include "rt_names.h"
int show_stats;
int show_details;
@ -43,7 +44,6 @@ bool use_names;
int json;
int color;
int oneline;
int numeric;
static char *conf_file;

View File

@ -179,8 +179,10 @@ static int cmd_node_set_key(struct nlmsghdr *nlh, const struct cmd *cmd,
struct cmdl *cmdl, void *data)
{
struct {
struct tipc_aead_key key;
char mem[TIPC_AEAD_KEYLEN_MAX + 1];
union {
struct tipc_aead_key key;
char mem[TIPC_AEAD_KEY_SIZE_MAX];
};
} input = {};
struct opt opts[] = {
{ "algname", OPT_KEYVAL, NULL },

View File

@ -22,10 +22,10 @@
#include "node.h"
#include "peer.h"
#include "cmdl.h"
#include "utils.h"
int help_flag;
int json;
int pretty;
static void about(struct cmdl *cmdl)
{