Commit 56f5daac authored by Stephen Hemminger's avatar Stephen Hemminger

ip: code cleanup

Run all the ip code through checkpatch and have it fix the obvious stuff.
parent 32a121cb
......@@ -50,7 +50,7 @@ static void usage(void)
fprintf(stderr, " [ mode { ip6ip6 | ipip6 | ip6gre | vti6 | any } ]\n");
fprintf(stderr, " [ remote ADDR local ADDR ] [ dev PHYS_DEV ]\n");
fprintf(stderr, " [ encaplimit ELIM ]\n");
fprintf(stderr ," [ hoplimit TTL ] [ tclass TCLASS ] [ flowlabel FLOWLABEL ]\n");
fprintf(stderr, " [ hoplimit TTL ] [ tclass TCLASS ] [ flowlabel FLOWLABEL ]\n");
fprintf(stderr, " [ dscp inherit ]\n");
fprintf(stderr, " [ [i|o]seq ] [ [i|o]key KEY ] [ [i|o]csum ]\n");
fprintf(stderr, "\n");
......@@ -81,6 +81,7 @@ static void print_tunnel(struct ip6_tnl_parm2 *p)
rt_addr_n2a(AF_INET6, 16, &p->laddr, s2, sizeof(s2)));
if (p->link) {
const char *n = ll_index_to_name(p->link);
if (n)
printf(" dev %s", n);
}
......@@ -96,6 +97,7 @@ static void print_tunnel(struct ip6_tnl_parm2 *p)
printf(" tclass inherit");
else {
__u32 val = ntohl(p->flowinfo & IP6_FLOWINFO_TCLASS);
printf(" tclass 0x%02x", (__u8)(val >> 20));
}
......@@ -158,11 +160,12 @@ static int parse_args(int argc, char **argv, int cmd, struct ip6_tnl_parm2 *p)
strcmp(*argv, "any") == 0)
p->proto = 0;
else {
fprintf(stderr,"Unknown tunnel mode \"%s\"\n", *argv);
fprintf(stderr, "Unknown tunnel mode \"%s\"\n", *argv);
exit(-1);
}
} else if (strcmp(*argv, "remote") == 0) {
inet_prefix raddr;
NEXT_ARG();
get_prefix(&raddr, *argv, preferred_family);
if (raddr.family == AF_UNSPEC)
......@@ -170,6 +173,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip6_tnl_parm2 *p)
memcpy(&p->raddr, &raddr.data, sizeof(p->raddr));
} else if (strcmp(*argv, "local") == 0) {
inet_prefix laddr;
NEXT_ARG();
get_prefix(&laddr, *argv, preferred_family);
if (laddr.family == AF_UNSPEC)
......@@ -184,6 +188,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip6_tnl_parm2 *p)
p->flags |= IP6_TNL_F_IGN_ENCAP_LIMIT;
} else {
__u8 uval;
if (get_u8(&uval, *argv, 0) < -1)
invarg("invalid ELIM", *argv);
p->encap_limit = uval;
......@@ -193,6 +198,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip6_tnl_parm2 *p)
strcmp(*argv, "ttl") == 0 ||
strcmp(*argv, "hlim") == 0) {
__u8 uval;
NEXT_ARG();
if (get_u8(&uval, *argv, 0))
invarg("invalid TTL", *argv);
......@@ -202,6 +208,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip6_tnl_parm2 *p)
strcmp(*argv, "tos") == 0 ||
matches(*argv, "dsfield") == 0) {
__u8 uval;
NEXT_ARG();
p->flowinfo &= ~IP6_FLOWINFO_TCLASS;
if (strcmp(*argv, "inherit") == 0)
......@@ -215,6 +222,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip6_tnl_parm2 *p)
} else if (strcmp(*argv, "flowlabel") == 0 ||
strcmp(*argv, "fl") == 0) {
__u32 uval;
NEXT_ARG();
p->flowinfo &= ~IP6_FLOWINFO_FLOWLABEL;
if (strcmp(*argv, "inherit") == 0)
......@@ -269,6 +277,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip6_tnl_parm2 *p)
strncpy(p->name, *argv, IFNAMSIZ - 1);
if (cmd == SIOCCHGTUNNEL && count == 0) {
struct ip6_tnl_parm2 old_p;
memset(&old_p, 0, sizeof(old_p));
if (tnl_get_ioctl(*argv, &old_p))
return -1;
......@@ -326,6 +335,7 @@ static int do_tunnels_list(struct ip6_tnl_parm2 *p)
char buf[512];
int err = -1;
FILE *fp = fopen("/proc/net/dev", "r");
if (fp == NULL) {
perror("fopen");
return -1;
......@@ -387,14 +397,14 @@ static int do_tunnels_list(struct ip6_tnl_parm2 *p)
static int do_show(int argc, char **argv)
{
struct ip6_tnl_parm2 p;
struct ip6_tnl_parm2 p;
ll_init_map(&rth);
ip6_tnl_parm_init(&p, 0);
p.proto = 0; /* default to any */
if (parse_args(argc, argv, SIOCGETTUNNEL, &p) < 0)
return -1;
if (parse_args(argc, argv, SIOCGETTUNNEL, &p) < 0)
return -1;
if (!p.name[0] || show_stats)
do_tunnels_list(&p);
......@@ -405,7 +415,7 @@ static int do_show(int argc, char **argv)
printf("\n");
}
return 0;
return 0;
}
static int do_add(int cmd, int argc, char **argv)
......
This diff is collapsed.
......@@ -40,8 +40,8 @@
#include "utils.h"
#include "ip_common.h"
#define IFAL_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifaddrlblmsg))))
#define IFAL_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifaddrlblmsg))
#define IFAL_RTA(r) ((struct rtattr *)(((char *)(r)) + NLMSG_ALIGN(sizeof(struct ifaddrlblmsg))))
#define IFAL_PAYLOAD(n) NLMSG_PAYLOAD(n, sizeof(struct ifaddrlblmsg))
extern struct rtnl_handle rth;
......@@ -56,7 +56,7 @@ static void usage(void)
int print_addrlabel(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE*)arg;
FILE *fp = (FILE *)arg;
struct ifaddrlblmsg *ifal = NLMSG_DATA(n);
int len = n->nlmsg_len;
struct rtattr *tb[IFAL_MAX+1];
......@@ -88,6 +88,7 @@ int print_addrlabel(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg
if (tb[IFAL_LABEL] && RTA_PAYLOAD(tb[IFAL_LABEL]) == sizeof(uint32_t)) {
uint32_t label;
memcpy(&label, RTA_DATA(tb[IFAL_LABEL]), sizeof(label));
fprintf(fp, "label %u ", label);
}
......@@ -128,7 +129,7 @@ static int ipaddrlabel_modify(int cmd, int argc, char **argv)
struct {
struct nlmsghdr n;
struct ifaddrlblmsg ifal;
char buf[1024];
char buf[1024];
} req;
inet_prefix prefix;
......@@ -195,7 +196,7 @@ static int flush_addrlabel(const struct sockaddr_nl *who, struct nlmsghdr *n, vo
struct rtnl_handle rth2;
struct rtmsg *r = NLMSG_DATA(n);
int len = n->nlmsg_len;
struct rtattr * tb[IFAL_MAX+1];
struct rtattr *tb[IFAL_MAX+1];
len -= NLMSG_LENGTH(sizeof(*r));
if (len < 0)
......
......@@ -526,6 +526,7 @@ static int parse_args(int argc, char **argv, int cmd, struct l2tp_parm *p)
} else if ((strcmp(*argv, "tunnel_id") == 0) ||
(strcmp(*argv, "tid") == 0)) {
__u32 uval;
NEXT_ARG();
if (get_u32(&uval, *argv, 0))
invarg("invalid ID\n", *argv);
......@@ -533,6 +534,7 @@ static int parse_args(int argc, char **argv, int cmd, struct l2tp_parm *p)
} else if ((strcmp(*argv, "peer_tunnel_id") == 0) ||
(strcmp(*argv, "ptid") == 0)) {
__u32 uval;
NEXT_ARG();
if (get_u32(&uval, *argv, 0))
invarg("invalid ID\n", *argv);
......@@ -540,6 +542,7 @@ static int parse_args(int argc, char **argv, int cmd, struct l2tp_parm *p)
} else if ((strcmp(*argv, "session_id") == 0) ||
(strcmp(*argv, "sid") == 0)) {
__u32 uval;
NEXT_ARG();
if (get_u32(&uval, *argv, 0))
invarg("invalid ID\n", *argv);
......@@ -547,36 +550,42 @@ static int parse_args(int argc, char **argv, int cmd, struct l2tp_parm *p)
} else if ((strcmp(*argv, "peer_session_id") == 0) ||
(strcmp(*argv, "psid") == 0)) {
__u32 uval;
NEXT_ARG();
if (get_u32(&uval, *argv, 0))
invarg("invalid ID\n", *argv);
p->peer_session_id = uval;
} else if (strcmp(*argv, "udp_sport") == 0) {
__u16 uval;
NEXT_ARG();
if (get_u16(&uval, *argv, 0))
invarg("invalid port\n", *argv);
p->local_udp_port = uval;
} else if (strcmp(*argv, "udp_dport") == 0) {
__u16 uval;
NEXT_ARG();
if (get_u16(&uval, *argv, 0))
invarg("invalid port\n", *argv);
p->peer_udp_port = uval;
} else if (strcmp(*argv, "offset") == 0) {
__u8 uval;
NEXT_ARG();
if (get_u8(&uval, *argv, 0))
invarg("invalid offset\n", *argv);
p->offset = uval;
} else if (strcmp(*argv, "peer_offset") == 0) {
__u8 uval;
NEXT_ARG();
if (get_u8(&uval, *argv, 0))
invarg("invalid offset\n", *argv);
p->peer_offset = uval;
} else if (strcmp(*argv, "cookie") == 0) {
int slen;
NEXT_ARG();
slen = strlen(*argv);
if ((slen != 8) && (slen != 16))
......@@ -587,6 +596,7 @@ static int parse_args(int argc, char **argv, int cmd, struct l2tp_parm *p)
invarg("cookie must be a hex string\n", *argv);
} else if (strcmp(*argv, "peer_cookie") == 0) {
int slen;
NEXT_ARG();
slen = strlen(*argv);
if ((slen != 8) && (slen != 16))
......
......@@ -358,6 +358,7 @@ static int iplink_parse_vf(int vf, int *argcp, char ***argvp,
} else if (matches(*argv, "trust") == 0) {
struct ifla_vf_trust ivt;
NEXT_ARG();
if (matches(*argv, "on") == 0)
ivt.setting = 1;
......@@ -712,14 +713,12 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
&group, sizeof(group));
else {
if (argc) {
fprintf(stderr, "Garbage instead of arguments "
"\"%s ...\". Try \"ip link "
fprintf(stderr, "Garbage instead of arguments \"%s ...\". Try \"ip link "
"help\".\n", *argv);
return -1;
}
if (flags & NLM_F_CREATE) {
fprintf(stderr, "group cannot be used when "
"creating devices.\n");
fprintf(stderr, "group cannot be used when creating devices.\n");
return -1;
}
......@@ -733,13 +732,11 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
if (!(flags & NLM_F_CREATE)) {
if (!dev) {
fprintf(stderr, "Not enough information: \"dev\" "
"argument is required.\n");
fprintf(stderr, "Not enough information: \"dev\" argument is required.\n");
exit(-1);
}
if (cmd == RTM_NEWLINK && index != -1) {
fprintf(stderr, "index can be used only when "
"creating devices.\n");
fprintf(stderr, "index can be used only when creating devices.\n");
exit(-1);
}
......@@ -813,14 +810,13 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
} else if (argc) {
if (matches(*argv, "help") == 0)
usage();
fprintf(stderr, "Garbage instead of arguments \"%s ...\". "
"Try \"ip link help\".\n", *argv);
fprintf(stderr, "Garbage instead of arguments \"%s ...\". Try \"ip link help\".\n",
*argv);
return -1;
}
addattr_nest_end(&req.n, linkinfo);
} else if (flags & NLM_F_CREATE) {
fprintf(stderr, "Not enough information: \"type\" argument "
"is required\n");
fprintf(stderr, "Not enough information: \"type\" argument is required\n");
return -1;
}
......
......@@ -166,7 +166,7 @@ static int bond_parse_opt(struct link_util *lu, int argc, char **argv,
__u32 miimon, updelay, downdelay, arp_interval, arp_validate;
__u32 arp_all_targets, resend_igmp, min_links, lp_interval;
__u32 packets_per_slave;
unsigned ifindex;
unsigned int ifindex;
while (argc > 0) {
if (matches(*argv, "mode") == 0) {
......@@ -209,7 +209,7 @@ static int bond_parse_opt(struct link_util *lu, int argc, char **argv,
invarg("invalid arp_interval", *argv);
addattr32(n, 1024, IFLA_BOND_ARP_INTERVAL, arp_interval);
} else if (matches(*argv, "arp_ip_target") == 0) {
struct rtattr * nest = addattr_nest(n, 1024,
struct rtattr *nest = addattr_nest(n, 1024,
IFLA_BOND_ARP_IP_TARGET);
if (NEXT_ARG_OK()) {
NEXT_ARG();
......@@ -217,8 +217,9 @@ static int bond_parse_opt(struct link_util *lu, int argc, char **argv,
char *target = strtok(targets, ",");
int i;
for(i = 0; target && i < BOND_MAX_ARP_TARGETS; i++) {
for (i = 0; target && i < BOND_MAX_ARP_TARGETS; i++) {
__u32 addr = get_addr32(target);
addattr32(n, 1024, i, addr);
target = strtok(NULL, ",");
}
......@@ -368,7 +369,7 @@ static int bond_parse_opt(struct link_util *lu, int argc, char **argv,
static void bond_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
{
unsigned ifindex;
unsigned int ifindex;
if (!tb)
return;
......
......@@ -26,7 +26,7 @@ static void print_slave_state(FILE *f, struct rtattr *tb)
{
unsigned int state = rta_getattr_u8(tb);
if (state >= sizeof(slave_states) / sizeof(slave_states[0]))
if (state >= ARRAY_SIZE(slave_states))
fprintf(f, "state %d ", state);
else
fprintf(f, "state %s ", slave_states[state]);
......@@ -43,7 +43,7 @@ static void print_slave_mii_status(FILE *f, struct rtattr *tb)
{
unsigned int status = rta_getattr_u8(tb);
if (status >= sizeof(slave_mii_status) / sizeof(slave_mii_status[0]))
if (status >= ARRAY_SIZE(slave_mii_status))
fprintf(f, "mii_status %d ", status);
else
fprintf(f, "mii_status %s ", slave_mii_status[status]);
......
......@@ -24,7 +24,7 @@ static void print_explain(FILE *f)
fprintf(f,
"Usage: ... bridge_slave [ state STATE ] [ priority PRIO ] [cost COST ]\n"
" [ guard {on | off} ]\n"
" [ hairpin {on | off} ] \n"
" [ hairpin {on | off} ]\n"
" [ fastleave {on | off} ]\n"
" [ root_block {on | off} ]\n"
" [ learning {on | off} ]\n"
......
......@@ -23,13 +23,11 @@ static void print_usage(FILE *f)
{
fprintf(f,
"Usage: ip link set DEVICE type can\n"
"\t[ bitrate BITRATE [ sample-point SAMPLE-POINT] ] | \n"
"\t[ tq TQ prop-seg PROP_SEG phase-seg1 PHASE-SEG1\n "
"\t phase-seg2 PHASE-SEG2 [ sjw SJW ] ]\n"
"\t[ bitrate BITRATE [ sample-point SAMPLE-POINT] ] |\n"
"\t[ tq TQ prop-seg PROP_SEG phase-seg1 PHASE-SEG1\n \t phase-seg2 PHASE-SEG2 [ sjw SJW ] ]\n"
"\n"
"\t[ dbitrate BITRATE [ dsample-point SAMPLE-POINT] ] | \n"
"\t[ dtq TQ dprop-seg PROP_SEG dphase-seg1 PHASE-SEG1\n "
"\t dphase-seg2 PHASE-SEG2 [ dsjw SJW ] ]\n"
"\t[ dbitrate BITRATE [ dsample-point SAMPLE-POINT] ] |\n"
"\t[ dtq TQ dprop-seg PROP_SEG dphase-seg1 PHASE-SEG1\n \t dphase-seg2 PHASE-SEG2 [ dsjw SJW ] ]\n"
"\n"
"\t[ loopback { on | off } ]\n"
"\t[ listen-only { on | off } ]\n"
......@@ -73,7 +71,7 @@ static int get_float(float *val, const char *arg)
return 0;
}
static void set_ctrlmode(char* name, char *arg,
static void set_ctrlmode(char *name, char *arg,
struct can_ctrlmode *cm, __u32 flags)
{
if (strcmp(arg, "on") == 0) {
......@@ -289,11 +287,9 @@ static void can_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
if (tb[IFLA_CAN_BITTIMING]) {
struct can_bittiming *bt = RTA_DATA(tb[IFLA_CAN_BITTIMING]);
fprintf(f, "\n "
"bitrate %d sample-point %.3f ",
fprintf(f, "\n bitrate %d sample-point %.3f ",
bt->bitrate, (float)bt->sample_point / 1000.);
fprintf(f, "\n "
"tq %d prop-seg %d phase-seg1 %d phase-seg2 %d sjw %d",
fprintf(f, "\n tq %d prop-seg %d phase-seg1 %d phase-seg2 %d sjw %d",
bt->tq, bt->prop_seg, bt->phase_seg1, bt->phase_seg2,
bt->sjw);
}
......@@ -302,8 +298,7 @@ static void can_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
struct can_bittiming_const *btc =
RTA_DATA(tb[IFLA_CAN_BITTIMING_CONST]);
fprintf(f, "\n "
"%s: tseg1 %d..%d tseg2 %d..%d "
fprintf(f, "\n %s: tseg1 %d..%d tseg2 %d..%d "
"sjw 1..%d brp %d..%d brp-inc %d",
btc->name, btc->tseg1_min, btc->tseg1_max,
btc->tseg2_min, btc->tseg2_max, btc->sjw_max,
......@@ -314,11 +309,9 @@ static void can_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
struct can_bittiming *dbt =
RTA_DATA(tb[IFLA_CAN_DATA_BITTIMING]);
fprintf(f, "\n "
"dbitrate %d dsample-point %.3f ",
fprintf(f, "\n dbitrate %d dsample-point %.3f ",
dbt->bitrate, (float)dbt->sample_point / 1000.);
fprintf(f, "\n "
"dtq %d dprop-seg %d dphase-seg1 %d "
fprintf(f, "\n dtq %d dprop-seg %d dphase-seg1 %d "
"dphase-seg2 %d dsjw %d",
dbt->tq, dbt->prop_seg, dbt->phase_seg1,
dbt->phase_seg2, dbt->sjw);
......@@ -328,8 +321,7 @@ static void can_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
struct can_bittiming_const *dbtc =
RTA_DATA(tb[IFLA_CAN_DATA_BITTIMING_CONST]);
fprintf(f, "\n "
"%s: dtseg1 %d..%d dtseg2 %d..%d "
fprintf(f, "\n %s: dtseg1 %d..%d dtseg2 %d..%d "
"dsjw 1..%d dbrp %d..%d dbrp-inc %d",
dbtc->name, dbtc->tseg1_min, dbtc->tseg1_max,
dbtc->tseg2_min, dbtc->tseg2_max, dbtc->sjw_max,
......@@ -351,8 +343,7 @@ static void can_print_xstats(struct link_util *lu,
if (xstats && RTA_PAYLOAD(xstats) == sizeof(*stats)) {
stats = RTA_DATA(xstats);
fprintf(f, "\n "
"re-started bus-errors arbit-lost "
fprintf(f, "\n re-started bus-errors arbit-lost "
"error-warn error-pass bus-off");
fprintf(f, "\n %-10d %-10d %-10d %-10d %-10d %-10d",
stats->restarts, stats->bus_error,
......
......@@ -62,7 +62,7 @@ static int geneve_parse_opt(struct link_util *lu, int argc, char **argv,
invarg("invalid remote address", *argv);
} else if (!matches(*argv, "ttl") ||
!matches(*argv, "hoplimit")) {
unsigned uval;
unsigned int uval;
NEXT_ARG();
if (strcmp(*argv, "inherit") != 0) {
......@@ -153,11 +153,13 @@ static void geneve_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
if (tb[IFLA_GENEVE_REMOTE]) {
__be32 addr = rta_getattr_u32(tb[IFLA_GENEVE_REMOTE]);
if (addr)
fprintf(f, "remote %s ",
format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
} else if (tb[IFLA_GENEVE_REMOTE6]) {
struct in6_addr addr;
memcpy(&addr, RTA_DATA(tb[IFLA_GENEVE_REMOTE6]), sizeof(struct in6_addr));
if (memcmp(&addr, &in6addr_any, sizeof(addr)) != 0) {
if (IN6_IS_ADDR_MULTICAST(&addr))
......@@ -168,6 +170,7 @@ static void geneve_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
if (tb[IFLA_GENEVE_TTL]) {
__u8 ttl = rta_getattr_u8(tb[IFLA_GENEVE_TTL]);
if (ttl)
fprintf(f, "ttl %d ", ttl);
}
......
......@@ -22,8 +22,7 @@
static void print_explain(FILE *f)
{
fprintf(f,
"Usage: ... ipoib [pkey PKEY] [mode {datagram | connected}]"
"[umcast {0|1}]\n"
"Usage: ... ipoib [pkey PKEY] [mode {datagram | connected}][umcast {0|1}]\n"
"\n"
"PKEY := 0x8001-0xffff\n"
);
......@@ -36,8 +35,7 @@ static void explain(void)
static int mode_arg(void)
{
fprintf(stderr, "Error: argument of \"mode\" must be \"datagram\""
"or \"connected\"\n");
fprintf(stderr, "Error: argument of \"mode\" must be \"datagram\"or \"connected\"\n");
return -1;
}
......
......@@ -30,8 +30,7 @@ static void explain(void)
static int mode_arg(void)
{
fprintf(stderr, "Error: argument of \"mode\" must be either \"l2\", "
"or \"l3\"\n");
fprintf(stderr, "Error: argument of \"mode\" must be either \"l2\", or \"l3\"\n");
return -1;
}
......@@ -41,6 +40,7 @@ static int ipvlan_parse_opt(struct link_util *lu, int argc, char **argv,
while (argc > 0) {
if (matches(*argv, "mode") == 0) {
__u16 mode = 0;
NEXT_ARG();
if (strcmp(*argv, "l2") == 0)
......
......@@ -41,9 +41,9 @@ static void explain(struct link_util *lu)
static int mode_arg(const char *arg)
{
fprintf(stderr, "Error: argument of \"mode\" must be \"private\", "
"\"vepa\", \"bridge\" or \"passthru\", not \"%s\"\n", arg);
return -1;
fprintf(stderr, "Error: argument of \"mode\" must be \"private\", \"vepa\", \"bridge\" or \"passthru\", not \"%s\"\n",
arg);
return -1;
}
static int macvlan_parse_opt(struct link_util *lu, int argc, char **argv,
......
......@@ -21,8 +21,7 @@
static void print_explain(FILE *f)
{
fprintf(f,
"Usage: ... vlan [ protocol VLANPROTO ] id VLANID"
" [ FLAG-LIST ]\n"
"Usage: ... vlan [ protocol VLANPROTO ] id VLANID [ FLAG-LIST ]\n"
" [ ingress-qos-map QOS-MAP ] [ egress-qos-map QOS-MAP ]\n"
"\n"
"VLANPROTO: [ 802.1Q / 802.1ad ]\n"
......@@ -182,7 +181,7 @@ static void vlan_print_flags(FILE *fp, __u32 flags)
{
fprintf(fp, "<");
#define _PF(f) if (flags & VLAN_FLAG_##f) { \
flags &= ~ VLAN_FLAG_##f; \
flags &= ~VLAN_FLAG_##f; \
fprintf(fp, #f "%s", flags ? "," : ""); \
}
_PF(REORDER_HDR);
......@@ -198,6 +197,7 @@ static void vlan_print_flags(FILE *fp, __u32 flags)
static void vlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
{
struct ifla_vlan_flags *flags;
SPRINT_BUF(b1);
if (!tb)
......
......@@ -20,7 +20,7 @@
static void vrf_explain(FILE *f)
{
fprintf(f, "Usage: ... vrf table TABLEID \n");
fprintf(f, "Usage: ... vrf table TABLEID\n");
}
static void explain(void)
......@@ -91,8 +91,8 @@ struct link_util vrf_link_util = {
};
struct link_util vrf_slave_link_util = {
.id = "vrf",
.maxattr = IFLA_VRF_PORT_MAX,
.id = "vrf",
.maxattr = IFLA_VRF_PORT_MAX,
.print_opt = vrf_slave_print_opt,
.slave = true,
.slave = true,
};
......@@ -55,7 +55,7 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
struct in6_addr saddr6 = IN6ADDR_ANY_INIT;
struct in6_addr gaddr6 = IN6ADDR_ANY_INIT;
struct in6_addr daddr6 = IN6ADDR_ANY_INIT;
unsigned link = 0;
unsigned int link = 0;
__u8 tos = 0;
__u8 ttl = 0;
__u8 learning = 1;
......@@ -122,7 +122,7 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
}
} else if (!matches(*argv, "ttl") ||
!matches(*argv, "hoplimit")) {
unsigned uval;
unsigned int uval;
NEXT_ARG();
if (strcmp(*argv, "inherit") != 0) {
......@@ -158,6 +158,7 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
} else if (!matches(*argv, "port") ||
!matches(*argv, "srcport")) {
__u16 minport, maxport;
NEXT_ARG();
if (get_u16(&minport, *argv, 0))
invarg("min port", *argv);
......@@ -166,7 +167,7 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
invarg("max port", *argv);
range.low = htons(minport);
range.high = htons(maxport);
} else if (!matches(*argv, "dstport")){
} else if (!matches(*argv, "dstport")) {
NEXT_ARG();
if (get_u16(&dstport, *argv, 0))
invarg("dst port", *argv);
......@@ -306,7 +307,7 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
{
__u32 vni;
unsigned link;
unsigned int link;
__u8 tos;
__u32 maxaddr;
char s1[1024];
......@@ -324,6 +325,7 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
if (tb[IFLA_VXLAN_GROUP]) {
__be32 addr = rta_getattr_u32(tb[IFLA_VXLAN_GROUP]);
if (addr) {
if (IN_MULTICAST(ntohl(addr)))
fprintf(f, "group %s ",
......@@ -334,6 +336,7 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
}
} else if (tb[IFLA_VXLAN_GROUP6]) {
struct in6_addr addr;
memcpy(&addr, RTA_DATA(tb[IFLA_VXLAN_GROUP6]), sizeof(struct in6_addr));
if (memcmp(&addr, &in6addr_any, sizeof(addr)) != 0) {
if (IN6_IS_ADDR_MULTICAST(&addr))
......@@ -347,11 +350,13 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
if (tb[IFLA_VXLAN_LOCAL]) {
__be32 addr = rta_getattr_u32(tb[IFLA_VXLAN_LOCAL]);
if (addr)
fprintf(f, "local %s ",
format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
} else if (tb[IFLA_VXLAN_LOCAL6]) {
struct in6_addr addr;
memcpy(&addr, RTA_DATA(tb[IFLA_VXLAN_LOCAL6]), sizeof(struct in6_addr));
if (memcmp(&addr, &in6addr_any, sizeof(addr)) != 0)
fprintf(f, "local %s ",
......@@ -404,12 +409,14 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
if (tb[IFLA_VXLAN_TTL]) {
__u8 ttl = rta_getattr_u8(tb[IFLA_VXLAN_TTL]);
if (ttl)
fprintf(f, "ttl %d ", ttl);
}
if (tb[IFLA_VXLAN_AGEING]) {
__u32 age = rta_getattr_u32(tb[IFLA_VXLAN_AGEING]);
if (age == 0)
fprintf(f, "ageing none ");
else
......
......@@ -50,6 +50,7 @@ static int parse_hex(char *str, unsigned char *addr, size_t size)
while (*str && (len < 2 * size)) {
int tmp;
if (str[1] == 0)
return -1;
if (sscanf(str, "%02x", &tmp) != 1)
......@@ -61,8 +62,7 @@ static int parse_hex(char *str, unsigned char *addr, size_t size)
return len;
}
struct ma_info
{
struct ma_info {
struct ma_info *next;
int index;
int users;
......@@ -105,7 +105,7 @@ static void read_dev_mcast(struct ma_info **result_p)
m.addr.family = AF_PACKET;
len = parse_hex(hexa, (unsigned char*)&m.addr.data, sizeof (m.addr.data));
len = parse_hex(hexa, (unsigned char *)&m.addr.data, sizeof(m.addr.data));
if (len >= 0) {
struct ma_info *ma = malloc(sizeof(m));
......@@ -149,7 +149,7 @@ static void read_igmp(struct ma_info **result_p)
if (filter.dev && strcmp(filter.dev, m.name))
continue;
sscanf(buf, "%08x%d", (__u32*)&m.addr.data, &m.users);
sscanf(buf, "%08x%d", (__u32 *)&m.addr.data, &m.users);
ma = malloc(sizeof(m));
memcpy(ma, &m, sizeof(m));
......@@ -180,7 +180,7 @@ static void read_igmp6(struct ma_info **result_p)
m.addr.family = AF_INET6;
len = parse_hex(hexa, (unsigned char*)&m.addr.data, sizeof (m.addr.data));
len = parse_hex(hexa, (unsigned char *)&m.addr.data, sizeof(m.addr.data));
if (len >= 0) {
struct ma_info *ma = malloc(sizeof(m));
......@@ -200,12 +200,13 @@ static void print_maddr(FILE *fp, struct ma_info *list)
if (list->addr.family == AF_PACKET) {
SPRINT_BUF(b1);
fprintf(fp, "link %s", ll_addr_n2a((unsigned char*)list->addr.data,
fprintf(fp, "link %s", ll_addr_n2a((unsigned char *)list->addr.data,
list->addr.bytelen, 0,
b1, sizeof(b1)));
} else {
char abuf[256];
switch(list->addr.family) {
switch (list->addr.family) {
case AF_INET:
fprintf(fp, "inet ");
break;
......@@ -256,8 +257,7 @@ static int multiaddr_list(int argc, char **argv)
if (1) {
if (strcmp(*argv, "dev") == 0) {
NEXT_ARG();
}
else if (matches(*argv, "help") == 0)
} else if (matches(*argv, "help") == 0)
usage();
if (filter.dev)
duparg2("dev", *argv);
......@@ -320,7 +320,7 @@ static int multiaddr_modify(int cmd, int argc, char **argv)
perror("Cannot create socket");
exit(1);
}
if (ioctl(fd, cmd, (char*)&ifr) != 0) {
if (ioctl(fd, cmd, (char *)&ifr) != 0) {
perror("ioctl");
exit(1);
}
......
......@@ -30,8 +30,7 @@ int listen_all_nsid;
static void usage(void)
{
fprintf(stderr, "Usage: ip monitor [ all | LISTofOBJECTS ] [ FILE ] "
"[ label ] [all-nsid] [dev DEVICE]\n");
fprintf(stderr, "Usage: ip monitor [ all | LISTofOBJECTS ] [ FILE ] [ label ] [all-nsid] [dev DEVICE]\n");
fprintf(stderr, "LISTofOBJECTS := link | address | route | mroute | prefix |\n");
fprintf(stderr, " neigh | netconf | rule | nsid\n");
fprintf(stderr, "FILE := file FILENAME\n");
......@@ -58,7 +57,7 @@ static int accept_msg(const struct sockaddr_nl *who,
struct rtnl_ctrl_data *ctrl,
struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE*)arg;
FILE *fp = (FILE *)arg;
if (n->nlmsg_type == RTM_NEWROUTE || n->nlmsg_type == RTM_DELROUTE) {
struct rtmsg *r = NLMSG_DATA(n);
......@@ -139,8 +138,8 @@ static int accept_msg(const struct sockaddr_nl *who,
}
if (n->nlmsg_type != NLMSG_ERROR && n->nlmsg_type != NLMSG_NOOP &&
n->nlmsg_type != NLMSG_DONE) {
fprintf(fp, "Unknown message: type=0x%08x(%d) flags=0x%08x(%d)"
"len=0x%08x(%d)\n", n->nlmsg_type, n->nlmsg_type,
fprintf(fp, "Unknown message: type=0x%08x(%d) flags=0x%08x(%d)len=0x%08x(%d)\n",
n->nlmsg_type, n->nlmsg_type,
n->nlmsg_flags, n->nlmsg_flags, n->nlmsg_len,
n->nlmsg_len);
}
......@@ -150,17 +149,17 @@ static int accept_msg(const struct sockaddr_nl *who,
int do_ipmonitor(int argc, char **argv)
{
char *file = NULL;
unsigned groups = 0;
int llink=0;
int laddr=0;
int lroute=0;
int lmroute=0;
int lprefix=0;
int lneigh=0;
int lnetconf=0;
int lrule=0;
int lnsid=0;
int ifindex=0;
unsigned int groups = 0;
int llink = 0;
int laddr = 0;
int lroute = 0;
int lmroute = 0;
int lprefix = 0;
int lneigh = 0;
int lnetconf = 0;
int lrule = 0;
int lnsid = 0;
int ifindex = 0;
groups |= nl_mgrp(RTNLGRP_LINK);
groups |= nl_mgrp(RTNLGRP_IPV4_IFADDR);
......@@ -187,19 +186,19 @@ int do_ipmonitor(int argc, char **argv)
} else if (matches(*argv, "label") == 0) {
prefix_banner = 1;
} else if (matches(*argv, "link") == 0) {
llink=1;
llink = 1;
groups = 0;
} else if (matches(*argv, "address") == 0) {
laddr=1;
laddr = 1;
groups = 0;
} else if (matches(*argv, "route") == 0) {
lroute=1;
lroute = 1;
groups = 0;
} else if (matches(*argv, "mroute") == 0) {
lmroute=1;
lmroute = 1;
groups = 0;
} else if (matches(*argv, "prefix") == 0) {
lprefix=1;
lprefix = 1;
groups = 0;
} else if (matches(*argv, "neigh") == 0) {
lneigh = 1;
......@@ -214,7 +213,7 @@ int do_ipmonitor(int argc, char **argv)
lnsid = 1;
groups = 0;
} else if (strcmp(*argv, "all") == 0) {
prefix_banner=1;
prefix_banner = 1;
} else if (matches(*argv, "all-nsid") == 0) {
listen_all_nsid = 1;
} else if (matches(*argv, "help") == 0) {
......
......@@ -44,8 +44,7 @@ static void usage(void)
exit(-1);
}
struct rtfilter
{
struct rtfilter {
int tb;
int af;
int iif;
......@@ -55,12 +54,13 @@ struct rtfilter
int print_mroute(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE*)arg;
FILE *fp = (FILE *)arg;
struct rtmsg *r = NLMSG_DATA(n);
int len = n->nlmsg_len;
struct rtattr * tb[RTA_MAX+1];
struct rtattr *tb[RTA_MAX+1];
char abuf[256];
char obuf[256];
SPRINT_BUF(b1);
__u32 table;
int iif = 0;
......@@ -90,7 +90,7 @@ int print_mroute(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
return 0;
if (tb[RTA_IIF])
iif = *(int*)RTA_DATA(tb[RTA_IIF]);
iif = *(int *)RTA_DATA(tb[RTA_IIF]);
if (filter.iif && filter.iif != iif)
return 0;
......@@ -212,6 +212,7 @@ static int mroute_list(int argc, char **argv)
while (argc > 0) {
if (matches(*argv, "table") == 0) {
__u32 tid;
NEXT_ARG();
if (rtnl_rttable_a2n(&tid, *argv)) {
if (strcmp(*argv, "all") == 0) {
......
......@@ -31,7 +31,7 @@
static struct
{
int family;
int index;
int index;
int state;
int unused_only;
inet_prefix pfx;
......@@ -50,11 +50,11 @@ static void usage(void)
" { ADDR [ lladdr LLADDR ] [ nud STATE ] | proxy ADDR } [ dev DEV ]\n");
fprintf(stderr, " ip neigh { show | flush } [ proxy ] [ to PREFIX ] [ dev DEV ] [ nud STATE ]\n\n");
fprintf(stderr, "STATE := { permanent | noarp | stale | reachable | none |\n"
" incomplete | delay | probe | failed }\n");
" incomplete | delay | probe | failed }\n");
exit(-1);
}
static int nud_state_a2n(unsigned *state, const char *arg)
static int nud_state_a2n(unsigned int *state, const char *arg)
{
if (matches(arg, "permanent") == 0)
*state = NUD_PERMANENT;
......@@ -77,7 +77,7 @@ static int nud_state_a2n(unsigned *state, const char *arg)
else {
if (get_unsigned(state, arg, 0))
return -1;
if (*state>=0x100 || (*state&((*state)-1)))
if (*state >= 0x100 || (*state&((*state)-1)))
return -1;
}
return 0;
......@@ -99,13 +99,13 @@ static int ipneigh_modify(int cmd, int flags, int argc, char **argv)
struct {
struct nlmsghdr n;
struct ndmsg ndm;
char buf[256];
char buf[256];
} req;
char *dev = NULL;
int dst_ok = 0;
int dev_ok = 0;
int lladdr_ok = 0;
char * lla = NULL;
char *lla = NULL;
inet_prefix dst;
memset(&req, 0, sizeof(req));
......@@ -124,7 +124,8 @@ static int ipneigh_modify(int cmd, int flags, int argc, char **argv)
lla = *argv;
lladdr_ok = 1;
} else if (strcmp(*argv, "nud") == 0) {
unsigned state;
unsigned int state;
NEXT_ARG();
if (nud_state_a2n(&state, *argv))
invarg("nud state is bad", *argv);
......@@ -193,10 +194,10 @@ static int ipneigh_modify(int cmd, int flags, int argc, char **argv)
int print_neigh(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE*)arg;
FILE *fp = (FILE *)arg;
struct ndmsg *r = NLMSG_DATA(n);
int len = n->nlmsg_len;
struct rtattr * tb[NDA_MAX+1];
struct rtattr *tb[NDA_MAX+1];
char abuf[256];
static int logit = 1;
......@@ -223,7 +224,7 @@ int print_neigh(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
if (!(filter.state&r->ndm_state) &&
!(r->ndm_flags & NTF_PROXY) &&
(r->ndm_state || !(filter.state&0x100)) &&
(r->ndm_family != AF_DECnet))
(r->ndm_family != AF_DECnet))
return 0;
if (filter.master && !(n->nlmsg_flags & NLM_F_DUMP_FILTERED)) {
......@@ -239,6 +240,7 @@ int print_neigh(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
if (tb[NDA_DST]) {
if (filter.pfx.family) {
inet_prefix dst;
memset(&dst, 0, sizeof(dst));
dst.family = r->ndm_family;
memcpy(&dst.data, RTA_DATA(tb[NDA_DST]), RTA_PAYLOAD(tb[NDA_DST]));
......@@ -248,22 +250,24 @@ int print_neigh(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
}
if (filter.unused_only && tb[NDA_CACHEINFO]) {
struct nda_cacheinfo *ci = RTA_DATA(tb[NDA_CACHEINFO]);
if (ci->ndm_refcnt)
return 0;
}
if (filter.flushb) {
struct nlmsghdr *fn;
if (NLMSG_ALIGN(filter.flushp) + n->nlmsg_len > filter.flushe) {
if (flush_update())
return -1;
}
fn = (struct nlmsghdr*)(filter.flushb + NLMSG_ALIGN(filter.flushp));
fn = (struct nlmsghdr *)(filter.flushb + NLMSG_ALIGN(filter.flushp));
memcpy(fn, n, n->nlmsg_len);
fn->nlmsg_type = RTM_DELNEIGH;
fn->nlmsg_flags = NLM_F_REQUEST;
fn->nlmsg_seq = ++rth.seq;
filter.flushp = (((char*)fn) + n->nlmsg_len) - filter.flushb;
filter.flushp = (((char *)fn) + n->nlmsg_len) - filter.flushb;
filter.flushed++;
if (show_stats < 2)
return 0;
......@@ -307,11 +311,13 @@ int print_neigh(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
if (tb[NDA_PROBES] && show_stats) {
__u32 p = rta_getattr_u32(tb[NDA_PROBES]);
fprintf(fp, " probes %u", p);
}
if (r->ndm_state) {
int nud = r->ndm_state;
fprintf(fp, " ");
#define PRINT_FLAG(f) if (nud & NUD_##f) { \
......@@ -344,7 +350,7 @@ static int do_show_or_flush(int argc, char **argv, int flush)
struct {
struct nlmsghdr n;
struct ndmsg ndm;
char buf[256];
char buf[256];
} req;
char *filter_dev = NULL;
int state_given = 0;
......@@ -376,6 +382,7 @@ static int do_show_or_flush(int argc, char **argv, int flush)
filter_dev = *argv;
} else if (strcmp(*argv, "master") == 0) {
int ifindex;
NEXT_ARG();
ifindex = ll_name_to_index(*argv);
if (!ifindex)
......@@ -385,7 +392,8 @@ static int do_show_or_flush(int argc, char **argv, int flush)
} else if (strcmp(*argv, "unused") == 0) {
filter.unused_only = 1;
} else if (strcmp(*argv, "nud") == 0) {
unsigned state;
unsigned int state;
NEXT_ARG();
if (!state_given) {
state_given = 1;
......@@ -450,7 +458,7 @@ static int do_show_or_flush(int argc, char **argv, int flush)
if (round == 0)
printf("Nothing to flush.\n");
else
printf("*** Flush is complete after %d round%s ***\n", round, round>1?"s":"");
printf("*** Flush is complete after %d round%s ***\n", round, round > 1?"s":"");
}
fflush(stdout);
return 0;
......
......@@ -38,12 +38,12 @@ static void usage(void)
exit(-1);
}
#define NETCONF_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct netconfmsg))))
#define NETCONF_RTA(r) ((struct rtattr *)(((char *)(r)) + NLMSG_ALIGN(sizeof(struct netconfmsg))))
int print_netconf(const struct sockaddr_nl *who, struct rtnl_ctrl_data *ctrl,
struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE*)arg;
FILE *fp = (FILE *)arg;
struct netconfmsg *ncm = NLMSG_DATA(n);
int len = n->nlmsg_len;
struct rtattr *tb[NETCONFA_MAX+1];
......
......@@ -389,6 +389,7 @@ static int cmd_exec(const char *cmd, char **argv, bool do_fork)
static int on_netns_exec(char *nsname, void *arg)
{
char **argv = arg;
cmd_exec(argv[1], argv + 1, true);
return 0;
}
......@@ -426,6 +427,7 @@ static int netns_exec(int argc, char **argv)
static int is_pid(const char *str)
{
int ch;
for (; (ch = *str); str++) {
if (!isdigit(ch))
return 0;
......@@ -470,9 +472,10 @@ static int netns_pids(int argc, char **argv)
strerror(errno));
return -1;
}
while((entry = readdir(dir))) {
while ((entry = readdir(dir))) {
char pid_net_path[PATH_MAX];
struct stat st;
if (!is_pid(entry->d_name))
continue;
snprintf(pid_net_path, sizeof(pid_net_path), "/proc/%s/ns/net",
......@@ -535,7 +538,7 @@ static int netns_identify(int argc, char **argv)
return -1;
}
while((entry = readdir(dir))) {
while ((entry = readdir(dir))) {
char name_path[PATH_MAX];
struct stat st;
......@@ -737,6 +740,7 @@ static int netns_monitor(int argc, char **argv)
char buf[4096];
struct inotify_event *event;
int fd;
fd = inotify_init();
if (fd < 0) {
fprintf(stderr, "inotify_init failed: %s\n",
......@@ -752,8 +756,9 @@ static int netns_monitor(int argc, char **argv)
strerror(errno));
return -1;
}
for(;;) {
for (;;) {
ssize_t len = read(fd, buf, sizeof(buf));
if (len < 0) {
fprintf(stderr, "read failed: %s\n",
strerror(errno));
......
......@@ -35,7 +35,7 @@
static struct
{
int family;
int index;
int index;
#define NONE_DEV (-1)
char name[1024];
} filter;
......@@ -65,7 +65,7 @@ static int ipntable_modify(int cmd, int flags, int argc, char **argv)
struct {
struct nlmsghdr n;
struct ndtmsg ndtm;
char buf[1024];
char buf[1024];
} req;
char *namep = NULL;
char *threshsp = NULL;
......@@ -351,7 +351,7 @@ static const char *ntable_strtime_delta(__u32 msec)
static int print_ntable(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE*)arg;
FILE *fp = (FILE *)arg;
struct ndtmsg *ndtm = NLMSG_DATA(n);
int len = n->nlmsg_len;
struct rtattr *tb[NDTA_MAX+1];
......@@ -407,6 +407,7 @@ static int print_ntable(const struct sockaddr_nl *who, struct nlmsghdr *n, void
if (tb[NDTA_NAME]) {
const char *name = rta_getattr_str(tb[NDTA_NAME]);
fprintf(fp, "%s ", name);
}
......@@ -419,18 +420,22 @@ static int print_ntable(const struct sockaddr_nl *who, struct nlmsghdr *n, void
if (tb[NDTA_THRESH1]) {
__u32 thresh1 = rta_getattr_u32(tb[NDTA_THRESH1]);
fprintf(fp, "thresh1 %u ", thresh1);
}
if (tb[NDTA_THRESH2]) {
__u32 thresh2 = rta_getattr_u32(tb[NDTA_THRESH2]);
fprintf(fp, "thresh2 %u ", thresh2);
}
if (tb[NDTA_THRESH3]) {
__u32 thresh3 = rta_getattr_u32(tb[NDTA_THRESH3]);
fprintf(fp, "thresh3 %u ", thresh3);
}
if (tb[NDTA_GC_INTERVAL]) {
unsigned long long gc_int = rta_getattr_u64(tb[NDTA_GC_INTERVAL]);
fprintf(fp, "gc_int %llu ", gc_int);
}
......@@ -480,18 +485,22 @@ static int print_ntable(const struct sockaddr_nl *who, struct nlmsghdr *n, void
if (tpb[NDTPA_REFCNT]) {
__u32 refcnt = rta_getattr_u32(tpb[NDTPA_REFCNT]);
fprintf(fp, "refcnt %u ", refcnt);
}
if (tpb[NDTPA_REACHABLE_TIME]) {
unsigned long long reachable = rta_getattr_u64(tpb[NDTPA_REACHABLE_TIME]);
fprintf(fp, "reachable %llu ", reachable);
}
if (tpb[NDTPA_BASE_REACHABLE_TIME]) {
unsigned long long breachable = rta_getattr_u64(tpb[NDTPA_BASE_REACHABLE_TIME]);
fprintf(fp, "base_reachable %llu ", breachable);
}
if (tpb[NDTPA_RETRANS_TIME]) {
unsigned long long retrans = rta_getattr_u64(tpb[NDTPA_RETRANS_TIME]);
fprintf(fp, "retrans %llu ", retrans);
}
......@@ -501,14 +510,17 @@ static int print_ntable(const struct sockaddr_nl *who, struct nlmsghdr *n, void
if (tpb[NDTPA_GC_STALETIME]) {
unsigned long long gc_stale = rta_getattr_u64(tpb[NDTPA_GC_STALETIME]);
fprintf(fp, "gc_stale %llu ", gc_stale);
}
if (tpb[NDTPA_DELAY_PROBE_TIME]) {
unsigned long long delay_probe = rta_getattr_u64(tpb[NDTPA_DELAY_PROBE_TIME]);
fprintf(fp, "delay_probe %llu ", delay_probe);
}
if (tpb[NDTPA_QUEUE_LEN]) {
__u32 queue = rta_getattr_u32(tpb[NDTPA_QUEUE_LEN]);
fprintf(fp, "queue %u ", queue);
}
......@@ -518,14 +530,17 @@ static int print_ntable(const struct sockaddr_nl *who, struct nlmsghdr *n, void
if (tpb[NDTPA_APP_PROBES]) {
__u32 aprobe = rta_getattr_u32(tpb[NDTPA_APP_PROBES]);
fprintf(fp, "app_probes %u ", aprobe);
}
if (tpb[NDTPA_UCAST_PROBES]) {
__u32 uprobe = rta_getattr_u32(tpb[NDTPA_UCAST_PROBES]);
fprintf(fp, "ucast_probes %u ", uprobe);
}
if (tpb[NDTPA_MCAST_PROBES]) {
__u32 mprobe = rta_getattr_u32(tpb[NDTPA_MCAST_PROBES]);
fprintf(fp, "mcast_probes %u ", mprobe);
}
......@@ -535,18 +550,22 @@ static int print_ntable(const struct sockaddr_nl *who, struct nlmsghdr *n, void
if (tpb[NDTPA_ANYCAST_DELAY]) {
unsigned long long anycast_delay = rta_getattr_u64(tpb[NDTPA_ANYCAST_DELAY]);
fprintf(fp, "anycast_delay %llu ", anycast_delay);
}
if (tpb[NDTPA_PROXY_DELAY]) {
unsigned long long proxy_delay = rta_getattr_u64(tpb[NDTPA_PROXY_DELAY]);
fprintf(fp, "proxy_delay %llu ", proxy_delay);
}
if (tpb[NDTPA_PROXY_QLEN]) {
__u32 pqueue = rta_getattr_u32(tpb[NDTPA_PROXY_QLEN]);
fprintf(fp, "proxy_queue %u ", pqueue);
}
if (tpb[NDTPA_LOCKTIME]) {
unsigned long long locktime = rta_getattr_u64(tpb[NDTPA_LOCKTIME]);
fprintf(fp, "locktime %llu ", locktime);
}
......
......@@ -37,10 +37,10 @@
int print_prefix(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE*)arg;
FILE *fp = (FILE *)arg;
struct prefixmsg *prefix = NLMSG_DATA(n);
int len = n->nlmsg_len;
struct rtattr * tb[RTA_MAX+1];
struct rtattr *tb[RTA_MAX+1];
int family = preferred_family;
if (n->nlmsg_type != RTM_NEWPREFIX) {
......@@ -96,6 +96,7 @@ int print_prefix(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
if (tb[PREFIX_CACHEINFO]) {
struct prefix_cacheinfo *pc;
pc = (struct prefix_cacheinfo *)RTA_DATA(tb[PREFIX_CACHEINFO]);
fprintf(fp, "valid %u ", pc->valid_time);
......
This diff is collapsed.
......@@ -7,7 +7,7 @@
* 2 of the License, or (at your option) any later version.
*
* Authors: Roopa Prabhu, <roopa@cumulusnetworks.com>
* Thomas Graf <tgraf@suug.ch>
* Thomas Graf <tgraf@suug.ch>
*
*/
......@@ -203,6 +203,7 @@ static int parse_encap_ip(struct rtattr *rta, size_t len, int *argcp, char ***ar
while (argc > 0) {
if (strcmp(*argv, "id") == 0) {
__u64 id;
NEXT_ARG();
if (id_ok++)
duparg2("id", *argv);
......@@ -211,6 +212,7 @@ static int parse_encap_ip(struct rtattr *rta, size_t len, int *argcp, char ***ar
rta_addattr64(rta, len, LWTUNNEL_IP_ID, htonll(id));
} else if (strcmp(*argv, "dst") == 0) {
inet_prefix addr;
NEXT_ARG();
if (dst_ok++)
duparg2("dst", *argv);
......@@ -218,6 +220,7 @@ static int parse_encap_ip(struct rtattr *rta, size_t len, int *argcp, char ***ar
rta_addattr_l(rta, len, LWTUNNEL_IP_DST, &addr.data, addr.bytelen);
} else if (strcmp(*argv, "tos") == 0) {
__u32 tos;
NEXT_ARG();
if (tos_ok++)
duparg2("tos", *argv);
......@@ -226,6 +229,7 @@ static int parse_encap_ip(struct rtattr *rta, size_t len, int *argcp, char ***ar
rta_addattr8(rta, len, LWTUNNEL_IP_TOS, tos);
} else if (strcmp(*argv, "ttl") == 0) {
__u8 ttl;
NEXT_ARG();
if (ttl_ok++)
duparg2("ttl", *argv);
......@@ -276,6 +280,7 @@ static int parse_encap_ip6(struct rtattr *rta, size_t len, int *argcp, char ***a
while (argc > 0) {
if (strcmp(*argv, "id") == 0) {
__u64 id;
NEXT_ARG();
if (id_ok++)
duparg2("id", *argv);
......@@ -284,6 +289,7 @@ static int parse_encap_ip6(struct rtattr *rta, size_t len, int *argcp, char ***a
rta_addattr64(rta, len, LWTUNNEL_IP6_ID, htonll(id));
} else if (strcmp(*argv, "dst") == 0) {
inet_prefix addr;
NEXT_ARG();
if (dst_ok++)
duparg2("dst", *argv);
......@@ -291,6 +297,7 @@ static int parse_encap_ip6(struct rtattr *rta, size_t len, int *argcp, char ***a
rta_addattr_l(rta, len, LWTUNNEL_IP6_DST, &addr.data, addr.bytelen);
} else if (strcmp(*argv, "tc") == 0) {
__u32 tc;
NEXT_ARG();
if (tos_ok++)
duparg2("tc", *argv);
......@@ -299,6 +306,7 @@ static int parse_encap_ip6(struct rtattr *rta, size_t len, int *argcp, char ***a
rta_addattr8(rta, len, LWTUNNEL_IP6_TC, tc);
} else if (strcmp(*argv, "hoplimit") == 0) {
__u8 hoplimit;
NEXT_ARG();
if (ttl_ok++)
duparg2("hoplimit", *argv);
......
......@@ -51,13 +51,14 @@ static void usage(void)
int print_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE*)arg;
FILE *fp = (FILE *)arg;
struct rtmsg *r = NLMSG_DATA(n);
int len = n->nlmsg_len;
int host_len = -1;
__u32 table;
struct rtattr * tb[FRA_MAX+1];
struct rtattr *tb[FRA_MAX+1];
char abuf[256];
SPRINT_BUF(b1);
if (n->nlmsg_type != RTM_NEWRULE && n->nlmsg_type != RTM_DELRULE)
......@@ -75,7 +76,7 @@ int print_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
fprintf(fp, "Deleted ");
if (tb[FRA_PRIORITY])
fprintf(fp, "%u:\t", *(unsigned*)RTA_DATA(tb[FRA_PRIORITY]));
fprintf(fp, "%u:\t", *(unsigned *)RTA_DATA(tb[FRA_PRIORITY]));
else
fprintf(fp, "0:\t");
......@@ -157,12 +158,14 @@ int print_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
if (tb[FRA_SUPPRESS_PREFIXLEN]) {
int pl = rta_getattr_u32(tb[FRA_SUPPRESS_PREFIXLEN]);
if (pl != -1) {
fprintf(fp, "suppress_prefixlength %d ", pl);
}
}
if (tb[FRA_SUPPRESS_IFGROUP]) {
int group = rta_getattr_u32(tb[FRA_SUPPRESS_IFGROUP]);
if (group != -1) {
SPRINT_BUF(b1);
fprintf(fp, "suppress_ifgroup %s ", rtnl_group_n2a(group, b1, sizeof(b1)));
......@@ -173,6 +176,7 @@ int print_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
if (tb[FRA_FLOW]) {
__u32 to = rta_getattr_u32(tb[FRA_FLOW]);
__u32 from = to>>16;
to &= 0xFFFF;
if (from) {
fprintf(fp, "realms %s/",
......@@ -326,7 +330,7 @@ static int iprule_modify(int cmd, int argc, char **argv)
struct {
struct nlmsghdr n;
struct rtmsg r;
char buf[1024];
char buf[1024];
} req;
memset(&req, 0, sizeof(req));
......@@ -351,12 +355,14 @@ static int iprule_modify(int cmd, int argc, char **argv)
req.r.rtm_flags |= FIB_RULE_INVERT;
} else if (strcmp(*argv, "from") == 0) {
inet_prefix dst;
NEXT_ARG();
get_prefix(&dst, *argv, req.r.rtm_family);
req.r.rtm_src_len = dst.bitlen;
addattr_l(&req.n, sizeof(req), FRA_SRC, &dst.data, dst.bytelen);
} else if (strcmp(*argv, "to") == 0) {
inet_prefix dst;
NEXT_ARG();
get_prefix(&dst, *argv, req.r.rtm_family);
req.r.rtm_dst_len = dst.bitlen;
......@@ -365,6 +371,7 @@ static int iprule_modify(int cmd, int argc, char **argv)
matches(*argv, "order") == 0 ||
matches(*argv, "priority") == 0) {
__u32 pref;
NEXT_ARG();
if (get_u32(&pref, *argv, 0))
invarg("preference value is invalid\n", *argv);
......@@ -372,6 +379,7 @@ static int iprule_modify(int cmd, int argc, char **argv)
} else if (strcmp(*argv, "tos") == 0 ||
matches(*argv, "dsfield") == 0) {
__u32 tos;
NEXT_ARG();
if (rtnl_dsfield_a2n(&tos, *argv))
invarg("TOS value is invalid\n", *argv);
......@@ -379,6 +387,7 @@ static int iprule_modify(int cmd, int argc, char **argv)
} else if (strcmp(*argv, "fwmark") == 0) {
char *slash;
__u32 fwmark, fwmask;
NEXT_ARG();
if ((slash = strchr(*argv, '/')) != NULL)
*slash = '\0';
......@@ -392,6 +401,7 @@ static int iprule_modify(int cmd, int argc, char **argv)
}
} else if (matches(*argv, "realms") == 0) {
__u32 realm;
NEXT_ARG();
if (get_rt_realms_or_raw(&realm, *argv))
invarg("invalid realms\n", *argv);
......@@ -399,6 +409,7 @@ static int iprule_modify(int cmd, int argc, char **argv)
} else if (matches(*argv, "table") == 0 ||
strcmp(*argv, "lookup") == 0) {
__u32 tid;
NEXT_ARG();
if (rtnl_rttable_a2n(&tid, *argv))
invarg("invalid table ID\n", *argv);
......@@ -412,6 +423,7 @@ static int iprule_modify(int cmd, int argc, char **argv)
} else if (matches(*argv, "suppress_prefixlength") == 0 ||
strcmp(*argv, "sup_pl") == 0) {
int pl;
NEXT_ARG();
if (get_s32(&pl, *argv, 0) || pl < 0)
invarg("suppress_prefixlength value is invalid\n", *argv);
......@@ -420,6 +432,7 @@ static int iprule_modify(int cmd, int argc, char **argv)
strcmp(*argv, "sup_group") == 0) {
NEXT_ARG();
int group;
if (rtnl_group_a2n(&group, *argv))
invarg("Invalid \"suppress_ifgroup\" value\n", *argv);
addattr32(&req.n, sizeof(req), FRA_SUPPRESS_IFGROUP, group);
......@@ -446,6 +459,7 @@ static int iprule_modify(int cmd, int argc, char **argv)
usage();
else if (matches(*argv, "goto") == 0) {
__u32 target;
type = FR_ACT_GOTO;
NEXT_ARG();
if (get_u32(&target, *argv, 0))
......@@ -480,7 +494,7 @@ static int flush_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *a
struct rtnl_handle rth2;
struct rtmsg *r = NLMSG_DATA(n);
int len = n->nlmsg_len;
struct rtattr * tb[FRA_MAX+1];
struct rtattr *tb[FRA_MAX+1];
len -= NLMSG_LENGTH(sizeof(*r));
if (len < 0)
......
......@@ -168,13 +168,11 @@ static int iptoken_set(int argc, char **argv)
}
if (!have_token) {
fprintf(stderr, "Not enough information: token "
"is required.\n");
fprintf(stderr, "Not enough information: token is required.\n");
return -1;
}
if (!have_dev) {
fprintf(stderr, "Not enough information: \"dev\" "
"argument is required.\n");
fprintf(stderr, "Not enough information: \"dev\" argument is required.\n");
return -1;
}
......
......@@ -36,7 +36,7 @@ static void usage(void) __attribute__((noreturn));
static void usage(void)
{
fprintf(stderr, "Usage: ip tuntap { add | del | show | list | lst | help } [ dev PHYS_DEV ] \n");
fprintf(stderr, "Usage: ip tuntap { add | del | show | list | lst | help } [ dev PHYS_DEV ]\n");
fprintf(stderr, " [ mode { tun | tap } ] [ user USER ] [ group GROUP ]\n");
fprintf(stderr, " [ one_queue ] [ pi ] [ vnet_hdr ] [ multi_queue ]\n");
fprintf(stderr, "\n");
......@@ -117,18 +117,18 @@ static int parse_args(int argc, char **argv, struct ifreq *ifr, uid_t *uid, gid_
NEXT_ARG();
if (matches(*argv, "tun") == 0) {
if (ifr->ifr_flags & IFF_TAP) {
fprintf(stderr,"You managed to ask for more than one tunnel mode.\n");
fprintf(stderr, "You managed to ask for more than one tunnel mode.\n");
exit(-1);
}
ifr->ifr_flags |= IFF_TUN;
} else if (matches(*argv, "tap") == 0) {
if (ifr->ifr_flags & IFF_TUN) {
fprintf(stderr,"You managed to ask for more than one tunnel mode.\n");
fprintf(stderr, "You managed to ask for more than one tunnel mode.\n");
exit(-1);
}
ifr->ifr_flags |= IFF_TAP;
} else {
fprintf(stderr,"Unknown tunnel mode \"%s\"\n", *argv);
fprintf(stderr, "Unknown tunnel mode \"%s\"\n", *argv);
exit(-1);
}
} else if (uid && matches(*argv, "user") == 0) {
......@@ -140,6 +140,7 @@ static int parse_args(int argc, char **argv, struct ifreq *ifr, uid_t *uid, gid_
*uid = user;
else {
struct passwd *pw = getpwnam(*argv);
if (!pw) {
fprintf(stderr, "invalid user \"%s\"\n", *argv);
exit(-1);
......@@ -156,6 +157,7 @@ static int parse_args(int argc, char **argv, struct ifreq *ifr, uid_t *uid, gid_
*gid = group;
else {
struct group *gr = getgrnam(*argv);
if (!gr) {
fprintf(stderr, "invalid group \"%s\"\n", *argv);
exit(-1);
......@@ -313,9 +315,9 @@ int do_iptuntap(int argc, char **argv)
if (matches(*argv, "delete") == 0)
return do_del(argc-1, argv+1);
if (matches(*argv, "show") == 0 ||
matches(*argv, "lst") == 0 ||
matches(*argv, "list") == 0)
return do_show(argc-1, argv+1);
matches(*argv, "lst") == 0 ||
matches(*argv, "list") == 0)
return do_show(argc-1, argv+1);
if (matches(*argv, "help") == 0)
usage();
} else
......
......@@ -50,7 +50,7 @@
strncat(buf, str, len); \
buf[sizeof(buf) - 1] = '\0'; \
} \
} while(0);
} while (0);
struct xfrm_filter filter;
......@@ -111,7 +111,7 @@ struct typeent {
int t_type;
};
static const struct typeent xfrmproto_types[]= {
static const struct typeent xfrmproto_types[] = {
{ "esp", IPPROTO_ESP }, { "ah", IPPROTO_AH }, { "comp", IPPROTO_COMP },
{ "route2", IPPROTO_ROUTING }, { "hao", IPPROTO_DSTOPTS },
{ "ipsec-any", IPSEC_PROTO_ANY },
......@@ -124,6 +124,7 @@ int xfrm_xfrmproto_getbyname(char *name)
for (i = 0; ; i++) {
const struct typeent *t = &xfrmproto_types[i];
if (!t->t_name || t->t_type == -1)
break;
......@@ -141,6 +142,7 @@ const char *strxf_xfrmproto(__u8 proto)
for (i = 0; ; i++) {
const struct typeent *t = &xfrmproto_types[i];
if (!t->t_name || t->t_type == -1)
break;
......@@ -152,7 +154,7 @@ const char *strxf_xfrmproto(__u8 proto)
return str;
}
static const struct typeent algo_types[]= {
static const struct typeent algo_types[] = {
{ "enc", XFRMA_ALG_CRYPT }, { "auth", XFRMA_ALG_AUTH },
{ "comp", XFRMA_ALG_COMP }, { "aead", XFRMA_ALG_AEAD },
{ "auth-trunc", XFRMA_ALG_AUTH_TRUNC },
......@@ -165,6 +167,7 @@ int xfrm_algotype_getbyname(char *name)
for (i = 0; ; i++) {
const struct typeent *t = &algo_types[i];
if (!t->t_name || t->t_type == -1)
break;
......@@ -182,6 +185,7 @@ const char *strxf_algotype(int type)
for (i = 0; ; i++) {
const struct typeent *t = &algo_types[i];
if (!t->t_name || t->t_type == -1)
break;
......@@ -302,6 +306,7 @@ void xfrm_id_info_print(xfrm_address_t *saddr, struct xfrm_id *id,
if (show_stats > 0 || force_spi || id->spi) {
__u32 spi = ntohl(id->spi);
fprintf(fp, "spi 0x%08x", spi);
if (show_stats > 0)
fprintf(fp, "(%u)", spi);
......@@ -340,6 +345,7 @@ void xfrm_id_info_print(xfrm_address_t *saddr, struct xfrm_id *id,
static const char *strxf_limit(__u64 limit)
{
static char str[32];
if (limit == XFRM_INF)
strcpy(str, "(INF)");
else
......@@ -389,7 +395,7 @@ void xfrm_lifetime_print(struct xfrm_lifetime_cfg *cfg,
if (cfg) {
if (prefix)
fputs(prefix, fp);
fprintf(fp, "lifetime config:%s",_SL_);
fprintf(fp, "lifetime config:%s", _SL_);
if (prefix)
fputs(prefix, fp);
......@@ -538,7 +544,7 @@ static void __xfrm_algo_print(struct xfrm_algo *algo, int type, int len,
if (keylen > 0) {
fprintf(fp, "0x");
for (i = 0; i < keylen; i ++)
for (i = 0; i < keylen; i++)
fprintf(fp, "%.2x", (unsigned char)algo->alg_key[i]);
if (show_stats > 0)
......@@ -692,36 +698,42 @@ void xfrm_xfrma_print(struct rtattr *tb[], __u16 family,
if (tb[XFRMA_MARK]) {
struct rtattr *rta = tb[XFRMA_MARK];
struct xfrm_mark *m = (struct xfrm_mark *) RTA_DATA(rta);
fprintf(fp, "\tmark %#x/%#x", m->v, m->m);
fprintf(fp, "%s", _SL_);
}
if (tb[XFRMA_ALG_AUTH] && !tb[XFRMA_ALG_AUTH_TRUNC]) {
struct rtattr *rta = tb[XFRMA_ALG_AUTH];
xfrm_algo_print((struct xfrm_algo *) RTA_DATA(rta),
XFRMA_ALG_AUTH, RTA_PAYLOAD(rta), fp, prefix);
}
if (tb[XFRMA_ALG_AUTH_TRUNC]) {
struct rtattr *rta = tb[XFRMA_ALG_AUTH_TRUNC];
xfrm_auth_trunc_print((struct xfrm_algo_auth *) RTA_DATA(rta),
RTA_PAYLOAD(rta), fp, prefix);
}
if (tb[XFRMA_ALG_AEAD]) {
struct rtattr *rta = tb[XFRMA_ALG_AEAD];
xfrm_aead_print((struct xfrm_algo_aead *)RTA_DATA(rta),
RTA_PAYLOAD(rta), fp, prefix);
}
if (tb[XFRMA_ALG_CRYPT]) {
struct rtattr *rta = tb[XFRMA_ALG_CRYPT];
xfrm_algo_print((struct xfrm_algo *) RTA_DATA(rta),
XFRMA_ALG_CRYPT, RTA_PAYLOAD(rta), fp, prefix);
}
if (tb[XFRMA_ALG_COMP]) {
struct rtattr *rta = tb[XFRMA_ALG_COMP];
xfrm_algo_print((struct xfrm_algo *) RTA_DATA(rta),
XFRMA_ALG_COMP, RTA_PAYLOAD(rta), fp, prefix);
}
......@@ -765,6 +777,7 @@ void xfrm_xfrma_print(struct rtattr *tb[], __u16 family,
if (tb[XFRMA_TMPL]) {
struct rtattr *rta = tb[XFRMA_TMPL];
xfrm_tmpl_print((struct xfrm_user_tmpl *) RTA_DATA(rta),
RTA_PAYLOAD(rta), fp, prefix);
}
......@@ -1140,11 +1153,11 @@ int xfrm_id_parse(xfrm_address_t *saddr, struct xfrm_id *id, __u16 *family,
if (id->spi && id->proto) {
if (xfrm_xfrmproto_is_ro(id->proto)) {
fprintf(stderr, "\"spi\" is invalid with XFRM-PROTO value \"%s\"\n",
strxf_xfrmproto(id->proto));
strxf_xfrmproto(id->proto));
exit(1);
} else if (id->proto == IPPROTO_COMP && ntohl(id->spi) >= 0x10000) {
fprintf(stderr, "SPI value is too large with XFRM-PROTO value \"%s\"\n",
strxf_xfrmproto(id->proto));
strxf_xfrmproto(id->proto));
exit(1);
}
}
......@@ -1238,6 +1251,7 @@ static int xfrm_selector_upspec_parse(struct xfrm_selector *sel,
upspec = 0;
else {
struct protoent *pp;
pp = getprotobyname(*argv);
if (pp)
upspec = pp->p_proto;
......@@ -1304,7 +1318,7 @@ static int xfrm_selector_upspec_parse(struct xfrm_selector *sel,
filter.upspec_dport_mask = XFRM_FILTER_MASK_FULL;
} else if (strcmp(*argv, "key") == 0) {
unsigned uval;
unsigned int uval;
grekey = *argv;
......@@ -1313,7 +1327,7 @@ static int xfrm_selector_upspec_parse(struct xfrm_selector *sel,
if (strchr(*argv, '.'))
uval = htonl(get_addr32(*argv));
else {
if (get_unsigned(&uval, *argv, 0)<0) {
if (get_unsigned(&uval, *argv, 0) < 0) {
fprintf(stderr, "value after \"key\" is invalid\n");
exit(-1);
}
......
......@@ -61,11 +61,11 @@ static int gre_parse_opt(struct link_util *lu, int argc, char **argv,
struct rtattr *greinfo[IFLA_GRE_MAX + 1];
__u16 iflags = 0;
__u16 oflags = 0;
unsigned ikey = 0;
unsigned okey = 0;
unsigned saddr = 0;
unsigned daddr = 0;
unsigned link = 0;
unsigned int ikey = 0;
unsigned int okey = 0;
unsigned int saddr = 0;
unsigned int daddr = 0;
unsigned int link = 0;
__u8 pmtudisc = 1;
__u8 ttl = 0;
__u8 tos = 0;
......@@ -156,7 +156,7 @@ get_failed:
while (argc > 0) {
if (!matches(*argv, "key")) {
unsigned uval;
unsigned int uval;
NEXT_ARG();
iflags |= GRE_KEY;
......@@ -174,14 +174,14 @@ get_failed:
ikey = okey = uval;
} else if (!matches(*argv, "ikey")) {
unsigned uval;
unsigned int uval;
NEXT_ARG();
iflags |= GRE_KEY;
if (strchr(*argv, '.'))
uval = get_addr32(*argv);
else {
if (get_unsigned(&uval, *argv, 0)<0) {
if (get_unsigned(&uval, *argv, 0) < 0) {
fprintf(stderr, "invalid value for \"ikey\": \"%s\"; it should be an unsigned integer\n", *argv);
exit(-1);
}
......@@ -189,14 +189,14 @@ get_failed:
}
ikey = uval;
} else if (!matches(*argv, "okey")) {
unsigned uval;
unsigned int uval;
NEXT_ARG();
oflags |= GRE_KEY;
if (strchr(*argv, '.'))
uval = get_addr32(*argv);
else {
if (get_unsigned(&uval, *argv, 0)<0) {
if (get_unsigned(&uval, *argv, 0) < 0) {
fprintf(stderr, "invalid value for \"okey\": \"%s\"; it should be an unsigned integer\n", *argv);
exit(-1);
}
......@@ -239,7 +239,7 @@ get_failed:
}
} else if (!matches(*argv, "ttl") ||
!matches(*argv, "hoplimit")) {
unsigned uval;
unsigned int uval;
NEXT_ARG();
if (strcmp(*argv, "inherit") != 0) {
......@@ -343,14 +343,14 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
char s2[64];
const char *local = "any";
const char *remote = "any";
unsigned iflags = 0;
unsigned oflags = 0;
unsigned int iflags = 0;
unsigned int oflags = 0;
if (!tb)
return;
if (tb[IFLA_GRE_REMOTE]) {
unsigned addr = rta_getattr_u32(tb[IFLA_GRE_REMOTE]);
unsigned int addr = rta_getattr_u32(tb[IFLA_GRE_REMOTE]);
if (addr)
remote = format_host(AF_INET, 4, &addr, s1, sizeof(s1));
......@@ -359,7 +359,7 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
fprintf(f, "remote %s ", remote);
if (tb[IFLA_GRE_LOCAL]) {
unsigned addr = rta_getattr_u32(tb[IFLA_GRE_LOCAL]);
unsigned int addr = rta_getattr_u32(tb[IFLA_GRE_LOCAL]);
if (addr)
local = format_host(AF_INET, 4, &addr, s1, sizeof(s1));
......@@ -368,7 +368,7 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
fprintf(f, "local %s ", local);
if (tb[IFLA_GRE_LINK] && rta_getattr_u32(tb[IFLA_GRE_LINK])) {
unsigned link = rta_getattr_u32(tb[IFLA_GRE_LINK]);
unsigned int link = rta_getattr_u32(tb[IFLA_GRE_LINK]);
const char *n = if_indextoname(link, s2);
if (n)
......
......@@ -71,13 +71,13 @@ static int gre_parse_opt(struct link_util *lu, int argc, char **argv,
struct rtattr *greinfo[IFLA_GRE_MAX + 1];
__u16 iflags = 0;
__u16 oflags = 0;
unsigned ikey = 0;
unsigned okey = 0;
unsigned int ikey = 0;
unsigned int okey = 0;
struct in6_addr raddr = IN6ADDR_ANY_INIT;
struct in6_addr laddr = IN6ADDR_ANY_INIT;
unsigned link = 0;
unsigned flowinfo = 0;
unsigned flags = 0;
unsigned int link = 0;
unsigned int flowinfo = 0;
unsigned int flags = 0;
__u8 hop_limit = DEFAULT_TNL_HOP_LIMIT;
__u8 encap_limit = IPV6_DEFAULT_TNL_ENCAP_LIMIT;
int len;
......@@ -152,7 +152,7 @@ get_failed:
while (argc > 0) {
if (!matches(*argv, "key")) {
unsigned uval;
unsigned int uval;
NEXT_ARG();
iflags |= GRE_KEY;
......@@ -170,14 +170,14 @@ get_failed:
ikey = okey = uval;
} else if (!matches(*argv, "ikey")) {
unsigned uval;
unsigned int uval;
NEXT_ARG();
iflags |= GRE_KEY;
if (strchr(*argv, '.'))
uval = get_addr32(*argv);
else {
if (get_unsigned(&uval, *argv, 0)<0) {
if (get_unsigned(&uval, *argv, 0) < 0) {
fprintf(stderr, "invalid value of \"ikey\"\n");
exit(-1);
}
......@@ -185,14 +185,14 @@ get_failed:
}
ikey = uval;
} else if (!matches(*argv, "okey")) {
unsigned uval;
unsigned int uval;
NEXT_ARG();
oflags |= GRE_KEY;
if (strchr(*argv, '.'))
uval = get_addr32(*argv);
else {
if (get_unsigned(&uval, *argv, 0)<0) {
if (get_unsigned(&uval, *argv, 0) < 0) {
fprintf(stderr, "invalid value of \"okey\"\n");
exit(-1);
}
......@@ -215,6 +215,7 @@ get_failed:
oflags |= GRE_CSUM;
} else if (!matches(*argv, "remote")) {
inet_prefix addr;
NEXT_ARG();
get_prefix(&addr, *argv, preferred_family);
if (addr.family == AF_UNSPEC)
......@@ -222,6 +223,7 @@ get_failed:
memcpy(&raddr, &addr.data, sizeof(raddr));
} else if (!matches(*argv, "local")) {
inet_prefix addr;
NEXT_ARG();
get_prefix(&addr, *argv, preferred_family);
if (addr.family == AF_UNSPEC)
......@@ -238,6 +240,7 @@ get_failed:
} else if (!matches(*argv, "ttl") ||
!matches(*argv, "hoplimit")) {
__u8 uval;
NEXT_ARG();
if (get_u8(&uval, *argv, 0))
invarg("invalid TTL", *argv);
......@@ -246,6 +249,7 @@ get_failed:
!matches(*argv, "tclass") ||
!matches(*argv, "dsfield")) {
__u8 uval;
NEXT_ARG();
if (strcmp(*argv, "inherit") == 0)
flags |= IP6_TNL_F_USE_ORIG_TCLASS;
......@@ -258,6 +262,7 @@ get_failed:
} else if (strcmp(*argv, "flowlabel") == 0 ||
strcmp(*argv, "fl") == 0) {
__u32 uval;
NEXT_ARG();
if (strcmp(*argv, "inherit") == 0)
flags |= IP6_TNL_F_USE_ORIG_FLOWLABEL;
......@@ -301,10 +306,10 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
char s2[64];
const char *local = "any";
const char *remote = "any";
unsigned iflags = 0;
unsigned oflags = 0;
unsigned flags = 0;
unsigned flowinfo = 0;
unsigned int iflags = 0;
unsigned int oflags = 0;
unsigned int flags = 0;
unsigned int flowinfo = 0;
struct in6_addr in6_addr_any = IN6ADDR_ANY_INIT;
if (!tb)
......@@ -318,6 +323,7 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
if (tb[IFLA_GRE_REMOTE]) {
struct in6_addr addr;
memcpy(&addr, RTA_DATA(tb[IFLA_GRE_REMOTE]), sizeof(addr));
if (memcmp(&addr, &in6_addr_any, sizeof(addr)))
......@@ -328,6 +334,7 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
if (tb[IFLA_GRE_LOCAL]) {
struct in6_addr addr;
memcpy(&addr, RTA_DATA(tb[IFLA_GRE_LOCAL]), sizeof(addr));
if (memcmp(&addr, &in6_addr_any, sizeof(addr)))
......@@ -337,7 +344,7 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
fprintf(f, "local %s ", local);
if (tb[IFLA_GRE_LINK] && rta_getattr_u32(tb[IFLA_GRE_LINK])) {
unsigned link = rta_getattr_u32(tb[IFLA_GRE_LINK]);
unsigned int link = rta_getattr_u32(tb[IFLA_GRE_LINK]);
const char *n = if_indextoname(link, s2);
if (n)
......
......@@ -35,7 +35,7 @@ static void print_usage(FILE *f)
fprintf(f, " [ mode { ip6ip6 | ipip6 | any } ]\n");
fprintf(f, " type ip6tnl [ remote ADDR ] [ local ADDR ]\n");
fprintf(f, " [ dev PHYS_DEV ] [ encaplimit ELIM ]\n");
fprintf(f ," [ hoplimit HLIM ] [ tclass TCLASS ] [ flowlabel FLOWLABEL ]\n");
fprintf(f, " [ hoplimit HLIM ] [ tclass TCLASS ] [ flowlabel FLOWLABEL ]\n");
fprintf(f, " [ dscp inherit ] [ fwmark inherit ]\n");
fprintf(f, "\n");
fprintf(f, "Where: NAME := STRING\n");
......@@ -159,6 +159,7 @@ get_failed:
invarg("Cannot guess tunnel mode.", *argv);
} else if (strcmp(*argv, "remote") == 0) {
inet_prefix addr;
NEXT_ARG();
get_prefix(&addr, *argv, preferred_family);
if (addr.family == AF_UNSPEC)
......@@ -166,6 +167,7 @@ get_failed:
memcpy(&raddr, addr.data, addr.bytelen);
} else if (strcmp(*argv, "local") == 0) {
inet_prefix addr;
NEXT_ARG();
get_prefix(&addr, *argv, preferred_family);
if (addr.family == AF_UNSPEC)
......@@ -180,6 +182,7 @@ get_failed:
strcmp(*argv, "ttl") == 0 ||
strcmp(*argv, "hlim") == 0) {
__u8 uval;
NEXT_ARG();
if (get_u8(&uval, *argv, 0))
invarg("invalid HLIM", *argv);
......@@ -190,6 +193,7 @@ get_failed:
flags |= IP6_TNL_F_IGN_ENCAP_LIMIT;
} else {
__u8 uval;
if (get_u8(&uval, *argv, 0) < -1)
invarg("invalid ELIM", *argv);
encap_limit = uval;
......@@ -200,6 +204,7 @@ get_failed:
strcmp(*argv, "tos") == 0 ||
matches(*argv, "dsfield") == 0) {
__u8 uval;
NEXT_ARG();
flowinfo &= ~IP6_FLOWINFO_TCLASS;
if (strcmp(*argv, "inherit") == 0)
......@@ -213,6 +218,7 @@ get_failed:
} else if (strcmp(*argv, "flowlabel") == 0 ||
strcmp(*argv, "fl") == 0) {
__u32 uval;
NEXT_ARG();
flowinfo &= ~IP6_FLOWINFO_FLOWLABEL;
if (strcmp(*argv, "inherit") == 0)
......@@ -299,7 +305,7 @@ static void ip6tunnel_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb
}
if (tb[IFLA_IPTUN_LINK] && rta_getattr_u32(tb[IFLA_IPTUN_LINK])) {
unsigned link = rta_getattr_u32(tb[IFLA_IPTUN_LINK]);
unsigned int link = rta_getattr_u32(tb[IFLA_IPTUN_LINK]);
const char *n = if_indextoname(link, s2);
if (n)
......
......@@ -197,6 +197,7 @@ get_failed:
strcmp(*argv, "tclass") == 0 ||
matches(*argv, "dsfield") == 0) {
__u32 uval;
NEXT_ARG();
if (strcmp(*argv, "inherit") != 0) {
if (rtnl_dsfield_a2n(&uval, *argv))
......@@ -262,6 +263,7 @@ get_failed:
encapflags &= ~TUNNEL_ENCAP_FLAG_REMCSUM;
} else if (strcmp(*argv, "6rd-prefix") == 0) {
inet_prefix prefix;
NEXT_ARG();
if (get_prefix(&prefix, *argv, AF_INET6))
invarg("invalid 6rd_prefix\n", *argv);
......@@ -269,6 +271,7 @@ get_failed:
ip6rdprefixlen = prefix.bitlen;
} else if (strcmp(*argv, "6rd-relay_prefix") == 0) {
inet_prefix prefix;
NEXT_ARG();
if (get_prefix(&prefix, *argv, AF_INET))
invarg("invalid 6rd-relay_prefix\n", *argv);
......@@ -276,6 +279,7 @@ get_failed:
ip6rdrelayprefixlen = prefix.bitlen;
} else if (strcmp(*argv, "6rd-reset") == 0) {
inet_prefix prefix;
get_prefix(&prefix, "2002::", AF_INET6);
memcpy(&ip6rdprefix, prefix.data, 16);
ip6rdprefixlen = 16;
......@@ -332,7 +336,7 @@ static void iptunnel_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[
return;
if (tb[IFLA_IPTUN_REMOTE]) {
unsigned addr = rta_getattr_u32(tb[IFLA_IPTUN_REMOTE]);
unsigned int addr = rta_getattr_u32(tb[IFLA_IPTUN_REMOTE]);
if (addr)
remote = format_host(AF_INET, 4, &addr, s1, sizeof(s1));
......@@ -341,7 +345,7 @@ static void iptunnel_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[
fprintf(f, "remote %s ", remote);
if (tb[IFLA_IPTUN_LOCAL]) {
unsigned addr = rta_getattr_u32(tb[IFLA_IPTUN_LOCAL]);
unsigned int addr = rta_getattr_u32(tb[IFLA_IPTUN_LOCAL]);
if (addr)
local = format_host(AF_INET, 4, &addr, s1, sizeof(s1));
......@@ -350,7 +354,7 @@ static void iptunnel_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[
fprintf(f, "local %s ", local);
if (tb[IFLA_IPTUN_LINK] && rta_getattr_u32(tb[IFLA_IPTUN_LINK])) {
unsigned link = rta_getattr_u32(tb[IFLA_IPTUN_LINK]);
unsigned int link = rta_getattr_u32(tb[IFLA_IPTUN_LINK]);
const char *n = if_indextoname(link, s2);
if (n)
......
......@@ -37,7 +37,7 @@ static int veth_parse_opt(struct link_util *lu, int argc, char **argv,
char *type = NULL;
int index = 0;
int err, len;
struct rtattr * data;
struct rtattr *data;
int group;
struct ifinfomsg *ifm, *peer_ifm;
unsigned int ifi_flags, ifi_change;
......
......@@ -55,11 +55,11 @@ static int vti_parse_opt(struct link_util *lu, int argc, char **argv,
struct rtattr *tb[IFLA_MAX + 1];
struct rtattr *linkinfo[IFLA_INFO_MAX+1];
struct rtattr *vtiinfo[IFLA_VTI_MAX + 1];
unsigned ikey = 0;
unsigned okey = 0;
unsigned saddr = 0;
unsigned daddr = 0;
unsigned link = 0;
unsigned int ikey = 0;
unsigned int okey = 0;
unsigned int saddr = 0;
unsigned int daddr = 0;
unsigned int link = 0;
int len;
if (!(n->nlmsg_flags & NLM_F_CREATE)) {
......@@ -114,7 +114,7 @@ get_failed:
while (argc > 0) {
if (!matches(*argv, "key")) {
unsigned uval;
unsigned int uval;
NEXT_ARG();
if (strchr(*argv, '.'))
......@@ -130,7 +130,7 @@ get_failed:
ikey = okey = uval;
} else if (!matches(*argv, "ikey")) {
unsigned uval;
unsigned int uval;
NEXT_ARG();
if (strchr(*argv, '.'))
......@@ -144,7 +144,7 @@ get_failed:
}
ikey = uval;
} else if (!matches(*argv, "okey")) {
unsigned uval;
unsigned int uval;
NEXT_ARG();
if (strchr(*argv, '.'))
......@@ -207,7 +207,7 @@ static void vti_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
return;
if (tb[IFLA_VTI_REMOTE]) {
unsigned addr = *(__u32 *)RTA_DATA(tb[IFLA_VTI_REMOTE]);
unsigned int addr = *(__u32 *)RTA_DATA(tb[IFLA_VTI_REMOTE]);
if (addr)
remote = format_host(AF_INET, 4, &addr, s1, sizeof(s1));
......@@ -216,7 +216,7 @@ static void vti_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
fprintf(f, "remote %s ", remote);
if (tb[IFLA_VTI_LOCAL]) {
unsigned addr = *(__u32 *)RTA_DATA(tb[IFLA_VTI_LOCAL]);
unsigned int addr = *(__u32 *)RTA_DATA(tb[IFLA_VTI_LOCAL]);
if (addr)
local = format_host(AF_INET, 4, &addr, s1, sizeof(s1));
......@@ -225,7 +225,7 @@ static void vti_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
fprintf(f, "local %s ", local);
if (tb[IFLA_VTI_LINK] && *(__u32 *)RTA_DATA(tb[IFLA_VTI_LINK])) {
unsigned link = *(__u32 *)RTA_DATA(tb[IFLA_VTI_LINK]);
unsigned int link = *(__u32 *)RTA_DATA(tb[IFLA_VTI_LINK]);
const char *n = if_indextoname(link, s2);
if (n)
......
......@@ -53,9 +53,9 @@ static int vti6_parse_opt(struct link_util *lu, int argc, char **argv,
struct rtattr *vtiinfo[IFLA_VTI_MAX + 1];
struct in6_addr saddr;
struct in6_addr daddr;
unsigned ikey = 0;
unsigned okey = 0;
unsigned link = 0;
unsigned int ikey = 0;
unsigned int okey = 0;
unsigned int link = 0;
int len;
if (!(n->nlmsg_flags & NLM_F_CREATE)) {
......@@ -110,7 +110,7 @@ get_failed:
while (argc > 0) {
if (!matches(*argv, "key")) {
unsigned uval;
unsigned int uval;
NEXT_ARG();
if (strchr(*argv, '.'))
......@@ -126,7 +126,7 @@ get_failed:
ikey = okey = uval;
} else if (!matches(*argv, "ikey")) {
unsigned uval;
unsigned int uval;
NEXT_ARG();
if (strchr(*argv, '.'))
......@@ -140,7 +140,7 @@ get_failed:
}
ikey = uval;
} else if (!matches(*argv, "okey")) {
unsigned uval;
unsigned int uval;
NEXT_ARG();
if (strchr(*argv, '.'))
......@@ -160,6 +160,7 @@ get_failed:
exit(-1);
} else {
inet_prefix addr;
get_prefix(&addr, *argv, AF_INET6);
memcpy(&daddr, addr.data, addr.bytelen);
}
......@@ -170,6 +171,7 @@ get_failed:
exit(-1);
} else {
inet_prefix addr;
get_prefix(&addr, *argv, AF_INET6);
memcpy(&saddr, addr.data, addr.bytelen);
}
......@@ -222,7 +224,7 @@ static void vti6_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
fprintf(f, "local %s ", local);
if (tb[IFLA_VTI_LINK] && *(__u32 *)RTA_DATA(tb[IFLA_VTI_LINK])) {
unsigned link = *(__u32 *)RTA_DATA(tb[IFLA_VTI_LINK]);
unsigned int link = *(__u32 *)RTA_DATA(tb[IFLA_VTI_LINK]);
const char *n = if_indextoname(link, s2);
if (n)
......
......@@ -25,13 +25,13 @@
#include "utils.h"
#include "libnetlink.h"
int resolve_hosts = 0;
int resolve_hosts;
static int init_phase = 1;
static void write_stamp(FILE *fp)
{
char buf[128];
struct nlmsghdr *n1 = (void*)buf;
struct nlmsghdr *n1 = (void *)buf;
struct timeval tv;
n1->nlmsg_type = NLMSG_TSTAMP;
......@@ -40,18 +40,19 @@ static void write_stamp(FILE *fp)
n1->nlmsg_pid = 0;
n1->nlmsg_len = NLMSG_LENGTH(4*2);
gettimeofday(&tv, NULL);
((__u32*)NLMSG_DATA(n1))[0] = tv.tv_sec;
((__u32*)NLMSG_DATA(n1))[1] = tv.tv_usec;
fwrite((void*)n1, 1, NLMSG_ALIGN(n1->nlmsg_len), fp);
((__u32 *)NLMSG_DATA(n1))[0] = tv.tv_sec;
((__u32 *)NLMSG_DATA(n1))[1] = tv.tv_usec;
fwrite((void *)n1, 1, NLMSG_ALIGN(n1->nlmsg_len), fp);
}
static int dump_msg(const struct sockaddr_nl *who, struct rtnl_ctrl_data *ctrl,
struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE*)arg;
FILE *fp = (FILE *)arg;
if (!init_phase)
write_stamp(fp);
fwrite((void*)n, 1, NLMSG_ALIGN(n->nlmsg_len), fp);
fwrite((void *)n, 1, NLMSG_ALIGN(n->nlmsg_len), fp);
fflush(fp);
return 0;
}
......@@ -75,7 +76,7 @@ main(int argc, char **argv)
FILE *fp;
struct rtnl_handle rth;
int family = AF_UNSPEC;
unsigned groups = ~0U;
unsigned int groups = ~0U;
int llink = 0;
int laddr = 0;
int lroute = 0;
......@@ -115,13 +116,13 @@ main(int argc, char **argv)
usage();
file = argv[1];
} else if (matches(argv[1], "link") == 0) {
llink=1;
llink = 1;
groups = 0;
} else if (matches(argv[1], "address") == 0) {
laddr=1;
laddr = 1;
groups = 0;
} else if (matches(argv[1], "route") == 0) {
lroute=1;
lroute = 1;
groups = 0;
} else if (strcmp(argv[1], "all") == 0) {
groups = ~0U;
......@@ -176,7 +177,7 @@ main(int argc, char **argv)
init_phase = 0;
if (rtnl_listen(&rth, dump_msg, (void*)fp) < 0)
if (rtnl_listen(&rth, dump_msg, (void *)fp) < 0)
exit(2);
exit(0);
......
......@@ -168,6 +168,7 @@ static int process_msg(const struct sockaddr_nl *who, struct nlmsghdr *n,
if (f.flushb) {
struct nlmsghdr *fn;
TCPM_REQUEST(req2, 128, TCP_METRICS_CMD_DEL, NLM_F_REQUEST);
addattr_l(&req2.n, sizeof(req2), atype, &daddr.data,
......@@ -333,6 +334,7 @@ static int tcpm_do_cmd(int cmd, int argc, char **argv)
if (strcmp(*argv, "src") == 0 ||
strcmp(*argv, "source") == 0) {
char *who = *argv;
NEXT_ARG();
if (matches(*argv, "help") == 0)
usage();
......@@ -354,6 +356,7 @@ static int tcpm_do_cmd(int cmd, int argc, char **argv)
}
} else {
char *who = "address";
if (strcmp(*argv, "addr") == 0 ||
strcmp(*argv, "address") == 0) {
who = *argv;
......@@ -504,7 +507,7 @@ int do_tcp_metrics(int argc, char **argv)
if (matches(argv[0], "help") == 0)
usage();
fprintf(stderr, "Command \"%s\" is unknown, "
"try \"ip tcp_metrics help\".\n", *argv);
fprintf(stderr, "Command \"%s\" is unknown, try \"ip tcp_metrics help\".\n",
*argv);
exit(-1);
}
......@@ -72,7 +72,7 @@ int tnl_get_ioctl(const char *basedev, void *p)
int err;
strncpy(ifr.ifr_name, basedev, IFNAMSIZ);
ifr.ifr_ifru.ifru_data = (void*)p;
ifr.ifr_ifru.ifru_data = (void *)p;
fd = socket(preferred_family, SOCK_DGRAM, 0);
if (fd < 0) {
......@@ -183,7 +183,7 @@ int tnl_ioctl_get_6rd(const char *name, void *p)
__be32 tnl_parse_key(const char *name, const char *key)
{
unsigned uval;
unsigned int uval;
if (strchr(key, '.'))
return get_addr32(key);
......@@ -209,10 +209,10 @@ void tnl_print_stats(const char *buf)
tx_fifo, tx_colls, tx_carrier, rx_multi;
if (sscanf(buf, "%lu%lu%lu%lu%lu%lu%lu%*d%lu%lu%lu%lu%lu%lu%lu",
&rx_bytes, &rx_packets, &rx_errs, &rx_drops,
&rx_fifo, &rx_frame, &rx_multi,
&tx_bytes, &tx_packets, &tx_errs, &tx_drops,
&tx_fifo, &tx_colls, &tx_carrier) != 14)
&rx_bytes, &rx_packets, &rx_errs, &rx_drops,
&rx_fifo, &rx_frame, &rx_multi,
&tx_bytes, &tx_packets, &tx_errs, &tx_drops,
&tx_fifo, &tx_colls, &tx_carrier) != 14)
return;
printf("%s", _SL_);
......
......@@ -46,10 +46,10 @@ static void usage(void)
static int xfrm_acquire_print(const struct sockaddr_nl *who,
struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE*)arg;
FILE *fp = (FILE *)arg;
struct xfrm_user_acquire *xacq = NLMSG_DATA(n);
int len = n->nlmsg_len;
struct rtattr * tb[XFRMA_MAX+1];
struct rtattr *tb[XFRMA_MAX+1];
__u16 family;
len -= NLMSG_LENGTH(sizeof(*xacq));
......@@ -71,6 +71,7 @@ static int xfrm_acquire_print(const struct sockaddr_nl *who,
fprintf(fp, "proto %s ", strxf_xfrmproto(xacq->id.proto));
if (show_stats > 0 || xacq->id.spi) {
__u32 spi = ntohl(xacq->id.spi);
fprintf(fp, "spi 0x%08x", spi);
if (show_stats > 0)
fprintf(fp, "(%u)", spi);
......@@ -107,7 +108,7 @@ static int xfrm_acquire_print(const struct sockaddr_nl *who,
static int xfrm_state_flush_print(const struct sockaddr_nl *who,
struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE*)arg;
FILE *fp = (FILE *)arg;
struct xfrm_usersa_flush *xsf = NLMSG_DATA(n);
int len = n->nlmsg_len;
const char *str;
......@@ -137,8 +138,8 @@ static int xfrm_state_flush_print(const struct sockaddr_nl *who,
static int xfrm_policy_flush_print(const struct sockaddr_nl *who,
struct nlmsghdr *n, void *arg)
{
struct rtattr * tb[XFRMA_MAX+1];
FILE *fp = (FILE*)arg;
struct rtattr *tb[XFRMA_MAX+1];
FILE *fp = (FILE *)arg;
int len = n->nlmsg_len;
len -= NLMSG_SPACE(0);
......@@ -175,10 +176,10 @@ static int xfrm_policy_flush_print(const struct sockaddr_nl *who,
static int xfrm_report_print(const struct sockaddr_nl *who,
struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE*)arg;
FILE *fp = (FILE *)arg;
struct xfrm_user_report *xrep = NLMSG_DATA(n);
int len = n->nlmsg_len;
struct rtattr * tb[XFRMA_MAX+1];
struct rtattr *tb[XFRMA_MAX+1];
__u16 family;
len -= NLMSG_LENGTH(sizeof(*xrep));
......@@ -210,7 +211,8 @@ static int xfrm_report_print(const struct sockaddr_nl *who,
static void xfrm_ae_flags_print(__u32 flags, void *arg)
{
FILE *fp = (FILE*)arg;
FILE *fp = (FILE *)arg;
fprintf(fp, " (0x%x) ", flags);
if (!flags)
return;
......@@ -241,13 +243,13 @@ static void xfrm_usersa_print(const struct xfrm_usersa_id *sa_id, __u32 reqid, F
static int xfrm_ae_print(const struct sockaddr_nl *who,
struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE*)arg;
FILE *fp = (FILE *)arg;
struct xfrm_aevent_id *id = NLMSG_DATA(n);
char abuf[256];
fprintf(fp, "Async event ");
xfrm_ae_flags_print(id->flags, arg);
fprintf(fp,"\n\t");
fprintf(fp, "\n\t");
memset(abuf, '\0', sizeof(abuf));
fprintf(fp, "src %s ", rt_addr_n2a(id->sa_id.family,
sizeof(id->saddr), &id->saddr,
......@@ -272,7 +274,7 @@ static void xfrm_print_addr(FILE *fp, int family, xfrm_address_t *a)
static int xfrm_mapping_print(const struct sockaddr_nl *who,
struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE*)arg;
FILE *fp = (FILE *)arg;
struct xfrm_user_mapping *map = NLMSG_DATA(n);
fprintf(fp, "Mapping change ");
......@@ -293,7 +295,7 @@ static int xfrm_accept_msg(const struct sockaddr_nl *who,
struct rtnl_ctrl_data *ctrl,
struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE*)arg;
FILE *fp = (FILE *)arg;
if (timestamp)
print_timestamp(fp);
......@@ -353,13 +355,13 @@ extern struct rtnl_handle rth;
int do_xfrm_monitor(int argc, char **argv)
{
char *file = NULL;
unsigned groups = ~((unsigned)0); /* XXX */
int lacquire=0;
int lexpire=0;
int laevent=0;
int lpolicy=0;
int lsa=0;
int lreport=0;
unsigned int groups = ~((unsigned)0); /* XXX */
int lacquire = 0;
int lexpire = 0;
int laevent = 0;
int lpolicy = 0;
int lsa = 0;
int lreport = 0;
rtnl_close(&rth);
......@@ -370,22 +372,22 @@ int do_xfrm_monitor(int argc, char **argv)
} else if (matches(*argv, "all-nsid") == 0) {
listen_all_nsid = 1;
} else if (matches(*argv, "acquire") == 0) {
lacquire=1;
lacquire = 1;
groups = 0;
} else if (matches(*argv, "expire") == 0) {
lexpire=1;
lexpire = 1;
groups = 0;
} else if (matches(*argv, "SA") == 0) {
lsa=1;
lsa = 1;
groups = 0;
} else if (matches(*argv, "aevent") == 0) {
laevent=1;
laevent = 1;
groups = 0;
} else if (matches(*argv, "policy") == 0) {
lpolicy=1;
lpolicy = 1;
groups = 0;
} else if (matches(*argv, "report") == 0) {
lreport=1;
lreport = 1;
groups = 0;
} else if (matches(*argv, "help") == 0) {
usage();
......@@ -428,7 +430,7 @@ int do_xfrm_monitor(int argc, char **argv)
if (listen_all_nsid && rtnl_listen_all_nsid(&rth) < 0)
exit(1);
if (rtnl_listen(&rth, xfrm_accept_msg, (void*)stdout) < 0)
if (rtnl_listen(&rth, xfrm_accept_msg, (void *)stdout) < 0)
exit(2);
return 0;
......
......@@ -33,7 +33,7 @@
#include "xfrm.h"
#include "ip_common.h"
//#define NLMSG_DELETEALL_BUF_SIZE (4096-512)
/* #define NLMSG_DELETEALL_BUF_SIZE (4096-512) */
#define NLMSG_DELETEALL_BUF_SIZE 8192
/*
......@@ -241,7 +241,7 @@ int xfrm_sctx_parse(char *ctxstr, char *s,
return 0;
}
static int xfrm_policy_modify(int cmd, unsigned flags, int argc, char **argv)
static int xfrm_policy_modify(int cmd, unsigned int flags, int argc, char **argv)
{
struct rtnl_handle rth;
struct {
......@@ -376,7 +376,7 @@ static int xfrm_policy_modify(int cmd, unsigned flags, int argc, char **argv)
int r = addattr_l(&req.n, sizeof(req.buf), XFRMA_MARK,
(void *)&mark, sizeof(mark));
if (r < 0) {
fprintf(stderr, "%s: XFRMA_MARK failed\n",__func__);
fprintf(stderr, "%s: XFRMA_MARK failed\n", __func__);
exit(1);
}
}
......@@ -459,13 +459,13 @@ static int xfrm_policy_filter_match(struct xfrm_userpolicy_info *xpinfo,
int xfrm_policy_print(const struct sockaddr_nl *who, struct nlmsghdr *n,
void *arg)
{
struct rtattr * tb[XFRMA_MAX+1];
struct rtattr * rta;
struct rtattr *tb[XFRMA_MAX+1];
struct rtattr *rta;
struct xfrm_userpolicy_info *xpinfo = NULL;
struct xfrm_user_polexpire *xpexp = NULL;
struct xfrm_userpolicy_id *xpid = NULL;
__u8 ptype = XFRM_POLICY_TYPE_MAIN;
FILE *fp = (FILE*)arg;
FILE *fp = (FILE *)arg;
int len = n->nlmsg_len;
if (n->nlmsg_type != XFRM_MSG_NEWPOLICY &&
......@@ -526,7 +526,7 @@ int xfrm_policy_print(const struct sockaddr_nl *who, struct nlmsghdr *n,
fprintf(fp, "Expired ");
if (n->nlmsg_type == XFRM_MSG_DELPOLICY) {
//xfrm_policy_id_print();
/* xfrm_policy_id_print(); */
if (!tb[XFRMA_POLICY]) {
fprintf(stderr, "Buggy XFRM_MSG_DELPOLICY: no XFRMA_POLICY\n");
return -1;
......@@ -659,7 +659,7 @@ static int xfrm_policy_get_or_delete(int argc, char **argv, int delete,
int r = addattr_l(&req.n, sizeof(req.buf), XFRMA_MARK,
(void *)&mark, sizeof(mark));
if (r < 0) {
fprintf(stderr, "%s: XFRMA_MARK failed\n",__func__);
fprintf(stderr, "%s: XFRMA_MARK failed\n", __func__);
exit(1);
}
}
......@@ -691,7 +691,7 @@ static int xfrm_policy_get(int argc, char **argv)
xfrm_policy_get_or_delete(argc, argv, 0, n, sizeof(buf));
if (xfrm_policy_print(NULL, n, (void*)stdout) < 0) {
if (xfrm_policy_print(NULL, n, (void *)stdout) < 0) {
fprintf(stderr, "An error :-)\n");
exit(1);
}
......@@ -761,7 +761,7 @@ static int xfrm_policy_keep(const struct sockaddr_nl *who,
xpid->index = xpinfo->index;
xb->offset += new_n->nlmsg_len;
xb->nlmsg_count ++;
xb->nlmsg_count++;
return 0;
}
......@@ -915,12 +915,12 @@ static int xfrm_policy_list_or_deleteall(int argc, char **argv, int deleteall)
exit(0);
}
static int print_spdinfo( struct nlmsghdr *n, void *arg)
static int print_spdinfo(struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE*)arg;
FILE *fp = (FILE *)arg;
__u32 *f = NLMSG_DATA(n);
struct rtattr * tb[XFRMA_SPD_MAX+1];
struct rtattr * rta;
struct rtattr *tb[XFRMA_SPD_MAX+1];
struct rtattr *rta;
int len = n->nlmsg_len;
......@@ -933,7 +933,7 @@ static int print_spdinfo( struct nlmsghdr *n, void *arg)
rta = XFRMSAPD_RTA(f);
parse_rtattr(tb, XFRMA_SPD_MAX, rta, len);
fprintf(fp,"\t SPD");
fprintf(fp, "\t SPD");
if (tb[XFRMA_SPD_INFO]) {
struct xfrmu_spdinfo *si;
......@@ -942,16 +942,16 @@ static int print_spdinfo( struct nlmsghdr *n, void *arg)
return -1;
}
si = RTA_DATA(tb[XFRMA_SPD_INFO]);
fprintf(fp," IN %d", si->incnt);
fprintf(fp," OUT %d", si->outcnt);
fprintf(fp," FWD %d", si->fwdcnt);
fprintf(fp, " IN %d", si->incnt);
fprintf(fp, " OUT %d", si->outcnt);
fprintf(fp, " FWD %d", si->fwdcnt);
if (show_stats) {
fprintf(fp," (Sock:");
fprintf(fp," IN %d", si->inscnt);
fprintf(fp," OUT %d", si->outscnt);
fprintf(fp," FWD %d", si->fwdscnt);
fprintf(fp,")");
fprintf(fp, " (Sock:");
fprintf(fp, " IN %d", si->inscnt);
fprintf(fp, " OUT %d", si->outscnt);
fprintf(fp, " FWD %d", si->fwdscnt);
fprintf(fp, ")");
}
fprintf(fp, "%s", _SL_);
......@@ -965,34 +965,36 @@ static int print_spdinfo( struct nlmsghdr *n, void *arg)
return -1;
}
sh = RTA_DATA(tb[XFRMA_SPD_HINFO]);
fprintf(fp,"\t SPD buckets:");
fprintf(fp," count %d", sh->spdhcnt);
fprintf(fp," Max %d", sh->spdhmcnt);
fprintf(fp, "\t SPD buckets:");
fprintf(fp, " count %d", sh->spdhcnt);
fprintf(fp, " Max %d", sh->spdhmcnt);
fprintf(fp, "%s", _SL_);
}
if (tb[XFRMA_SPD_IPV4_HTHRESH]) {
struct xfrmu_spdhthresh *th;
if (RTA_PAYLOAD(tb[XFRMA_SPD_IPV4_HTHRESH]) < sizeof(*th)) {
fprintf(stderr, "SPDinfo: Wrong len %d\n", len);
return -1;
}
th = RTA_DATA(tb[XFRMA_SPD_IPV4_HTHRESH]);
fprintf(fp,"\t SPD IPv4 thresholds:");
fprintf(fp," local %d", th->lbits);
fprintf(fp," remote %d", th->rbits);
fprintf(fp, "\t SPD IPv4 thresholds:");
fprintf(fp, " local %d", th->lbits);
fprintf(fp, " remote %d", th->rbits);
fprintf(fp, "%s", _SL_);
}
if (tb[XFRMA_SPD_IPV6_HTHRESH]) {
struct xfrmu_spdhthresh *th;
if (RTA_PAYLOAD(tb[XFRMA_SPD_IPV6_HTHRESH]) < sizeof(*th)) {
fprintf(stderr, "SPDinfo: Wrong len %d\n", len);
return -1;
}
th = RTA_DATA(tb[XFRMA_SPD_IPV6_HTHRESH]);
fprintf(fp,"\t SPD IPv6 thresholds:");
fprintf(fp," local %d", th->lbits);
fprintf(fp," remote %d", th->rbits);
fprintf(fp, "\t SPD IPv6 thresholds:");
fprintf(fp, " local %d", th->lbits);
fprintf(fp, " remote %d", th->rbits);
fprintf(fp, "%s", _SL_);
}
}
......@@ -1000,7 +1002,7 @@ static int print_spdinfo( struct nlmsghdr *n, void *arg)
if (oneline)
fprintf(fp, "\n");
return 0;
return 0;
}
static int xfrm_spd_setinfo(int argc, char **argv)
......@@ -1093,7 +1095,7 @@ static int xfrm_spd_getinfo(int argc, char **argv)
if (rtnl_talk(&rth, &req.n, &req.n, sizeof(req)) < 0)
exit(2);
print_spdinfo(&req.n, (void*)stdout);
print_spdinfo(&req.n, (void *)stdout);
rtnl_close(&rth);
......
......@@ -32,7 +32,7 @@
#include "xfrm.h"
#include "ip_common.h"
//#define NLMSG_DELETEALL_BUF_SIZE (4096-512)
/* #define NLMSG_DELETEALL_BUF_SIZE (4096-512) */
#define NLMSG_DELETEALL_BUF_SIZE 8192
/*
......@@ -107,7 +107,7 @@ static void usage(void)
fprintf(stderr, "LIMIT-LIST := [ LIMIT-LIST ] limit LIMIT\n");
fprintf(stderr, "LIMIT := { time-soft | time-hard | time-use-soft | time-use-hard } SECONDS |\n");
fprintf(stderr, " { byte-soft | byte-hard } SIZE | { packet-soft | packet-hard } COUNT\n");
fprintf(stderr, "ENCAP := { espinudp | espinudp-nonike } SPORT DPORT OADDR\n");
fprintf(stderr, "ENCAP := { espinudp | espinudp-nonike } SPORT DPORT OADDR\n");
exit(-1);
}
......@@ -142,7 +142,7 @@ static int xfrm_algo_parse(struct xfrm_algo *alg, enum xfrm_attr_type_t type,
if (len > max)
invarg("ALGO-KEYMAT value makes buffer overflow\n", key);
for (i = - (plen % 2), j = 0; j < len; i += 2, j++) {
for (i = -(plen % 2), j = 0; j < len; i += 2, j++) {
char vbuf[3];
__u8 val;
......@@ -266,13 +266,13 @@ static int xfrm_state_extra_flag_parse(__u32 *extra_flags, int *argcp, char ***a
return 0;
}
static int xfrm_state_modify(int cmd, unsigned flags, int argc, char **argv)
static int xfrm_state_modify(int cmd, unsigned int flags, int argc, char **argv)
{
struct rtnl_handle rth;
struct {
struct nlmsghdr n;
struct xfrm_usersa_info xsinfo;
char buf[RTA_BUF_SIZE];
char buf[RTA_BUF_SIZE];
} req;
struct xfrm_replay_state replay;
struct xfrm_replay_state_esn replay_esn;
......@@ -356,7 +356,7 @@ static int xfrm_state_modify(int cmd, unsigned flags, int argc, char **argv)
} else if (strcmp(*argv, "encap") == 0) {
struct xfrm_encap_tmpl encap;
inet_prefix oa;
NEXT_ARG();
NEXT_ARG();
xfrm_encap_type_parse(&encap.encap_type, &argc, &argv);
NEXT_ARG();
if (get_u16(&encap.encap_sport, *argv, 0))
......@@ -408,6 +408,7 @@ static int xfrm_state_modify(int cmd, unsigned flags, int argc, char **argv)
} else {
/* try to assume ALGO */
int type = xfrm_algotype_getbyname(*argv);
switch (type) {
case XFRMA_ALG_AEAD:
case XFRMA_ALG_CRYPT:
......@@ -701,7 +702,7 @@ static int xfrm_state_allocspi(int argc, char **argv)
struct {
struct nlmsghdr n;
struct xfrm_userspi_info xspi;
char buf[RTA_BUF_SIZE];
char buf[RTA_BUF_SIZE];
} req;
char *idp = NULL;
char *minp = NULL;
......@@ -827,7 +828,7 @@ static int xfrm_state_allocspi(int argc, char **argv)
if (rtnl_talk(&rth, &req.n, res_n, sizeof(res_buf)) < 0)
exit(2);
if (xfrm_state_print(NULL, res_n, (void*)stdout) < 0) {
if (xfrm_state_print(NULL, res_n, (void *)stdout) < 0) {
fprintf(stderr, "An error :-)\n");
exit(1);
}
......@@ -868,9 +869,9 @@ static int xfrm_state_filter_match(struct xfrm_usersa_info *xsinfo)
int xfrm_state_print(const struct sockaddr_nl *who, struct nlmsghdr *n,
void *arg)
{
FILE *fp = (FILE*)arg;
struct rtattr * tb[XFRMA_MAX+1];
struct rtattr * rta;
FILE *fp = (FILE *)arg;
struct rtattr *tb[XFRMA_MAX+1];
struct rtattr *rta;
struct xfrm_usersa_info *xsinfo = NULL;
struct xfrm_user_expire *xexp = NULL;
struct xfrm_usersa_id *xsid = NULL;
......@@ -924,7 +925,7 @@ int xfrm_state_print(const struct sockaddr_nl *who, struct nlmsghdr *n,
parse_rtattr(tb, XFRMA_MAX, rta, len);
if (n->nlmsg_type == XFRM_MSG_DELSA) {
//xfrm_policy_id_print();
/* xfrm_policy_id_print(); */
if (!tb[XFRMA_SA]) {
fprintf(stderr, "Buggy XFRM_MSG_DELSA: no XFRMA_SA\n");
......@@ -958,7 +959,7 @@ static int xfrm_state_get_or_delete(int argc, char **argv, int delete)
struct {
struct nlmsghdr n;
struct xfrm_usersa_id xsid;
char buf[RTA_BUF_SIZE];
char buf[RTA_BUF_SIZE];
} req;
struct xfrm_id id;
char *idp = NULL;
......@@ -1025,7 +1026,7 @@ static int xfrm_state_get_or_delete(int argc, char **argv, int delete)
if (rtnl_talk(&rth, &req.n, res_n, sizeof(req)) < 0)
exit(2);
if (xfrm_state_print(NULL, res_n, (void*)stdout) < 0) {
if (xfrm_state_print(NULL, res_n, (void *)stdout) < 0) {
fprintf(stderr, "An error :-)\n");
exit(1);
}
......@@ -1087,7 +1088,7 @@ static int xfrm_state_keep(const struct sockaddr_nl *who,
sizeof(xsid->daddr));
xb->offset += new_n->nlmsg_len;
xb->nlmsg_count ++;
xb->nlmsg_count++;
return 0;
}
......@@ -1097,7 +1098,7 @@ static int xfrm_state_list_or_deleteall(int argc, char **argv, int deleteall)
char *idp = NULL;
struct rtnl_handle rth;
if(argc > 0)
if (argc > 0)
filter.use = 1;
filter.xsinfo.family = preferred_family;
......@@ -1231,7 +1232,7 @@ static int xfrm_state_list_or_deleteall(int argc, char **argv, int deleteall)
static int print_sadinfo(struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE*)arg;
FILE *fp = (FILE *)arg;
__u32 *f = NLMSG_DATA(n);
struct rtattr *tb[XFRMA_SAD_MAX+1];
struct rtattr *rta;
......@@ -1249,11 +1250,11 @@ static int print_sadinfo(struct nlmsghdr *n, void *arg)
parse_rtattr(tb, XFRMA_SAD_MAX, rta, len);
if (tb[XFRMA_SAD_CNT]) {
fprintf(fp,"\t SAD");
fprintf(fp, "\t SAD");
cnt = (__u32 *)RTA_DATA(tb[XFRMA_SAD_CNT]);
fprintf(fp," count %d", *cnt);
fprintf(fp, " count %d", *cnt);
} else {
fprintf(fp,"BAD SAD info returned\n");
fprintf(fp, "BAD SAD info returned\n");
return -1;
}
......@@ -1262,20 +1263,20 @@ static int print_sadinfo(struct nlmsghdr *n, void *arg)
struct xfrmu_sadhinfo *si;
if (RTA_PAYLOAD(tb[XFRMA_SAD_HINFO]) < sizeof(*si)) {
fprintf(fp,"BAD SAD length returned\n");
fprintf(fp, "BAD SAD length returned\n");
return -1;
}
si = RTA_DATA(tb[XFRMA_SAD_HINFO]);
fprintf(fp," (buckets ");
fprintf(fp,"count %d", si->sadhcnt);
fprintf(fp," Max %d", si->sadhmcnt);
fprintf(fp,")");
fprintf(fp, " (buckets ");
fprintf(fp, "count %d", si->sadhcnt);
fprintf(fp, " Max %d", si->sadhmcnt);
fprintf(fp, ")");
}
}
fprintf(fp,"\n");
fprintf(fp, "\n");
return 0;
return 0;
}
static int xfrm_sad_getinfo(int argc, char **argv)
......@@ -1299,7 +1300,7 @@ static int xfrm_sad_getinfo(int argc, char **argv)
if (rtnl_talk(&rth, &req.n, &req.n, sizeof(req)) < 0)
exit(2);
print_sadinfo(&req.n, (void*)stdout);
print_sadinfo(&req.n, (void *)stdout);
rtnl_close(&rth);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment