Merge branch 'main' into next

Signed-off-by: David Ahern <dsahern@kernel.org>
This commit is contained in:
David Ahern 2021-03-21 17:16:01 +00:00
commit 76bfc185f2
13 changed files with 62 additions and 63 deletions

9
README
View File

@ -28,14 +28,9 @@ The makefile will automatically build a config.mk file which
contains definitions of libraries that may or may not be available
on the system such as: ATM, ELF, MNL, and SELINUX.
3. To make documentation, cd to doc/ directory , then
look at start of Makefile and set correct values for
PAGESIZE=a4 , ie: a4 , letter ... (string)
PAGESPERPAGE=2 , ie: 1 , 2 ... (numeric)
and make there. It assumes, that latex, dvips and psnup
are in your path.
3. include/uapi
4. This package includes matching sanitized kernel headers because
This package includes matching sanitized kernel headers because
the build environment may not have up to date versions. See Makefile
if you have special requirements and need to point at different
kernel include files.

View File

@ -64,10 +64,11 @@ static void usage(void)
fprintf(stderr,
"Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }\n"
" ip [ -force ] -batch filename\n"
"where OBJECT := { link | address | addrlabel | route | rule | neigh | ntable |\n"
" tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm |\n"
" netns | l2tp | fou | macsec | tcp_metrics | token | netconf | ila |\n"
" vrf | sr | nexthop | mptcp }\n"
"where OBJECT := { address | addrlabel | fou | help | ila | l2tp | link |\n"
" macsec | maddress | monitor | mptcp | mroute | mrule |\n"
" neighbor | neighbour | netconf | netns | nexthop | ntable |\n"
" ntbl | route | rule | sr | 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"

View File

@ -39,6 +39,7 @@ int print_neigh(struct nlmsghdr *n, void *arg);
int ipaddr_list_link(int argc, char **argv);
void ipaddr_get_vf_rate(int, int *, int *, const char *);
void iplink_usage(void) __attribute__((noreturn));
void iplink_types_usage(void);
void iproute_reset_filter(int ifindex);
void ipmroute_reset_filter(int ifindex);

View File

@ -73,12 +73,8 @@ static void usage(void)
"CONFFLAG-LIST := [ CONFFLAG-LIST ] CONFFLAG\n"
"CONFFLAG := [ home | nodad | mngtmpaddr | noprefixroute | autojoin ]\n"
"LIFETIME := [ valid_lft LFT ] [ preferred_lft LFT ]\n"
"LFT := forever | SECONDS\n"
"TYPE := { vlan | veth | vcan | vxcan | dummy | ifb | macvlan | macvtap |\n"
" bridge | bond | ipoib | ip6tnl | ipip | sit | vxlan | lowpan |\n"
" gre | gretap | erspan | ip6gre | ip6gretap | ip6erspan | vti |\n"
" nlmon | can | bond_slave | ipvlan | geneve | bridge_slave |\n"
" hsr | macsec | netdevsim }\n");
"LFT := forever | SECONDS\n");
iplink_types_usage();
exit(-1);
}

View File

@ -31,7 +31,8 @@ static void usage(void)
"Usage: ip ila add loc_match LOCATOR_MATCH loc LOCATOR [ dev DEV ] OPTIONS\n"
" ip ila del loc_match LOCATOR_MATCH [ loc LOCATOR ] [ dev DEV ]\n"
" ip ila list\n"
"OPTIONS := [ csum-mode { adj-transport | neutral-map | neutral-map-auto | no-action } ]\n"
"OPTIONS := [ csum-mode { adj-transport | neutral-map |\n"
" neutral-map-auto | no-action } ]\n"
" [ ident-type { luid | use-format } ]\n");
exit(-1);

View File

@ -46,6 +46,19 @@
static void usage(void) __attribute__((noreturn));
static int iplink_have_newlink(void);
void iplink_types_usage(void)
{
/* Remember to add new entry here if new type is added. */
fprintf(stderr,
"TYPE := { bareudp | bond | bond_slave | bridge | bridge_slave |\n"
" dummy | erspan | geneve | gre | gretap | ifb |\n"
" ip6erspan | ip6gre | ip6gretap | ip6tnl |\n"
" ipip | ipoib | ipvlan | ipvtap |\n"
" macsec | macvlan | macvtap |\n"
" netdevsim | nlmon | rmnet | sit | team | team_slave |\n"
" vcan | veth | vlan | vrf | vti | vxcan | vxlan | xfrm }\n");
}
void iplink_usage(void)
{
if (iplink_have_newlink()) {
@ -117,13 +130,8 @@ void iplink_usage(void)
fprintf(stderr,
"\n"
" ip link help [ TYPE ]\n"
"\n"
"TYPE := { vlan | veth | vcan | vxcan | dummy | ifb | macvlan | macvtap |\n"
" bridge | bond | team | ipoib | ip6tnl | ipip | sit | vxlan |\n"
" gre | gretap | erspan | ip6gre | ip6gretap | ip6erspan |\n"
" vti | nlmon | team_slave | bond_slave | bridge_slave |\n"
" ipvlan | ipvtap | geneve | bareudp | vrf | macsec | netdevsim | rmnet |\n"
" xfrm }\n");
"\n");
iplink_types_usage();
}
exit(-1);
}

View File

@ -30,9 +30,10 @@ int listen_all_nsid;
static void usage(void)
{
fprintf(stderr,
"Usage: ip monitor [ all | LISTofOBJECTS ] [ FILE ] [ label ] [all-nsid] [dev DEVICE]\n"
"LISTofOBJECTS := link | address | route | mroute | prefix |\n"
" neigh | netconf | rule | nsid | nexthop\n"
"Usage: ip monitor [ all | OBJECTS ] [ FILE ] [ label ] [ all-nsid ]\n"
" [ dev DEVICE ]\n"
"OBJECTS := address | link | mroute | neigh | netconf |\n"
" nexthop | nsid | prefix | route | rule\n"
"FILE := file FILENAME\n");
exit(-1);
}

View File

@ -50,15 +50,15 @@ static void usage(void)
{
fprintf(stderr,
"Usage: ip neigh { add | del | change | replace }\n"
" { ADDR [ lladdr LLADDR ] [ nud STATE ] | proxy ADDR } [ dev DEV ]\n"
" [ router ] [ extern_learn ] [ protocol PROTO ]\n"
" { ADDR [ lladdr LLADDR ] [ nud STATE ] proxy ADDR }\n"
" [ dev DEV ] [ router ] [ extern_learn ] [ protocol PROTO ]\n"
"\n"
" ip neigh { show | flush } [ proxy ] [ to PREFIX ] [ dev DEV ] [ nud STATE ]\n"
" [ vrf NAME ]\n"
" ip neigh get { ADDR | proxy ADDR } dev DEV\n"
"\n"
"STATE := { permanent | noarp | stale | reachable | none |\n"
" incomplete | delay | probe | failed }\n");
"STATE := { delay | failed | incomplete | noarp | none |\n"
" permanent | probe | reachable | stale }\n");
exit(-1);
}

View File

@ -44,7 +44,8 @@ static void usage(void)
"Usage: ip rule { add | del } SELECTOR ACTION\n"
" ip rule { flush | save | restore }\n"
" ip rule [ list [ SELECTOR ]]\n"
"SELECTOR := [ not ] [ from PREFIX ] [ to PREFIX ] [ tos TOS ] [ fwmark FWMARK[/MASK] ]\n"
"SELECTOR := [ not ] [ from PREFIX ] [ to PREFIX ] [ tos TOS ]\n"
" [ fwmark FWMARK[/MASK] ]\n"
" [ iif STRING ] [ oif STRING ] [ pref NUMBER ] [ l3mdev ]\n"
" [ uidrange NUMBER-NUMBER ]\n"
" [ ipproto PROTOCOL ]\n"

View File

@ -34,7 +34,8 @@ static void usage(void)
{
fprintf(stderr,
"Usage: ip tunnel { add | change | del | show | prl | 6rd } [ NAME ]\n"
" [ mode { ipip | gre | sit | isatap | vti } ] [ remote ADDR ] [ local ADDR ]\n"
" [ mode { gre | ipip | isatap | sit | vti } ]\n"
" [ remote ADDR ] [ local ADDR ]\n"
" [ [i|o]seq ] [ [i|o]key KEY ] [ [i|o]csum ]\n"
" [ prl-default ADDR ] [ prl-nodefault ADDR ] [ prl-delete ADDR ]\n"
" [ 6rd-prefix ADDR ] [ 6rd-relay_prefix ADDR ] [ 6rd-reset ]\n"

View File

@ -924,6 +924,19 @@ static int xfrm_selector_iszero(struct xfrm_selector *s)
return (memcmp(&s0, s, sizeof(s0)) == 0);
}
static void xfrm_sec_ctx_print(FILE *fp, struct rtattr *attr)
{
struct xfrm_user_sec_ctx *sctx;
fprintf(fp, "\tsecurity context ");
if (RTA_PAYLOAD(attr) < sizeof(*sctx))
fprintf(fp, "(ERROR truncated)");
sctx = RTA_DATA(attr);
fprintf(fp, "%.*s %s", sctx->ctx_len, (char *)(sctx + 1), _SL_);
}
void xfrm_state_info_print(struct xfrm_usersa_info *xsinfo,
struct rtattr *tb[], FILE *fp, const char *prefix,
const char *title, bool nokeys)
@ -991,19 +1004,8 @@ void xfrm_state_info_print(struct xfrm_usersa_info *xsinfo,
xfrm_stats_print(&xsinfo->stats, fp, buf);
}
if (tb[XFRMA_SEC_CTX]) {
struct xfrm_user_sec_ctx *sctx;
fprintf(fp, "\tsecurity context ");
if (RTA_PAYLOAD(tb[XFRMA_SEC_CTX]) < sizeof(*sctx))
fprintf(fp, "(ERROR truncated)");
sctx = RTA_DATA(tb[XFRMA_SEC_CTX]);
fprintf(fp, "%s %s", (char *)(sctx + 1), _SL_);
}
if (tb[XFRMA_SEC_CTX])
xfrm_sec_ctx_print(fp, tb[XFRMA_SEC_CTX]);
}
void xfrm_policy_info_print(struct xfrm_userpolicy_info *xpinfo,
@ -1014,19 +1016,8 @@ void xfrm_policy_info_print(struct xfrm_userpolicy_info *xpinfo,
xfrm_selector_print(&xpinfo->sel, preferred_family, fp, title);
if (tb[XFRMA_SEC_CTX]) {
struct xfrm_user_sec_ctx *sctx;
fprintf(fp, "\tsecurity context ");
if (RTA_PAYLOAD(tb[XFRMA_SEC_CTX]) < sizeof(*sctx))
fprintf(fp, "(ERROR truncated)");
sctx = RTA_DATA(tb[XFRMA_SEC_CTX]);
fprintf(fp, "%s ", (char *)(sctx + 1));
fprintf(fp, "%s", _SL_);
}
if (tb[XFRMA_SEC_CTX])
xfrm_sec_ctx_print(fp, tb[XFRMA_SEC_CTX]);
if (prefix)
strlcat(buf, prefix, sizeof(buf));

View File

@ -4,6 +4,8 @@
* Authors: Hangbin Liu <haliu@redhat.com>
*
*/
#include <limits.h>
#include "bpf_util.h"
#ifdef HAVE_LIBBPF
#include <bpf/bpf.h>

View File

@ -13,6 +13,7 @@
#include <stdint.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <libelf.h>
#include <gelf.h>