mirror of
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git
synced 2024-11-16 14:35:34 +08:00
Merge branch 'master' into net-next
This commit is contained in:
commit
9a6422c243
@ -19,7 +19,7 @@ static inline void *dlopen(const char *file, int flag)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
extern void *_dlsym(const char *sym);
|
||||
void *_dlsym(const char *sym);
|
||||
static inline void *dlsym(void *handle, const char *sym)
|
||||
{
|
||||
if (handle != _FAKE_DLFCN_HDL)
|
||||
|
@ -26,20 +26,20 @@ struct rtnl_handle
|
||||
|
||||
extern int rcvbuf;
|
||||
|
||||
extern int rtnl_open(struct rtnl_handle *rth, unsigned subscriptions)
|
||||
int rtnl_open(struct rtnl_handle *rth, unsigned subscriptions)
|
||||
__attribute__((warn_unused_result));
|
||||
|
||||
extern int rtnl_open_byproto(struct rtnl_handle *rth, unsigned subscriptions,
|
||||
int rtnl_open_byproto(struct rtnl_handle *rth, unsigned subscriptions,
|
||||
int protocol)
|
||||
__attribute__((warn_unused_result));
|
||||
|
||||
extern void rtnl_close(struct rtnl_handle *rth);
|
||||
extern int rtnl_wilddump_request(struct rtnl_handle *rth, int fam, int type)
|
||||
void rtnl_close(struct rtnl_handle *rth);
|
||||
int rtnl_wilddump_request(struct rtnl_handle *rth, int fam, int type)
|
||||
__attribute__((warn_unused_result));
|
||||
extern int rtnl_wilddump_req_filter(struct rtnl_handle *rth, int fam, int type,
|
||||
int rtnl_wilddump_req_filter(struct rtnl_handle *rth, int fam, int type,
|
||||
__u32 filt_mask)
|
||||
__attribute__((warn_unused_result));
|
||||
extern int rtnl_dump_request(struct rtnl_handle *rth, int type, void *req,
|
||||
int rtnl_dump_request(struct rtnl_handle *rth, int type, void *req,
|
||||
int len)
|
||||
__attribute__((warn_unused_result));
|
||||
|
||||
@ -60,40 +60,43 @@ struct rtnl_dump_filter_arg
|
||||
void *arg1;
|
||||
};
|
||||
|
||||
extern int rtnl_dump_filter_l(struct rtnl_handle *rth,
|
||||
int rtnl_dump_filter_l(struct rtnl_handle *rth,
|
||||
const struct rtnl_dump_filter_arg *arg);
|
||||
extern int rtnl_dump_filter(struct rtnl_handle *rth, rtnl_filter_t filter,
|
||||
void *arg);
|
||||
extern int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
|
||||
struct nlmsghdr *answer, size_t len)
|
||||
int rtnl_dump_filter(struct rtnl_handle *rth, rtnl_filter_t filter, void *arg);
|
||||
int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
|
||||
struct nlmsghdr *answer, size_t len)
|
||||
__attribute__((warn_unused_result));
|
||||
extern int rtnl_send(struct rtnl_handle *rth, const void *buf, int)
|
||||
int rtnl_send(struct rtnl_handle *rth, const void *buf, int)
|
||||
__attribute__((warn_unused_result));
|
||||
extern int rtnl_send_check(struct rtnl_handle *rth, const void *buf, int)
|
||||
int rtnl_send_check(struct rtnl_handle *rth, const void *buf, int)
|
||||
__attribute__((warn_unused_result));
|
||||
|
||||
extern int addattr(struct nlmsghdr *n, int maxlen, int type);
|
||||
extern int addattr8(struct nlmsghdr *n, int maxlen, int type, __u8 data);
|
||||
extern int addattr16(struct nlmsghdr *n, int maxlen, int type, __u16 data);
|
||||
extern int addattr32(struct nlmsghdr *n, int maxlen, int type, __u32 data);
|
||||
extern int addattr64(struct nlmsghdr *n, int maxlen, int type, __u64 data);
|
||||
extern int addattrstrz(struct nlmsghdr *n, int maxlen, int type, const char *data);
|
||||
int addattr(struct nlmsghdr *n, int maxlen, int type);
|
||||
int addattr8(struct nlmsghdr *n, int maxlen, int type, __u8 data);
|
||||
int addattr16(struct nlmsghdr *n, int maxlen, int type, __u16 data);
|
||||
int addattr32(struct nlmsghdr *n, int maxlen, int type, __u32 data);
|
||||
int addattr64(struct nlmsghdr *n, int maxlen, int type, __u64 data);
|
||||
int addattrstrz(struct nlmsghdr *n, int maxlen, int type, const char *data);
|
||||
|
||||
extern int addattr_l(struct nlmsghdr *n, int maxlen, int type, const void *data, int alen);
|
||||
extern int addraw_l(struct nlmsghdr *n, int maxlen, const void *data, int len);
|
||||
extern struct rtattr *addattr_nest(struct nlmsghdr *n, int maxlen, int type);
|
||||
extern int addattr_nest_end(struct nlmsghdr *n, struct rtattr *nest);
|
||||
extern struct rtattr *addattr_nest_compat(struct nlmsghdr *n, int maxlen, int type, const void *data, int len);
|
||||
extern int addattr_nest_compat_end(struct nlmsghdr *n, struct rtattr *nest);
|
||||
extern int rta_addattr32(struct rtattr *rta, int maxlen, int type, __u32 data);
|
||||
extern int rta_addattr_l(struct rtattr *rta, int maxlen, int type, const void *data, int alen);
|
||||
int addattr_l(struct nlmsghdr *n, int maxlen, int type,
|
||||
const void *data, int alen);
|
||||
int addraw_l(struct nlmsghdr *n, int maxlen, const void *data, int len);
|
||||
struct rtattr *addattr_nest(struct nlmsghdr *n, int maxlen, int type);
|
||||
int addattr_nest_end(struct nlmsghdr *n, struct rtattr *nest);
|
||||
struct rtattr *addattr_nest_compat(struct nlmsghdr *n, int maxlen, int type,
|
||||
const void *data, int len);
|
||||
int addattr_nest_compat_end(struct nlmsghdr *n, struct rtattr *nest);
|
||||
int rta_addattr32(struct rtattr *rta, int maxlen, int type, __u32 data);
|
||||
int rta_addattr_l(struct rtattr *rta, int maxlen, int type,
|
||||
const void *data, int alen);
|
||||
|
||||
extern int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len);
|
||||
extern int parse_rtattr_flags(struct rtattr *tb[], int max, struct rtattr *rta,
|
||||
int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len);
|
||||
int parse_rtattr_flags(struct rtattr *tb[], int max, struct rtattr *rta,
|
||||
int len, unsigned short flags);
|
||||
extern int parse_rtattr_byindex(struct rtattr *tb[], int max, struct rtattr *rta, int len);
|
||||
extern struct rtattr *parse_rtattr_one(int type, struct rtattr *rta, int len);
|
||||
extern int __parse_rtattr_nested_compat(struct rtattr *tb[], int max, struct rtattr *rta, int len);
|
||||
int parse_rtattr_byindex(struct rtattr *tb[], int max,
|
||||
struct rtattr *rta, int len);
|
||||
struct rtattr *parse_rtattr_one(int type, struct rtattr *rta, int len);
|
||||
int __parse_rtattr_nested_compat(struct rtattr *tb[], int max, struct rtattr *rta, int len);
|
||||
|
||||
#define parse_rtattr_nested(tb, max, rta) \
|
||||
(parse_rtattr((tb), (max), RTA_DATA(rta), RTA_PAYLOAD(rta)))
|
||||
@ -128,11 +131,11 @@ static inline const char *rta_getattr_str(const struct rtattr *rta)
|
||||
return (const char *)RTA_DATA(rta);
|
||||
}
|
||||
|
||||
extern int rtnl_listen_all_nsid(struct rtnl_handle *);
|
||||
extern int rtnl_listen(struct rtnl_handle *, rtnl_listen_filter_t handler,
|
||||
void *jarg);
|
||||
extern int rtnl_from_file(FILE *, rtnl_listen_filter_t handler,
|
||||
void *jarg);
|
||||
int rtnl_listen_all_nsid(struct rtnl_handle *);
|
||||
int rtnl_listen(struct rtnl_handle *, rtnl_listen_filter_t handler,
|
||||
void *jarg);
|
||||
int rtnl_from_file(FILE *, rtnl_listen_filter_t handler,
|
||||
void *jarg);
|
||||
|
||||
#define NLMSG_TAIL(nmsg) \
|
||||
((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len)))
|
||||
|
@ -1,15 +1,15 @@
|
||||
#ifndef __LL_MAP_H__
|
||||
#define __LL_MAP_H__ 1
|
||||
|
||||
extern int ll_remember_index(const struct sockaddr_nl *who,
|
||||
struct nlmsghdr *n, void *arg);
|
||||
int ll_remember_index(const struct sockaddr_nl *who,
|
||||
struct nlmsghdr *n, void *arg);
|
||||
|
||||
extern void ll_init_map(struct rtnl_handle *rth);
|
||||
extern unsigned ll_name_to_index(const char *name);
|
||||
extern const char *ll_index_to_name(unsigned idx);
|
||||
extern const char *ll_idx_n2a(unsigned idx, char *buf);
|
||||
extern int ll_index_to_type(unsigned idx);
|
||||
extern int ll_index_to_flags(unsigned idx);
|
||||
extern unsigned namehash(const char *str);
|
||||
void ll_init_map(struct rtnl_handle *rth);
|
||||
unsigned ll_name_to_index(const char *name);
|
||||
const char *ll_index_to_name(unsigned idx);
|
||||
const char *ll_idx_n2a(unsigned idx, char *buf);
|
||||
int ll_index_to_type(unsigned idx);
|
||||
int ll_index_to_flags(unsigned idx);
|
||||
unsigned namehash(const char *str);
|
||||
|
||||
#endif /* __LL_MAP_H__ */
|
||||
|
@ -43,9 +43,9 @@ static inline int setns(int fd, int nstype)
|
||||
}
|
||||
#endif /* HAVE_SETNS */
|
||||
|
||||
extern int netns_switch(char *netns);
|
||||
extern int netns_get_fd(const char *netns);
|
||||
extern int netns_foreach(int (*func)(char *nsname, void *arg), void *arg);
|
||||
int netns_switch(char *netns);
|
||||
int netns_get_fd(const char *netns);
|
||||
int netns_foreach(int (*func)(char *nsname, void *arg), void *arg);
|
||||
|
||||
struct netns_func {
|
||||
int (*func)(char *nsname, void *arg);
|
||||
|
@ -42,7 +42,7 @@ extern bool do_all;
|
||||
#define SPRINT_BSIZE 64
|
||||
#define SPRINT_BUF(x) char x[SPRINT_BSIZE]
|
||||
|
||||
extern void incomplete_command(void) __attribute__((noreturn));
|
||||
void incomplete_command(void) __attribute__((noreturn));
|
||||
|
||||
#define NEXT_ARG() do { argv++; if (--argc <= 0) incomplete_command(); } while(0)
|
||||
#define NEXT_ARG_OK() (argc - 1 > 0)
|
||||
@ -85,47 +85,47 @@ struct ipx_addr {
|
||||
/* Maximum number of labels the mpls helpers support */
|
||||
#define MPLS_MAX_LABELS 8
|
||||
|
||||
extern __u32 get_addr32(const char *name);
|
||||
extern int get_addr_1(inet_prefix *dst, const char *arg, int family);
|
||||
extern int get_prefix_1(inet_prefix *dst, char *arg, int family);
|
||||
extern int get_addr(inet_prefix *dst, const char *arg, int family);
|
||||
extern int get_prefix(inet_prefix *dst, char *arg, int family);
|
||||
extern int mask2bits(__u32 netmask);
|
||||
__u32 get_addr32(const char *name);
|
||||
int get_addr_1(inet_prefix *dst, const char *arg, int family);
|
||||
int get_prefix_1(inet_prefix *dst, char *arg, int family);
|
||||
int get_addr(inet_prefix *dst, const char *arg, int family);
|
||||
int get_prefix(inet_prefix *dst, char *arg, int family);
|
||||
int mask2bits(__u32 netmask);
|
||||
|
||||
extern int get_integer(int *val, const char *arg, int base);
|
||||
extern int get_unsigned(unsigned *val, const char *arg, int base);
|
||||
extern int get_time_rtt(unsigned *val, const char *arg, int *raw);
|
||||
int get_integer(int *val, const char *arg, int base);
|
||||
int get_unsigned(unsigned *val, const char *arg, int base);
|
||||
int get_time_rtt(unsigned *val, const char *arg, int *raw);
|
||||
#define get_byte get_u8
|
||||
#define get_ushort get_u16
|
||||
#define get_short get_s16
|
||||
extern int get_u64(__u64 *val, const char *arg, int base);
|
||||
extern int get_u32(__u32 *val, const char *arg, int base);
|
||||
extern int get_s32(__s32 *val, const char *arg, int base);
|
||||
extern int get_u16(__u16 *val, const char *arg, int base);
|
||||
extern int get_s16(__s16 *val, const char *arg, int base);
|
||||
extern int get_u8(__u8 *val, const char *arg, int base);
|
||||
extern int get_s8(__s8 *val, const char *arg, int base);
|
||||
int get_u64(__u64 *val, const char *arg, int base);
|
||||
int get_u32(__u32 *val, const char *arg, int base);
|
||||
int get_s32(__s32 *val, const char *arg, int base);
|
||||
int get_u16(__u16 *val, const char *arg, int base);
|
||||
int get_s16(__s16 *val, const char *arg, int base);
|
||||
int get_u8(__u8 *val, const char *arg, int base);
|
||||
int get_s8(__s8 *val, const char *arg, int base);
|
||||
|
||||
extern char* hexstring_n2a(const __u8 *str, int len, char *buf, int blen);
|
||||
extern __u8* hexstring_a2n(const char *str, __u8 *buf, int blen);
|
||||
char* hexstring_n2a(const __u8 *str, int len, char *buf, int blen);
|
||||
__u8* hexstring_a2n(const char *str, __u8 *buf, int blen);
|
||||
|
||||
extern int af_bit_len(int af);
|
||||
extern int af_byte_len(int af);
|
||||
int af_bit_len(int af);
|
||||
int af_byte_len(int af);
|
||||
|
||||
extern const char *format_host(int af, int len, const void *addr,
|
||||
const char *format_host(int af, int len, const void *addr,
|
||||
char *buf, int buflen);
|
||||
extern const char *rt_addr_n2a(int af, int len, const void *addr,
|
||||
const char *rt_addr_n2a(int af, int len, const void *addr,
|
||||
char *buf, int buflen);
|
||||
|
||||
extern int read_family(const char *name);
|
||||
extern const char *family_name(int family);
|
||||
int read_family(const char *name);
|
||||
const char *family_name(int family);
|
||||
|
||||
void missarg(const char *) __attribute__((noreturn));
|
||||
void invarg(const char *, const char *) __attribute__((noreturn));
|
||||
void duparg(const char *, const char *) __attribute__((noreturn));
|
||||
void duparg2(const char *, const char *) __attribute__((noreturn));
|
||||
int matches(const char *arg, const char *pattern);
|
||||
extern int inet_addr_match(const inet_prefix *a, const inet_prefix *b, int bits);
|
||||
int inet_addr_match(const inet_prefix *a, const inet_prefix *b, int bits);
|
||||
|
||||
const char *dnet_ntop(int af, const void *addr, char *str, size_t len);
|
||||
int dnet_pton(int af, const char *src, void *addr);
|
||||
@ -137,7 +137,7 @@ const char *mpls_ntop(int af, const void *addr, char *str, size_t len);
|
||||
int mpls_pton(int af, const char *src, void *addr);
|
||||
|
||||
extern int __iproute2_hz_internal;
|
||||
extern int __get_hz(void);
|
||||
int __get_hz(void);
|
||||
|
||||
static __inline__ int get_hz(void)
|
||||
{
|
||||
@ -147,7 +147,7 @@ static __inline__ int get_hz(void)
|
||||
}
|
||||
|
||||
extern int __iproute2_user_hz_internal;
|
||||
extern int __get_user_hz(void);
|
||||
int __get_user_hz(void);
|
||||
|
||||
static __inline__ int get_user_hz(void)
|
||||
{
|
||||
@ -191,16 +191,16 @@ void print_nlmsg_timestamp(FILE *fp, const struct nlmsghdr *n);
|
||||
#endif
|
||||
|
||||
extern int cmdlineno;
|
||||
extern ssize_t getcmdline(char **line, size_t *len, FILE *in);
|
||||
extern int makeargs(char *line, char *argv[], int maxargs);
|
||||
extern int inet_get_addr(const char *src, __u32 *dst, struct in6_addr *dst6);
|
||||
ssize_t getcmdline(char **line, size_t *len, FILE *in);
|
||||
int makeargs(char *line, char *argv[], int maxargs);
|
||||
int inet_get_addr(const char *src, __u32 *dst, struct in6_addr *dst6);
|
||||
|
||||
struct iplink_req;
|
||||
int iplink_parse(int argc, char **argv, struct iplink_req *req,
|
||||
char **name, char **type, char **link, char **dev,
|
||||
int *group, int *index);
|
||||
|
||||
extern int do_each_netns(int (*func)(char *nsname, void *arg), void *arg,
|
||||
int do_each_netns(int (*func)(char *nsname, void *arg), void *arg,
|
||||
bool show_label);
|
||||
|
||||
char *int_to_str(int val, char *buf);
|
||||
|
4
ip/ip.c
4
ip/ip.c
@ -48,8 +48,8 @@ static void usage(void)
|
||||
fprintf(stderr,
|
||||
"Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }\n"
|
||||
" ip [ -force ] -batch filename\n"
|
||||
"where OBJECT := { link | addr | addrlabel | route | rule | neigh | ntable |\n"
|
||||
" tunnel | tuntap | maddr | mroute | mrule | monitor | xfrm |\n"
|
||||
"where OBJECT := { link | address | addrlabel | route | rule | neighbor | ntable |\n"
|
||||
" tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm |\n"
|
||||
" netns | l2tp | fou | tcp_metrics | token | netconf }\n"
|
||||
" OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |\n"
|
||||
" -h[uman-readable] | -iec |\n"
|
||||
|
@ -71,15 +71,15 @@ static void usage(void)
|
||||
if (do_link) {
|
||||
iplink_usage();
|
||||
}
|
||||
fprintf(stderr, "Usage: ip addr {add|change|replace} IFADDR dev STRING [ LIFETIME ]\n");
|
||||
fprintf(stderr, "Usage: ip address {add|change|replace} IFADDR dev IFNAME [ LIFETIME ]\n");
|
||||
fprintf(stderr, " [ CONFFLAG-LIST ]\n");
|
||||
fprintf(stderr, " ip addr del IFADDR dev STRING [mngtmpaddr]\n");
|
||||
fprintf(stderr, " ip addr {show|save|flush} [ dev STRING ] [ scope SCOPE-ID ]\n");
|
||||
fprintf(stderr, " [ to PREFIX ] [ FLAG-LIST ] [ label PATTERN ] [up]\n");
|
||||
fprintf(stderr, " ip addr {showdump|restore}\n");
|
||||
fprintf(stderr, " ip address del IFADDR dev IFNAME [mngtmpaddr]\n");
|
||||
fprintf(stderr, " ip address {show|save|flush} [ dev IFNAME ] [ scope SCOPE-ID ]\n");
|
||||
fprintf(stderr, " [ to PREFIX ] [ FLAG-LIST ] [ label LABEL ] [up]\n");
|
||||
fprintf(stderr, " ip address {showdump|restore}\n");
|
||||
fprintf(stderr, "IFADDR := PREFIX | ADDR peer PREFIX\n");
|
||||
fprintf(stderr, " [ broadcast ADDR ] [ anycast ADDR ]\n");
|
||||
fprintf(stderr, " [ label STRING ] [ scope SCOPE-ID ]\n");
|
||||
fprintf(stderr, " [ label IFNAME ] [ scope SCOPE-ID ]\n");
|
||||
fprintf(stderr, "SCOPE-ID := [ host | link | global | NUMBER ]\n");
|
||||
fprintf(stderr, "FLAG-LIST := [ FLAG-LIST ] FLAG\n");
|
||||
fprintf(stderr, "FLAG := [ permanent | dynamic | secondary | primary |\n");
|
||||
@ -1131,7 +1131,7 @@ static int ipadd_dump_check_magic(void)
|
||||
__u32 magic = 0;
|
||||
|
||||
if (isatty(STDIN_FILENO)) {
|
||||
fprintf(stderr, "Can't restore addr dump from a terminal\n");
|
||||
fprintf(stderr, "Can't restore address dump from a terminal\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1883,6 +1883,6 @@ int do_ipaddr(int argc, char **argv)
|
||||
return ipaddr_restore();
|
||||
if (matches(*argv, "help") == 0)
|
||||
usage();
|
||||
fprintf(stderr, "Command \"%s\" is unknown, try \"ip addr help\".\n", *argv);
|
||||
fprintf(stderr, "Command \"%s\" is unknown, try \"ip address help\".\n", *argv);
|
||||
exit(-1);
|
||||
}
|
||||
|
@ -330,7 +330,7 @@ static int iplink_parse_vf(int vf, int *argcp, char ***argvp,
|
||||
else if (matches(*argv, "off") == 0)
|
||||
ivs.setting = 0;
|
||||
else
|
||||
invarg("Invalid \"spoofchk\" value\n", *argv);
|
||||
return on_off("spoofchk", *argv);
|
||||
ivs.vf = vf;
|
||||
addattr_l(&req->n, sizeof(*req), IFLA_VF_SPOOFCHK, &ivs, sizeof(ivs));
|
||||
|
||||
@ -342,7 +342,7 @@ static int iplink_parse_vf(int vf, int *argcp, char ***argvp,
|
||||
else if (matches(*argv, "off") == 0)
|
||||
ivs.setting = 0;
|
||||
else
|
||||
invarg("Invalid \"query_rss\" value\n", *argv);
|
||||
return on_off("query_rss", *argv);
|
||||
ivs.vf = vf;
|
||||
addattr_l(&req->n, sizeof(*req), IFLA_VF_RSS_QUERY_EN, &ivs, sizeof(ivs));
|
||||
|
||||
@ -1105,7 +1105,7 @@ static int do_set(int argc, char **argv)
|
||||
} else if (strcmp(*argv, "off") == 0) {
|
||||
flags |= IFF_NOARP;
|
||||
} else
|
||||
return on_off("noarp", *argv);
|
||||
return on_off("arp", *argv);
|
||||
} else if (matches(*argv, "dynamic") == 0) {
|
||||
NEXT_ARG();
|
||||
mask |= IFF_DYNAMIC;
|
||||
|
@ -171,10 +171,8 @@ static int bond_parse_opt(struct link_util *lu, int argc, char **argv,
|
||||
while (argc > 0) {
|
||||
if (matches(*argv, "mode") == 0) {
|
||||
NEXT_ARG();
|
||||
if (get_index(mode_tbl, *argv) < 0) {
|
||||
if (get_index(mode_tbl, *argv) < 0)
|
||||
invarg("invalid mode", *argv);
|
||||
return -1;
|
||||
}
|
||||
mode = get_index(mode_tbl, *argv);
|
||||
addattr8(n, 1024, IFLA_BOND_MODE, mode);
|
||||
} else if (matches(*argv, "active_slave") == 0) {
|
||||
@ -187,38 +185,28 @@ static int bond_parse_opt(struct link_util *lu, int argc, char **argv,
|
||||
addattr32(n, 1024, IFLA_BOND_ACTIVE_SLAVE, 0);
|
||||
} else if (matches(*argv, "miimon") == 0) {
|
||||
NEXT_ARG();
|
||||
if (get_u32(&miimon, *argv, 0)) {
|
||||
if (get_u32(&miimon, *argv, 0))
|
||||
invarg("invalid miimon", *argv);
|
||||
return -1;
|
||||
}
|
||||
addattr32(n, 1024, IFLA_BOND_MIIMON, miimon);
|
||||
} else if (matches(*argv, "updelay") == 0) {
|
||||
NEXT_ARG();
|
||||
if (get_u32(&updelay, *argv, 0)) {
|
||||
if (get_u32(&updelay, *argv, 0))
|
||||
invarg("invalid updelay", *argv);
|
||||
return -1;
|
||||
}
|
||||
addattr32(n, 1024, IFLA_BOND_UPDELAY, updelay);
|
||||
} else if (matches(*argv, "downdelay") == 0) {
|
||||
NEXT_ARG();
|
||||
if (get_u32(&downdelay, *argv, 0)) {
|
||||
if (get_u32(&downdelay, *argv, 0))
|
||||
invarg("invalid downdelay", *argv);
|
||||
return -1;
|
||||
}
|
||||
addattr32(n, 1024, IFLA_BOND_DOWNDELAY, downdelay);
|
||||
} else if (matches(*argv, "use_carrier") == 0) {
|
||||
NEXT_ARG();
|
||||
if (get_u8(&use_carrier, *argv, 0)) {
|
||||
if (get_u8(&use_carrier, *argv, 0))
|
||||
invarg("invalid use_carrier", *argv);
|
||||
return -1;
|
||||
}
|
||||
addattr8(n, 1024, IFLA_BOND_USE_CARRIER, use_carrier);
|
||||
} else if (matches(*argv, "arp_interval") == 0) {
|
||||
NEXT_ARG();
|
||||
if (get_u32(&arp_interval, *argv, 0)) {
|
||||
if (get_u32(&arp_interval, *argv, 0))
|
||||
invarg("invalid arp_interval", *argv);
|
||||
return -1;
|
||||
}
|
||||
addattr32(n, 1024, IFLA_BOND_ARP_INTERVAL, arp_interval);
|
||||
} else if (matches(*argv, "arp_ip_target") == 0) {
|
||||
struct rtattr * nest = addattr_nest(n, 1024,
|
||||
@ -239,18 +227,14 @@ static int bond_parse_opt(struct link_util *lu, int argc, char **argv,
|
||||
addattr_nest_end(n, nest);
|
||||
} else if (matches(*argv, "arp_validate") == 0) {
|
||||
NEXT_ARG();
|
||||
if (get_index(arp_validate_tbl, *argv) < 0) {
|
||||
if (get_index(arp_validate_tbl, *argv) < 0)
|
||||
invarg("invalid arp_validate", *argv);
|
||||
return -1;
|
||||
}
|
||||
arp_validate = get_index(arp_validate_tbl, *argv);
|
||||
addattr32(n, 1024, IFLA_BOND_ARP_VALIDATE, arp_validate);
|
||||
} else if (matches(*argv, "arp_all_targets") == 0) {
|
||||
NEXT_ARG();
|
||||
if (get_index(arp_all_targets_tbl, *argv) < 0) {
|
||||
if (get_index(arp_all_targets_tbl, *argv) < 0)
|
||||
invarg("invalid arp_all_targets", *argv);
|
||||
return -1;
|
||||
}
|
||||
arp_all_targets = get_index(arp_all_targets_tbl, *argv);
|
||||
addattr32(n, 1024, IFLA_BOND_ARP_ALL_TARGETS, arp_all_targets);
|
||||
} else if (matches(*argv, "primary") == 0) {
|
||||
@ -261,108 +245,93 @@ static int bond_parse_opt(struct link_util *lu, int argc, char **argv,
|
||||
addattr32(n, 1024, IFLA_BOND_PRIMARY, ifindex);
|
||||
} else if (matches(*argv, "primary_reselect") == 0) {
|
||||
NEXT_ARG();
|
||||
if (get_index(primary_reselect_tbl, *argv) < 0) {
|
||||
if (get_index(primary_reselect_tbl, *argv) < 0)
|
||||
invarg("invalid primary_reselect", *argv);
|
||||
return -1;
|
||||
}
|
||||
primary_reselect = get_index(primary_reselect_tbl, *argv);
|
||||
addattr8(n, 1024, IFLA_BOND_PRIMARY_RESELECT,
|
||||
primary_reselect);
|
||||
} else if (matches(*argv, "fail_over_mac") == 0) {
|
||||
NEXT_ARG();
|
||||
if (get_index(fail_over_mac_tbl, *argv) < 0) {
|
||||
if (get_index(fail_over_mac_tbl, *argv) < 0)
|
||||
invarg("invalid fail_over_mac", *argv);
|
||||
return -1;
|
||||
}
|
||||
fail_over_mac = get_index(fail_over_mac_tbl, *argv);
|
||||
addattr8(n, 1024, IFLA_BOND_FAIL_OVER_MAC,
|
||||
fail_over_mac);
|
||||
} else if (matches(*argv, "xmit_hash_policy") == 0) {
|
||||
NEXT_ARG();
|
||||
if (get_index(xmit_hash_policy_tbl, *argv) < 0) {
|
||||
if (get_index(xmit_hash_policy_tbl, *argv) < 0)
|
||||
invarg("invalid xmit_hash_policy", *argv);
|
||||
return -1;
|
||||
}
|
||||
|
||||
xmit_hash_policy = get_index(xmit_hash_policy_tbl, *argv);
|
||||
addattr8(n, 1024, IFLA_BOND_XMIT_HASH_POLICY,
|
||||
xmit_hash_policy);
|
||||
} else if (matches(*argv, "resend_igmp") == 0) {
|
||||
NEXT_ARG();
|
||||
if (get_u32(&resend_igmp, *argv, 0)) {
|
||||
if (get_u32(&resend_igmp, *argv, 0))
|
||||
invarg("invalid resend_igmp", *argv);
|
||||
return -1;
|
||||
}
|
||||
|
||||
addattr32(n, 1024, IFLA_BOND_RESEND_IGMP, resend_igmp);
|
||||
} else if (matches(*argv, "num_grat_arp") == 0 ||
|
||||
matches(*argv, "num_unsol_na") == 0) {
|
||||
NEXT_ARG();
|
||||
if (get_u8(&num_peer_notif, *argv, 0)) {
|
||||
if (get_u8(&num_peer_notif, *argv, 0))
|
||||
invarg("invalid num_grat_arp|num_unsol_na",
|
||||
*argv);
|
||||
return -1;
|
||||
}
|
||||
|
||||
addattr8(n, 1024, IFLA_BOND_NUM_PEER_NOTIF,
|
||||
num_peer_notif);
|
||||
} else if (matches(*argv, "all_slaves_active") == 0) {
|
||||
NEXT_ARG();
|
||||
if (get_u8(&all_slaves_active, *argv, 0)) {
|
||||
if (get_u8(&all_slaves_active, *argv, 0))
|
||||
invarg("invalid all_slaves_active", *argv);
|
||||
return -1;
|
||||
}
|
||||
|
||||
addattr8(n, 1024, IFLA_BOND_ALL_SLAVES_ACTIVE,
|
||||
all_slaves_active);
|
||||
} else if (matches(*argv, "min_links") == 0) {
|
||||
NEXT_ARG();
|
||||
if (get_u32(&min_links, *argv, 0)) {
|
||||
if (get_u32(&min_links, *argv, 0))
|
||||
invarg("invalid min_links", *argv);
|
||||
return -1;
|
||||
}
|
||||
|
||||
addattr32(n, 1024, IFLA_BOND_MIN_LINKS, min_links);
|
||||
} else if (matches(*argv, "lp_interval") == 0) {
|
||||
NEXT_ARG();
|
||||
if (get_u32(&lp_interval, *argv, 0)) {
|
||||
if (get_u32(&lp_interval, *argv, 0))
|
||||
invarg("invalid lp_interval", *argv);
|
||||
return -1;
|
||||
}
|
||||
|
||||
addattr32(n, 1024, IFLA_BOND_LP_INTERVAL, lp_interval);
|
||||
} else if (matches(*argv, "packets_per_slave") == 0) {
|
||||
NEXT_ARG();
|
||||
if (get_u32(&packets_per_slave, *argv, 0)) {
|
||||
if (get_u32(&packets_per_slave, *argv, 0))
|
||||
invarg("invalid packets_per_slave", *argv);
|
||||
return -1;
|
||||
}
|
||||
|
||||
addattr32(n, 1024, IFLA_BOND_PACKETS_PER_SLAVE,
|
||||
packets_per_slave);
|
||||
} else if (matches(*argv, "lacp_rate") == 0) {
|
||||
NEXT_ARG();
|
||||
if (get_index(lacp_rate_tbl, *argv) < 0) {
|
||||
if (get_index(lacp_rate_tbl, *argv) < 0)
|
||||
invarg("invalid lacp_rate", *argv);
|
||||
return -1;
|
||||
}
|
||||
|
||||
lacp_rate = get_index(lacp_rate_tbl, *argv);
|
||||
addattr8(n, 1024, IFLA_BOND_AD_LACP_RATE, lacp_rate);
|
||||
} else if (matches(*argv, "ad_select") == 0) {
|
||||
NEXT_ARG();
|
||||
if (get_index(ad_select_tbl, *argv) < 0) {
|
||||
if (get_index(ad_select_tbl, *argv) < 0)
|
||||
invarg("invalid ad_select", *argv);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ad_select = get_index(ad_select_tbl, *argv);
|
||||
addattr8(n, 1024, IFLA_BOND_AD_SELECT, ad_select);
|
||||
} else if (matches(*argv, "ad_user_port_key") == 0) {
|
||||
NEXT_ARG();
|
||||
if (get_u16(&ad_user_port_key, *argv, 0)) {
|
||||
if (get_u16(&ad_user_port_key, *argv, 0))
|
||||
invarg("invalid ad_user_port_key", *argv);
|
||||
return -1;
|
||||
}
|
||||
|
||||
addattr16(n, 1024, IFLA_BOND_AD_USER_PORT_KEY,
|
||||
ad_user_port_key);
|
||||
} else if (matches(*argv, "ad_actor_sys_prio") == 0) {
|
||||
NEXT_ARG();
|
||||
if (get_u16(&ad_actor_sys_prio, *argv, 0)) {
|
||||
if (get_u16(&ad_actor_sys_prio, *argv, 0))
|
||||
invarg("invalid ad_actor_sys_prio", *argv);
|
||||
return -1;
|
||||
}
|
||||
|
||||
addattr16(n, 1024, IFLA_BOND_AD_ACTOR_SYS_PRIO,
|
||||
ad_actor_sys_prio);
|
||||
} else if (matches(*argv, "ad_actor_system") == 0) {
|
||||
|
@ -43,47 +43,41 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv,
|
||||
while (argc > 0) {
|
||||
if (matches(*argv, "forward_delay") == 0) {
|
||||
NEXT_ARG();
|
||||
if (get_u32(&val, *argv, 0)) {
|
||||
if (get_u32(&val, *argv, 0))
|
||||
invarg("invalid forward_delay", *argv);
|
||||
return -1;
|
||||
}
|
||||
|
||||
addattr32(n, 1024, IFLA_BR_FORWARD_DELAY, val);
|
||||
} else if (matches(*argv, "hello_time") == 0) {
|
||||
NEXT_ARG();
|
||||
if (get_u32(&val, *argv, 0)) {
|
||||
if (get_u32(&val, *argv, 0))
|
||||
invarg("invalid hello_time", *argv);
|
||||
return -1;
|
||||
}
|
||||
|
||||
addattr32(n, 1024, IFLA_BR_HELLO_TIME, val);
|
||||
} else if (matches(*argv, "max_age") == 0) {
|
||||
NEXT_ARG();
|
||||
if (get_u32(&val, *argv, 0)) {
|
||||
if (get_u32(&val, *argv, 0))
|
||||
invarg("invalid max_age", *argv);
|
||||
return -1;
|
||||
}
|
||||
|
||||
addattr32(n, 1024, IFLA_BR_MAX_AGE, val);
|
||||
} else if (matches(*argv, "ageing_time") == 0) {
|
||||
NEXT_ARG();
|
||||
if (get_u32(&val, *argv, 0)) {
|
||||
if (get_u32(&val, *argv, 0))
|
||||
invarg("invalid ageing_time", *argv);
|
||||
return -1;
|
||||
}
|
||||
|
||||
addattr32(n, 1024, IFLA_BR_AGEING_TIME, val);
|
||||
} else if (matches(*argv, "stp_state") == 0) {
|
||||
NEXT_ARG();
|
||||
if (get_u32(&val, *argv, 0)) {
|
||||
if (get_u32(&val, *argv, 0))
|
||||
invarg("invalid stp_state", *argv);
|
||||
return -1;
|
||||
}
|
||||
|
||||
addattr32(n, 1024, IFLA_BR_STP_STATE, val);
|
||||
} else if (matches(*argv, "priority") == 0) {
|
||||
__u16 prio;
|
||||
|
||||
NEXT_ARG();
|
||||
if (get_u16(&prio, *argv, 0)) {
|
||||
if (get_u16(&prio, *argv, 0))
|
||||
invarg("invalid priority", *argv);
|
||||
return -1;
|
||||
}
|
||||
|
||||
addattr16(n, 1024, IFLA_BR_PRIORITY, prio);
|
||||
} else if (matches(*argv, "vlan_filtering") == 0) {
|
||||
__u8 vlan_filter;
|
||||
|
@ -58,32 +58,35 @@ int netns_switch(char *name)
|
||||
if (setns(netns, CLONE_NEWNET) < 0) {
|
||||
fprintf(stderr, "setting the network namespace \"%s\" failed: %s\n",
|
||||
name, strerror(errno));
|
||||
return -1;
|
||||
goto fail_close;
|
||||
}
|
||||
|
||||
if (unshare(CLONE_NEWNS) < 0) {
|
||||
fprintf(stderr, "unshare failed: %s\n", strerror(errno));
|
||||
return -1;
|
||||
goto fail_close;
|
||||
}
|
||||
/* Don't let any mounts propagate back to the parent */
|
||||
if (mount("", "/", "none", MS_SLAVE | MS_REC, NULL)) {
|
||||
fprintf(stderr, "\"mount --make-rslave /\" failed: %s\n",
|
||||
strerror(errno));
|
||||
return -1;
|
||||
goto fail_close;
|
||||
}
|
||||
/* Mount a version of /sys that describes the network namespace */
|
||||
if (umount2("/sys", MNT_DETACH) < 0) {
|
||||
fprintf(stderr, "umount of /sys failed: %s\n", strerror(errno));
|
||||
return -1;
|
||||
goto fail_close;
|
||||
}
|
||||
if (mount(name, "/sys", "sysfs", 0, NULL) < 0) {
|
||||
fprintf(stderr, "mount of /sys failed: %s\n",strerror(errno));
|
||||
return -1;
|
||||
goto fail_close;
|
||||
}
|
||||
|
||||
/* Setup bind mounts for config files in /etc */
|
||||
bind_etc(name);
|
||||
return 0;
|
||||
fail_close:
|
||||
close(netns);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int netns_get_fd(const char *name)
|
||||
|
@ -14,18 +14,26 @@ ip-address \- protocol address management
|
||||
.sp
|
||||
|
||||
.ti -8
|
||||
.BR "ip address" " { " add " | " del " } "
|
||||
.IB IFADDR " dev " STRING
|
||||
.BR "ip address" " { " add " | " change " | " replace " } "
|
||||
.IB IFADDR " dev " IFNAME
|
||||
.RI "[ " LIFETIME " ] [ " CONFFLAG-LIST " ]"
|
||||
|
||||
.ti -8
|
||||
.BR "ip address" " { " show " | " flush " } [ " dev
|
||||
.IR STRING " ] [ "
|
||||
.BR "ip address del"
|
||||
.IB IFADDR " dev " IFNAME " [ " mngtmpaddr " ]"
|
||||
|
||||
.ti -8
|
||||
.BR "ip address" " { " show " | " save " | " flush " } [ " dev
|
||||
.IR IFNAME " ] [ "
|
||||
.B scope
|
||||
.IR SCOPE-ID " ] [ "
|
||||
.B to
|
||||
.IR PREFIX " ] [ " FLAG-LIST " ] [ "
|
||||
.B label
|
||||
.IR PATTERN " ]"
|
||||
.IR PATTERN " ] [ " up " ]"
|
||||
|
||||
.ti -8
|
||||
.BR "ip address" " { " showdump " | " restore " }"
|
||||
|
||||
.ti -8
|
||||
.IR IFADDR " := " PREFIX " | " ADDR
|
||||
@ -36,7 +44,7 @@ ip-address \- protocol address management
|
||||
.B anycast
|
||||
.IR ADDR " ] [ "
|
||||
.B label
|
||||
.IR STRING " ] [ "
|
||||
.IR LABEL " ] [ "
|
||||
.B scope
|
||||
.IR SCOPE-ID " ]"
|
||||
|
||||
@ -52,15 +60,33 @@ ip-address \- protocol address management
|
||||
.IR FLAG " := "
|
||||
.RB "[ " permanent " | " dynamic " | " secondary " | " primary " | \
|
||||
[ - ] " tentative " | [ - ] " deprecated " | [ - ] " dadfailed " | "\
|
||||
temporary " ]"
|
||||
temporary " ] " CONFFLAG-LIST " ]"
|
||||
|
||||
.ti -8
|
||||
.IR CONFFLAG-LIST " := [ " CONFFLAG-LIST " ] " CONFFLAG
|
||||
|
||||
.ti -8
|
||||
.IR CONFFLAG " := "
|
||||
.RB "[ " home " | " nodad " ]"
|
||||
|
||||
.ti -8
|
||||
.IR LIFETIME " := [ "
|
||||
.BI valid_lft " LFT"
|
||||
.RB "| " preferred_lft
|
||||
.IR LFT " ]"
|
||||
|
||||
.ti -8
|
||||
.IR LFT " := [ "
|
||||
.BR forever " |"
|
||||
.IR SECONDS " ]"
|
||||
|
||||
.SH "DESCRIPTION"
|
||||
The
|
||||
.B address
|
||||
is a protocol (IP or IPv6) address attached
|
||||
to a network device. Each device must have at least one address
|
||||
to use the corresponding protocol. It is possible to have several
|
||||
different addresses attached to one device. These addresses are not
|
||||
is a protocol (IPv4 or IPv6) address attached
|
||||
to a network device. Each device must have at least one address
|
||||
to use the corresponding protocol. It is possible to have several
|
||||
different addresses attached to one device. These addresses are not
|
||||
discriminated, so that the term
|
||||
.B alias
|
||||
is not quite appropriate for them and we do not use it in this document.
|
||||
@ -73,7 +99,7 @@ and deletes old ones.
|
||||
.SS ip address add - add new protocol address.
|
||||
|
||||
.TP
|
||||
.BI dev " NAME"
|
||||
.BI dev " IFNAME "
|
||||
the name of the device to add the address to.
|
||||
|
||||
.TP
|
||||
@ -107,7 +133,7 @@ instead of the broadcast address. In this case, the broadcast address
|
||||
is derived by setting/resetting the host bits of the interface prefix.
|
||||
|
||||
.TP
|
||||
.BI label " NAME"
|
||||
.BI label " LABEL"
|
||||
Each address may be tagged with a label string.
|
||||
In order to preserve compatibility with Linux-2.0 net aliases,
|
||||
this string must coincide with the name of the device or must be prefixed
|
||||
@ -125,7 +151,7 @@ Predefined scope values are:
|
||||
- the address is globally valid.
|
||||
.sp
|
||||
.B site
|
||||
- (IPv6 only) the address is site local, i.e. it is
|
||||
- (IPv6 only, deprecated) the address is site local, i.e. it is
|
||||
valid inside this site.
|
||||
.sp
|
||||
.B link
|
||||
@ -135,6 +161,30 @@ valid inside this site.
|
||||
- the address is valid only inside this host.
|
||||
.in -8
|
||||
|
||||
.TP
|
||||
.BI valid_lft " LFT"
|
||||
the valid lifetime of this address; see section 5.5.4 of
|
||||
RFC 4862. When it expires, the address is removed by the kernel.
|
||||
Defaults to
|
||||
.BR "forever" .
|
||||
|
||||
.TP
|
||||
.BI preferred_lft " LFT"
|
||||
the preferred lifetime of this address; see section 5.5.4
|
||||
of RFC 4862. When it expires, the address is no longer used for new
|
||||
outgoing connections. Defaults to
|
||||
.BR "forever" .
|
||||
|
||||
.TP
|
||||
.B home
|
||||
(IPv6 only) designates this address the "home address" as defined in
|
||||
RFC 6275.
|
||||
|
||||
.TP
|
||||
.B nodad
|
||||
(IPv6 only) do not perform Duplicate Address Detection (RFC 4862) when
|
||||
adding this address.
|
||||
|
||||
.SS ip address delete - delete protocol address
|
||||
.B Arguments:
|
||||
coincide with the arguments of
|
||||
@ -145,7 +195,7 @@ If no arguments are given, the first address is deleted.
|
||||
.SS ip address show - look at protocol addresses
|
||||
|
||||
.TP
|
||||
.BI dev " NAME " (default)
|
||||
.BI dev " IFNAME " (default)
|
||||
name of device.
|
||||
|
||||
.TP
|
||||
@ -219,36 +269,53 @@ The difference is that it does not run when no arguments are given.
|
||||
|
||||
.PP
|
||||
.B Warning:
|
||||
This command (and other
|
||||
This command and other
|
||||
.B flush
|
||||
commands described below) is pretty dangerous. If you make a mistake,
|
||||
it will not forgive it, but will cruelly purge all the addresses.
|
||||
commands are unforgiving. They will cruelly purge all the addresses.
|
||||
|
||||
.PP
|
||||
With the
|
||||
.B -statistics
|
||||
option, the command becomes verbose. It prints out the number of deleted
|
||||
addresses and the number of rounds made to flush the address list. If
|
||||
this option is given twice,
|
||||
addresses and the number of rounds made to flush the address list.
|
||||
If this option is given twice,
|
||||
.B ip address flush
|
||||
also dumps all the deleted addresses in the format described in the
|
||||
previous subsection.
|
||||
|
||||
.SH "EXAMPLES"
|
||||
.PP
|
||||
ip address show
|
||||
.RS 4
|
||||
Shows IPv4 and IPv6 addresses assigned to all network interfaces. The 'show'
|
||||
subcommand can be omitted.
|
||||
.RE
|
||||
.PP
|
||||
ip address show up
|
||||
.RS 4
|
||||
Same as above except that only addresses assigned to active network interfaces
|
||||
are shown.
|
||||
.RE
|
||||
.PP
|
||||
ip address show dev eth0
|
||||
.RS 4
|
||||
Shows the addresses assigned to network interface eth0
|
||||
Shows IPv4 and IPv6 addresses assigned to network interface eth0.
|
||||
.RE
|
||||
.PP
|
||||
ip addr add 2001:0db8:85a3::0370:7334/64 dev eth1
|
||||
ip address add 2001:0db8:85a3::0370:7334/64 dev eth1
|
||||
.RS 4
|
||||
Adds an IPv6 address to network interface eth1
|
||||
Adds an IPv6 address to network interface eth1.
|
||||
.RE
|
||||
.PP
|
||||
ip addr flush dev eth4
|
||||
ip address delete 2001:0db8:85a3::0370:7334/64 dev eth1
|
||||
.RS 4
|
||||
Removes all addresses from device eth4
|
||||
Delete the IPv6 address added above.
|
||||
.RE
|
||||
.PP
|
||||
ip address flush dev eth4 scope global
|
||||
.RS 4
|
||||
Removes all global IPv4 and IPv6 addresses from device eth4. Without 'scope
|
||||
global' it would remove all addresses including IPv6 link-local ones.
|
||||
.RE
|
||||
|
||||
.SH SEE ALSO
|
||||
|
@ -145,9 +145,13 @@ ip-link \- network device configuration
|
||||
] |
|
||||
.br
|
||||
.B master
|
||||
.IR DEVICE
|
||||
.IR DEVICE " |"
|
||||
.br
|
||||
.B nomaster
|
||||
.B nomaster " |"
|
||||
.br
|
||||
.B addrgenmode { eui64 | none }
|
||||
.br
|
||||
.B link-netnsid ID
|
||||
.BR " }"
|
||||
|
||||
|
||||
@ -187,6 +191,8 @@ Link types:
|
||||
.sp
|
||||
.B bond
|
||||
- Bonding device
|
||||
.B can
|
||||
- Controller Area Network interface
|
||||
.sp
|
||||
.B dummy
|
||||
- Dummy network interface
|
||||
@ -267,6 +273,66 @@ specifies the number of receive queues for new device.
|
||||
.BI index " IDX "
|
||||
specifies the desired index of the new virtual device. The link creation fails, if the index is busy.
|
||||
|
||||
.TP
|
||||
VLAN Type Support
|
||||
For a link of type
|
||||
.I VLAN
|
||||
the following additional arguments are supported:
|
||||
|
||||
.BI "ip link add
|
||||
.BI link " DEVICE "
|
||||
.BI name " NAME "
|
||||
.BI type " vlan "
|
||||
.R " [ "
|
||||
.BI protocol " VLAN_PROTO "
|
||||
.R " ] "
|
||||
.BI id " VLANID "
|
||||
.R " [ "
|
||||
.BR reorder_hdr " { " on " | " off " } "
|
||||
.R " ] "
|
||||
.R " [ "
|
||||
.BR gvrp " { " on " | " off " } "
|
||||
.R " ] "
|
||||
.R " [ "
|
||||
.BR mvrp " { " on " | " off " } "
|
||||
.R " ] "
|
||||
.R " [ "
|
||||
.BR loose_binding " { " on " | " off " } "
|
||||
.R " ] "
|
||||
.R " [ "
|
||||
.BI ingress-qos-map " QOS-MAP "
|
||||
.R " ] "
|
||||
.R " [ "
|
||||
.BI egress-qos-map " QOS-MAP "
|
||||
.R " ] "
|
||||
|
||||
.in +8
|
||||
.sp
|
||||
.BI protocol " VLAN_PROTO "
|
||||
- either 802.1Q or 802.1ad.
|
||||
|
||||
.BI id " VLANID "
|
||||
- specifies the VLAN Identifer to use. Note that numbers with a leading " 0 " or " 0x " are interpreted as octal or hexadeimal, respectively.
|
||||
|
||||
.BR reorder_hdr " { " on " | " off " } "
|
||||
- specifies whether ethernet headers are reordered or not.
|
||||
|
||||
.BR gvrp " { " on " | " off " } "
|
||||
- specifies whether this VLAN should be registered using GARP VLAN Registration Protocol.
|
||||
|
||||
.BR mvrp " { " on " | " off " } "
|
||||
- specifies whether this VLAN should be registered using Multiple VLAN Registration Protocol.
|
||||
|
||||
.BR loose_binding " { " on " | " off " } "
|
||||
- specifies whether the VLAN device state is bound to the physical device state.
|
||||
|
||||
.BI ingress-qos-map " QOS-MAP "
|
||||
- defines a mapping between priority code points on incoming frames. The format is FROM:TO with multiple mappings separated by spaces.
|
||||
|
||||
.BI egress-qos-map " QOS-MAP "
|
||||
- the same as ingress-qos-map but for outgoing frames.
|
||||
.in -8
|
||||
|
||||
.TP
|
||||
VXLAN Type Support
|
||||
For a link of type
|
||||
@ -286,7 +352,9 @@ the following additional arguments are supported:
|
||||
.R " ] [ "
|
||||
.BI tos " TOS "
|
||||
.R " ] [ "
|
||||
.BI port " MIN MAX "
|
||||
.BI dstport " PORT "
|
||||
.R " ] [ "
|
||||
.BI srcport " MIN MAX "
|
||||
.R " ] [ "
|
||||
.I "[no]learning "
|
||||
.R " ] [ "
|
||||
@ -298,6 +366,12 @@ the following additional arguments are supported:
|
||||
.R " ] [ "
|
||||
.I "[no]l3miss "
|
||||
.R " ] [ "
|
||||
.I "[no]udpcsum "
|
||||
.R " ] [ "
|
||||
.I "[no]udp6zerocsumtx "
|
||||
.R " ] [ "
|
||||
.I "[no]udp6zerocsumrx "
|
||||
.R " ] [ "
|
||||
.BI ageing " SECONDS "
|
||||
.R " ] [ "
|
||||
.BI maxaddress " NUMBER "
|
||||
@ -342,7 +416,11 @@ parameter.
|
||||
- specifies the TOS value to use in outgoing packets.
|
||||
|
||||
.sp
|
||||
.BI port " MIN MAX"
|
||||
.BI dstport " PORT"
|
||||
- specifies the UDP destination port to communicate to the remote VXLAN tunnel endpoint.
|
||||
|
||||
.sp
|
||||
.BI srcport " MIN MAX"
|
||||
- specifies the range of port numbers to use as UDP
|
||||
source ports to communicate to the remote VXLAN tunnel endpoint.
|
||||
|
||||
@ -367,6 +445,18 @@ are entered into the VXLAN device forwarding database.
|
||||
.I [no]l3miss
|
||||
- specifies if netlink IP ADDR miss notifications are generated.
|
||||
|
||||
.sp
|
||||
.I [no]udpcsum
|
||||
- specifies if UDP checksum is filled in
|
||||
|
||||
.sp
|
||||
.I [no]udp6zerocsumtx
|
||||
- specifies if UDP checksum is filled in
|
||||
|
||||
.sp
|
||||
.I [no]udp6zerocsumrx
|
||||
- specifies if UDP checksum is received
|
||||
|
||||
.sp
|
||||
.BI ageing " SECONDS"
|
||||
- specifies the lifetime in seconds of FDB entries learnt by the kernel.
|
||||
@ -758,6 +848,12 @@ tool can be used. But it allows to change network namespace only for physical de
|
||||
.BI alias " NAME"
|
||||
give the device a symbolic name for easy reference.
|
||||
|
||||
.TP
|
||||
.BI group " GROUP"
|
||||
specify the group the device belongs to.
|
||||
The available groups are listed in file
|
||||
.BR "@SYSCONFDIR@/group" .
|
||||
|
||||
.TP
|
||||
.BI vf " NUM"
|
||||
specify a Virtual Function device to be configured. The associated PF device
|
||||
@ -837,6 +933,14 @@ set master device of the device (enslave device).
|
||||
.BI nomaster
|
||||
unset master device of the device (release device).
|
||||
|
||||
.TP
|
||||
.BR "addrgenmode eui64 " or " addrgenmode none"
|
||||
set IPv6 address generation mode
|
||||
|
||||
.TP
|
||||
.BR "link-netnsid "
|
||||
set peer netnsid for a cross-netns interface
|
||||
|
||||
.PP
|
||||
.B Warning:
|
||||
If multiple parameter changes are requested,
|
||||
|
@ -19,8 +19,8 @@ ip \- show / manipulate routing, devices, policy routing and tunnels
|
||||
|
||||
.ti -8
|
||||
.IR OBJECT " := { "
|
||||
.BR link " | " addr " | " addrlabel " | " route " | " rule " | " neigh " | "\
|
||||
ntable " | " tunnel " | " tuntap " | " maddr " | " mroute " | " mrule " | "\
|
||||
.BR link " | " address " | " addrlabel " | " route " | " rule " | " neigh " | "\
|
||||
ntable " | " tunnel " | " tuntap " | " maddress " | " mroute " | " mrule " | "\
|
||||
monitor " | " xfrm " | " netns " | " l2tp " | " tcp_metrics " }"
|
||||
.sp
|
||||
|
||||
@ -67,7 +67,7 @@ Output more detailed information.
|
||||
|
||||
.TP
|
||||
.BR "\-l" , " \-loops " <COUNT>
|
||||
Specify maximum number of loops the 'ip addr flush' logic
|
||||
Specify maximum number of loops the 'ip address flush' logic
|
||||
will attempt before giving up. The default is 10.
|
||||
Zero (0) means loop until all addresses are removed.
|
||||
|
||||
@ -143,7 +143,7 @@ use the system's name resolver to print DNS names instead of
|
||||
host addresses.
|
||||
|
||||
.TP
|
||||
.BR "\-n" , " \-net" , " \-netns " <NETNS>
|
||||
.BR "\-n" , " \-netns " <NETNS>
|
||||
switches
|
||||
.B ip
|
||||
to the specified network namespace
|
||||
|
17
misc/ss.c
17
misc/ss.c
@ -483,8 +483,10 @@ static void user_ent_hash_build(void)
|
||||
|
||||
sprintf(name + nameoff, "%d/fd/", pid);
|
||||
pos = strlen(name);
|
||||
if ((dir1 = opendir(name)) == NULL)
|
||||
if ((dir1 = opendir(name)) == NULL) {
|
||||
free(pid_context);
|
||||
continue;
|
||||
}
|
||||
|
||||
process[0] = '\0';
|
||||
p = process;
|
||||
@ -550,7 +552,7 @@ static int find_entry(unsigned ino, char **buf, int type)
|
||||
struct user_ent *p;
|
||||
int cnt = 0;
|
||||
char *ptr;
|
||||
char **new_buf = buf;
|
||||
char *new_buf;
|
||||
int len, new_buf_len;
|
||||
int buf_used = 0;
|
||||
int buf_len = 0;
|
||||
@ -592,12 +594,12 @@ static int find_entry(unsigned ino, char **buf, int type)
|
||||
|
||||
if (len < 0 || len >= buf_len - buf_used) {
|
||||
new_buf_len = buf_len + ENTRY_BUF_SIZE;
|
||||
*new_buf = realloc(*buf, new_buf_len);
|
||||
new_buf = realloc(*buf, new_buf_len);
|
||||
if (!new_buf) {
|
||||
fprintf(stderr, "ss: failed to malloc buffer\n");
|
||||
abort();
|
||||
}
|
||||
**buf = **new_buf;
|
||||
*buf = new_buf;
|
||||
buf_len = new_buf_len;
|
||||
continue;
|
||||
} else {
|
||||
@ -3025,6 +3027,7 @@ static int packet_show_line(char *buf, const struct filter *f, int fam)
|
||||
static int packet_show(struct filter *f)
|
||||
{
|
||||
FILE *fp;
|
||||
int rc = 0;
|
||||
|
||||
if (!filter_af_get(f, AF_PACKET) || !(f->states & (1 << SS_CLOSE)))
|
||||
return 0;
|
||||
@ -3036,9 +3039,10 @@ static int packet_show(struct filter *f)
|
||||
if ((fp = net_packet_open()) == NULL)
|
||||
return -1;
|
||||
if (generic_record_read(fp, packet_show_line, f, AF_PACKET))
|
||||
return -1;
|
||||
rc = -1;
|
||||
|
||||
return 0;
|
||||
fclose(fp);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int netlink_show_one(struct filter *f,
|
||||
@ -3215,6 +3219,7 @@ static int netlink_show(struct filter *f)
|
||||
netlink_show_one(f, prot, pid, groups, 0, 0, 0, rq, wq, sk, cb);
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
20
tc/tc_stab.c
20
tc/tc_stab.c
@ -67,42 +67,32 @@ int parse_size_table(int *argcp, char ***argvp, struct tc_sizespec *sp)
|
||||
NEXT_ARG();
|
||||
if (s.mtu)
|
||||
duparg("mtu", *argv);
|
||||
if (get_u32(&s.mtu, *argv, 10)) {
|
||||
if (get_u32(&s.mtu, *argv, 10))
|
||||
invarg("mtu", "invalid mtu");
|
||||
return -1;
|
||||
}
|
||||
} else if (matches(*argv, "mpu") == 0) {
|
||||
NEXT_ARG();
|
||||
if (s.mpu)
|
||||
duparg("mpu", *argv);
|
||||
if (get_u32(&s.mpu, *argv, 10)) {
|
||||
if (get_u32(&s.mpu, *argv, 10))
|
||||
invarg("mpu", "invalid mpu");
|
||||
return -1;
|
||||
}
|
||||
} else if (matches(*argv, "overhead") == 0) {
|
||||
NEXT_ARG();
|
||||
if (s.overhead)
|
||||
duparg("overhead", *argv);
|
||||
if (get_integer(&s.overhead, *argv, 10)) {
|
||||
if (get_integer(&s.overhead, *argv, 10))
|
||||
invarg("overhead", "invalid overhead");
|
||||
return -1;
|
||||
}
|
||||
} else if (matches(*argv, "tsize") == 0) {
|
||||
NEXT_ARG();
|
||||
if (s.tsize)
|
||||
duparg("tsize", *argv);
|
||||
if (get_u32(&s.tsize, *argv, 10)) {
|
||||
if (get_u32(&s.tsize, *argv, 10))
|
||||
invarg("tsize", "invalid table size");
|
||||
return -1;
|
||||
}
|
||||
} else if (matches(*argv, "linklayer") == 0) {
|
||||
NEXT_ARG();
|
||||
if (s.linklayer != LINKLAYER_UNSPEC)
|
||||
duparg("linklayer", *argv);
|
||||
if (get_linklayer(&s.linklayer, *argv)) {
|
||||
if (get_linklayer(&s.linklayer, *argv))
|
||||
invarg("linklayer", "invalid linklayer");
|
||||
return -1;
|
||||
}
|
||||
} else
|
||||
break;
|
||||
argc--; argv++;
|
||||
|
Loading…
Reference in New Issue
Block a user