diff options
author | Stephen Hemminger <shemming@brocade.com> | 2015-10-16 16:03:32 -0700 |
---|---|---|
committer | Stephen Hemminger <shemming@brocade.com> | 2015-10-16 16:03:32 -0700 |
commit | c6646c1ea56c3198c19643b2f60e79fec3b07244 (patch) | |
tree | ff4ea2c729a65937a8dfd830238d0e8f091f2e7c | |
parent | d2ccb70a910920c365611151531cfff598451f08 (diff) | |
parent | 6f07f3dc41545657c0364eb17850b946f41861bf (diff) | |
download | platform_external_iproute2-c6646c1ea56c3198c19643b2f60e79fec3b07244.tar.gz platform_external_iproute2-c6646c1ea56c3198c19643b2f60e79fec3b07244.tar.bz2 platform_external_iproute2-c6646c1ea56c3198c19643b2f60e79fec3b07244.zip |
Merge branch 'master' into net-next
-rw-r--r-- | include/libnetlink.h | 10 | ||||
-rw-r--r-- | ip/ipaddress.c | 2 | ||||
-rw-r--r-- | ip/ipneigh.c | 2 | ||||
-rw-r--r-- | lib/libnetlink.c | 31 |
4 files changed, 43 insertions, 2 deletions
diff --git a/include/libnetlink.h b/include/libnetlink.h index 48133591..2280c39c 100644 --- a/include/libnetlink.h +++ b/include/libnetlink.h @@ -88,7 +88,10 @@ 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_addattr8(struct rtattr *rta, int maxlen, int type, __u8 data); +int rta_addattr16(struct rtattr *rta, int maxlen, int type, __u16 data); int rta_addattr32(struct rtattr *rta, int maxlen, int type, __u32 data); +int rta_addattr64(struct rtattr *rta, int maxlen, int type, __u64 data); int rta_addattr_l(struct rtattr *rta, int maxlen, int type, const void *data, int alen); @@ -100,6 +103,13 @@ int parse_rtattr_byindex(struct rtattr *tb[], int max, 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); +struct rtattr *rta_nest(struct rtattr *rta, int maxlen, int type); +int rta_nest_end(struct rtattr *rta, struct rtattr *nest); + +#define RTA_TAIL(rta) \ + ((struct rtattr *) (((void *) (rta)) + \ + RTA_ALIGN((rta)->rta_len))) + #define parse_rtattr_nested(tb, max, rta) \ (parse_rtattr((tb), (max), RTA_DATA(rta), RTA_PAYLOAD(rta))) diff --git a/ip/ipaddress.c b/ip/ipaddress.c index e864ca65..f290205b 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -345,7 +345,7 @@ static void print_vfinfo(FILE *fp, struct rtattr *vfinfo) } else vf_linkstate = NULL; - fprintf(fp, "\n vf %d MAC %s", vf_mac->vf, + fprintf(fp, "%s vf %d MAC %s", _SL_, vf_mac->vf, ll_addr_n2a((unsigned char *)&vf_mac->mac, ETH_ALEN, 0, b1, sizeof(b1))); if (vf_vlan->vlan) diff --git a/ip/ipneigh.c b/ip/ipneigh.c index ded514da..54655842 100644 --- a/ip/ipneigh.c +++ b/ip/ipneigh.c @@ -266,7 +266,7 @@ int print_neigh(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) } if (n->nlmsg_type == RTM_DELNEIGH) - fprintf(fp, "delete "); + fprintf(fp, "Deleted "); else if (n->nlmsg_type == RTM_GETNEIGH) fprintf(fp, "miss "); if (tb[NDA_DST]) { diff --git a/lib/libnetlink.c b/lib/libnetlink.c index 8e3762c1..09b0e911 100644 --- a/lib/libnetlink.c +++ b/lib/libnetlink.c @@ -742,6 +742,37 @@ int rta_addattr_l(struct rtattr *rta, int maxlen, int type, return 0; } +int rta_addattr8(struct rtattr *rta, int maxlen, int type, __u8 data) +{ + return rta_addattr_l(rta, maxlen, type, &data, sizeof(__u8)); +} + +int rta_addattr16(struct rtattr *rta, int maxlen, int type, __u16 data) +{ + return rta_addattr_l(rta, maxlen, type, &data, sizeof(__u16)); +} + +int rta_addattr64(struct rtattr *rta, int maxlen, int type, __u64 data) +{ + return rta_addattr_l(rta, maxlen, type, &data, sizeof(__u64)); +} + +struct rtattr *rta_nest(struct rtattr *rta, int maxlen, int type) +{ + struct rtattr *nest = RTA_TAIL(rta); + + rta_addattr_l(rta, maxlen, type, NULL, 0); + + return nest; +} + +int rta_nest_end(struct rtattr *rta, struct rtattr *nest) +{ + nest->rta_len = (void *)RTA_TAIL(rta) - (void *)nest; + + return rta->rta_len; +} + int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len) { return parse_rtattr_flags(tb, max, rta, len, 0); |