diff options
author | Thomas Haller <thaller@redhat.com> | 2022-04-22 19:24:11 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2022-04-22 19:59:50 (GMT) |
commit | d4c79722c8f956af30b127133bd12edb9f673fc6 (patch) | |
tree | 876b40651124ba40d3466f7d786eacd68f5a6d0f | |
parent | 6b2f238f361d3c9f71ba4ad3116a0b80eb3c3625 (diff) | |
download | libnl-d4c79722c8f956af30b127133bd12edb9f673fc6.zip libnl-d4c79722c8f956af30b127133bd12edb9f673fc6.tar.gz libnl-d4c79722c8f956af30b127133bd12edb9f673fc6.tar.bz2 |
all: fix "-Wformat" warnings for nl_dump*()
-rw-r--r-- | lib/netfilter/ct_obj.c | 2 | ||||
-rw-r--r-- | lib/netfilter/exp_obj.c | 2 | ||||
-rw-r--r-- | lib/route/cls/ematch/meta.c | 4 | ||||
-rw-r--r-- | lib/route/cls/u32.c | 10 | ||||
-rw-r--r-- | lib/route/link/can.c | 2 | ||||
-rw-r--r-- | lib/route/link/geneve.c | 12 | ||||
-rw-r--r-- | lib/route/link/inet6.c | 12 | ||||
-rw-r--r-- | lib/route/link/ip6tnl.c | 14 | ||||
-rw-r--r-- | lib/route/link/macsec.c | 12 | ||||
-rw-r--r-- | lib/route/link/sriov.c | 2 | ||||
-rw-r--r-- | lib/route/link/vxlan.c | 27 | ||||
-rw-r--r-- | lib/route/neightbl.c | 262 | ||||
-rw-r--r-- | lib/route/qdisc/tbf.c | 6 | ||||
-rw-r--r-- | lib/route/tc.c | 23 | ||||
-rw-r--r-- | lib/xfrm/ae.c | 5 | ||||
-rw-r--r-- | lib/xfrm/sa.c | 21 | ||||
-rw-r--r-- | lib/xfrm/sp.c | 24 |
17 files changed, 220 insertions, 220 deletions
diff --git a/lib/netfilter/ct_obj.c b/lib/netfilter/ct_obj.c index 254c2ca..86cbc17 100644 --- a/lib/netfilter/ct_obj.c +++ b/lib/netfilter/ct_obj.c @@ -204,7 +204,7 @@ static void ct_dump_line(struct nl_object *a, struct nl_dump_params *p) delta_time /= NSEC_PER_SEC; else delta_time = 0; - nl_dump(p, "delta-time %llu ", delta_time); + nl_dump(p, "delta-time %llu ", (long long unsigned)delta_time); } nl_dump(p, "\n"); diff --git a/lib/netfilter/exp_obj.c b/lib/netfilter/exp_obj.c index 9a69f3d..21311c9 100644 --- a/lib/netfilter/exp_obj.c +++ b/lib/netfilter/exp_obj.c @@ -218,7 +218,7 @@ static void exp_dump_tuples(struct nfnl_exp *exp, struct nl_dump_params *p) } if (nfnl_exp_test_nat_dir(exp)) - nl_dump(p, "nat dir %s ", exp->exp_nat_dir); + nl_dump(p, "nat dir %u ", exp->exp_nat_dir); } diff --git a/lib/route/cls/ematch/meta.c b/lib/route/cls/ematch/meta.c index 6d724d6..3f63cde 100644 --- a/lib/route/cls/ematch/meta.c +++ b/lib/route/cls/ematch/meta.c @@ -240,9 +240,9 @@ static void dump_value(struct rtnl_meta_value *v, struct nl_dump_params *p) nl_dump(p, " >> %u", v->mv_shift); if (v->mv_len == 4) - nl_dump(p, " & %#x", *(uint32_t *) (v + 1)); + nl_dump(p, " & %#lx", (long unsigned) *(uint32_t *) (v + 1)); else if (v->mv_len == 8) - nl_dump(p, " & %#x", *(uint64_t *) (v + 1)); + nl_dump(p, " & %#llx", (long long unsigned) (*(uint64_t *) (v + 1))); } break; diff --git a/lib/route/cls/u32.c b/lib/route/cls/u32.c index 52db293..56952fb 100644 --- a/lib/route/cls/u32.c +++ b/lib/route/cls/u32.c @@ -343,7 +343,9 @@ static void print_selector(struct nl_dump_params *p, struct tc_u32_sel *sel, if (p->dp_type == NL_DUMP_STATS && (u->cu_mask & U32_ATTR_PCNT)) { struct tc_u32_pcnt *pcnt = u->cu_pcnt->d_data; - nl_dump(p, " successful %" PRIu64, pcnt->kcnts[i]); + + nl_dump(p, " successful %llu", + (long long unsigned)pcnt->kcnts[i]); } } } @@ -398,9 +400,11 @@ static void u32_dump_stats(struct rtnl_tc *tc, void *data, if (u->cu_mask & U32_ATTR_PCNT) { struct tc_u32_pcnt *pc = u->cu_pcnt->d_data; + nl_dump(p, "\n"); - nl_dump_line(p, " hit %8" PRIu64 " count %8" PRIu64 "\n", - pc->rhit, pc->rcnt); + nl_dump_line(p, " hit %8llu count %8llu\n", + (long long unsigned)pc->rhit, + (long long unsigned)pc->rcnt); } } diff --git a/lib/route/link/can.c b/lib/route/link/can.c index 759cb2c..da8f092 100644 --- a/lib/route/link/can.c +++ b/lib/route/link/can.c @@ -273,7 +273,7 @@ static void can_dump_details(struct rtnl_link *link, struct nl_dump_params *p) } if (ci->ci_mask & CAN_HAS_CLOCK) { - nl_dump_line(p," base freq %d Hz\n", ci->ci_clock); + nl_dump_line(p," base freq %u Hz\n", ci->ci_clock.freq); } diff --git a/lib/route/link/geneve.c b/lib/route/link/geneve.c index e52770c..cab57cc 100644 --- a/lib/route/link/geneve.c +++ b/lib/route/link/geneve.c @@ -186,16 +186,12 @@ static void geneve_dump_details(struct rtnl_link *link, struct nl_dump_params *p if (geneve->mask & GENEVE_ATTR_REMOTE) { nl_dump(p, " remote "); - if (inet_ntop(AF_INET, &geneve->remote, addr, sizeof(addr))) - nl_dump_line(p, "%s\n", addr); - else - nl_dump_line(p, "%#x\n", ntohs(geneve->remote)); + nl_dump_line(p, "%s\n", + _nl_inet_ntop(AF_INET, &geneve->remote, addr)); } else if (geneve->mask & GENEVE_ATTR_REMOTE6) { nl_dump(p, " remote "); - if (inet_ntop(AF_INET6, &geneve->remote6, addr, sizeof(addr))) - nl_dump_line(p, "%s\n", addr); - else - nl_dump_line(p, "%#x\n", geneve->remote6); + nl_dump_line(p, "%s\n", + _nl_inet_ntop(AF_INET6, &geneve->remote6, addr)); } if (geneve->mask & GENEVE_ATTR_TTL) { diff --git a/lib/route/link/inet6.c b/lib/route/link/inet6.c index 0cf1623..afcbbce 100644 --- a/lib/route/link/inet6.c +++ b/lib/route/link/inet6.c @@ -413,7 +413,7 @@ static void inet6_dump_stats(struct rtnl_link *link, if (octets) nl_dump(p, "%14.2f %3s ", octets, octetsUnit); else - nl_dump(p, "%16" PRIu64 " B ", 0); + nl_dump(p, "%16u B ", 0); nl_dump(p, "%18" PRIu64 " %18" PRIu64 "\n", link->l_stats[RTNL_LINK_IP6_INDISCARDS], @@ -429,7 +429,7 @@ static void inet6_dump_stats(struct rtnl_link *link, if (octets) nl_dump(p, "%14.2f %3s ", octets, octetsUnit); else - nl_dump(p, "%16" PRIu64 " B ", 0); + nl_dump(p, "%16u B ", 0); nl_dump(p, "%18" PRIu64 " %18" PRIu64 "\n", link->l_stats[RTNL_LINK_IP6_OUTDISCARDS], @@ -445,7 +445,7 @@ static void inet6_dump_stats(struct rtnl_link *link, if (octets) nl_dump(p, "%14.2f %3s ", octets, octetsUnit); else - nl_dump(p, "%16" PRIu64 " B ", 0); + nl_dump(p, "%16u B ", 0); nl_dump(p, "%18" PRIu64 " ", link->l_stats[RTNL_LINK_IP6_INBCASTPKTS]); octets = nl_cancel_down_bytes(link->l_stats[RTNL_LINK_IP6_INBCASTOCTETS], @@ -453,7 +453,7 @@ static void inet6_dump_stats(struct rtnl_link *link, if (octets) nl_dump(p, "%14.2f %3s\n", octets, octetsUnit); else - nl_dump(p, "%16" PRIu64 " B\n", 0); + nl_dump(p, "%16u B\n", 0); nl_dump(p, " OutMcastPkts OutMcastOctets " " OutBcastPkts OutBcastOctests\n"); @@ -465,7 +465,7 @@ static void inet6_dump_stats(struct rtnl_link *link, if (octets) nl_dump(p, "%14.2f %3s ", octets, octetsUnit); else - nl_dump(p, "%16" PRIu64 " B ", 0); + nl_dump(p, "%16u B ", 0); nl_dump(p, "%18" PRIu64 " ", link->l_stats[RTNL_LINK_IP6_OUTBCASTPKTS]); octets = nl_cancel_down_bytes(link->l_stats[RTNL_LINK_IP6_OUTBCASTOCTETS], @@ -473,7 +473,7 @@ static void inet6_dump_stats(struct rtnl_link *link, if (octets) nl_dump(p, "%14.2f %3s\n", octets, octetsUnit); else - nl_dump(p, "%16" PRIu64 " B\n", 0); + nl_dump(p, "%16u B\n", 0); nl_dump(p, " ReasmOKs ReasmFails " " ReasmReqds ReasmTimeout\n"); diff --git a/lib/route/link/ip6tnl.c b/lib/route/link/ip6tnl.c index c641c3f..cdc9024 100644 --- a/lib/route/link/ip6tnl.c +++ b/lib/route/link/ip6tnl.c @@ -241,20 +241,14 @@ static void ip6_tnl_dump_details(struct rtnl_link *link, struct nl_dump_params * if (ip6_tnl->ip6_tnl_mask & IP6_TNL_ATTR_LOCAL) { nl_dump(p, " local "); - - if(inet_ntop(AF_INET6, &ip6_tnl->local, addr, INET6_ADDRSTRLEN)) - nl_dump_line(p, "%s\n", addr); - else - nl_dump_line(p, "%#x\n", ip6_tnl->local); + nl_dump_line(p, "%s\n", + _nl_inet_ntop(AF_INET6, &ip6_tnl->local, addr)); } if (ip6_tnl->ip6_tnl_mask & IP6_TNL_ATTR_REMOTE) { nl_dump(p, " remote "); - - if(inet_ntop(AF_INET6, &ip6_tnl->remote, addr, INET6_ADDRSTRLEN)) - nl_dump_line(p, "%s\n", addr); - else - nl_dump_line(p, "%#x\n", ip6_tnl->remote); + nl_dump_line(p, "%s\n", + _nl_inet_ntop(AF_INET6, &ip6_tnl->remote, addr)); } if (ip6_tnl->ip6_tnl_mask & IP6_TNL_ATTR_TTL) { diff --git a/lib/route/link/macsec.c b/lib/route/link/macsec.c index 04edc35..16b65b0 100644 --- a/lib/route/link/macsec.c +++ b/lib/route/link/macsec.c @@ -263,7 +263,8 @@ static void macsec_dump_line(struct rtnl_link *link, struct nl_dump_params *p) struct macsec_info *info = link->l_info; char tmp[128]; - nl_dump(p, "sci %016llx <%s>", ntohll(info->sci), flags_str(tmp, sizeof(tmp), info)); + nl_dump(p, "sci %016llx <%s>", (long long unsigned)ntohll(info->sci), + flags_str(tmp, sizeof(tmp), info)); } static void macsec_dump_details(struct rtnl_link *link, struct nl_dump_params *p) @@ -271,12 +272,15 @@ static void macsec_dump_details(struct rtnl_link *link, struct nl_dump_params *p struct macsec_info *info = link->l_info; char tmp[128]; - nl_dump(p, " sci %016llx protect %s encoding_sa %d encrypt %s send_sci %s validate %s %s\n", - ntohll(info->sci), values_on_off[info->protect], info->encoding_sa, values_on_off[info->encrypt], values_on_off[info->send_sci], + nl_dump(p, + " sci %016llx protect %s encoding_sa %d encrypt %s send_sci %s validate %s %s\n", + (long long unsigned)ntohll(info->sci), + values_on_off[info->protect], info->encoding_sa, + values_on_off[info->encrypt], values_on_off[info->send_sci], VALIDATE_STR[info->validate], replay_protect_str(tmp, info->replay_protect, info->window)); nl_dump(p, " cipher suite: %016llx, icv_len %d\n", - info->cipher_suite, info->icv_len); + (long long unsigned)info->cipher_suite, info->icv_len); } static int macsec_clone(struct rtnl_link *dst, struct rtnl_link *src) diff --git a/lib/route/link/sriov.c b/lib/route/link/sriov.c index 46fa645..3b4c028 100644 --- a/lib/route/link/sriov.c +++ b/lib/route/link/sriov.c @@ -228,7 +228,7 @@ static void dump_vf_stats(struct rtnl_link_vf *vf_data, char *unit; float res; - nl_dump(p, " VF %" PRIu64 " Stats:\n", vf_data->vf_index); + nl_dump(p, " VF %u Stats:\n", vf_data->vf_index); nl_dump_line(p, "\tRX: %-14s %-10s %-10s %-10s\n", "bytes", "packets", "multicast", "broadcast"); diff --git a/lib/route/link/vxlan.c b/lib/route/link/vxlan.c index 88cf652..7b8429c 100644 --- a/lib/route/link/vxlan.c +++ b/lib/route/link/vxlan.c @@ -316,16 +316,12 @@ static void vxlan_dump_details(struct rtnl_link *link, struct nl_dump_params *p) if (vxi->ce_mask & VXLAN_ATTR_GROUP) { nl_dump(p, " group "); - if (inet_ntop(AF_INET, &vxi->vxi_group, addr, sizeof(addr))) - nl_dump_line(p, "%s\n", addr); - else - nl_dump_line(p, "%#x\n", ntohs(vxi->vxi_group)); + nl_dump_line(p, "%s\n", + _nl_inet_ntop(AF_INET, &vxi->vxi_group, addr)); } else if (vxi->ce_mask & VXLAN_ATTR_GROUP6) { nl_dump(p, " group "); - if (inet_ntop(AF_INET6, &vxi->vxi_group6, addr, sizeof(addr))) - nl_dump_line(p, "%s\n", addr); - else - nl_dump_line(p, "%#x\n", vxi->vxi_group6); + nl_dump_line(p, "%s\n", + _nl_inet_ntop(AF_INET6, &vxi->vxi_group6, addr)); } if (vxi->ce_mask & VXLAN_ATTR_LINK) { @@ -344,19 +340,14 @@ static void vxlan_dump_details(struct rtnl_link *link, struct nl_dump_params *p) if (vxi->ce_mask & VXLAN_ATTR_LOCAL) { nl_dump(p, " local "); - if (inet_ntop(AF_INET, &vxi->vxi_local, addr, sizeof(addr))) - nl_dump_line(p, "%s\n", addr); - else - nl_dump_line(p, "%#x\n", ntohs(vxi->vxi_local)); + nl_dump_line(p, "%s\n", + _nl_inet_ntop(AF_INET, &vxi->vxi_local, addr)); } else if (vxi->ce_mask & VXLAN_ATTR_LOCAL6) { nl_dump(p, " local "); - if (inet_ntop(AF_INET6, &vxi->vxi_local6, addr, sizeof(addr))) - nl_dump_line(p, "%s\n", addr); - else - nl_dump_line(p, "%#x\n", vxi->vxi_local6); + nl_dump_line(p, "%s\n", + _nl_inet_ntop(AF_INET6, &vxi->vxi_local6, addr)); } - if (vxi->ce_mask & VXLAN_ATTR_TTL) { nl_dump(p, " ttl "); if(vxi->vxi_ttl) @@ -368,7 +359,7 @@ static void vxlan_dump_details(struct rtnl_link *link, struct nl_dump_params *p) if (vxi->ce_mask & VXLAN_ATTR_TOS) { nl_dump(p, " tos "); if (vxi->vxi_tos == 1) - nl_dump_line(p, "inherit\n", vxi->vxi_tos); + nl_dump_line(p, "inherit\n"); else nl_dump_line(p, "%#x\n", vxi->vxi_tos); } diff --git a/lib/route/neightbl.c b/lib/route/neightbl.c index 468613b..c4244fc 100644 --- a/lib/route/neightbl.c +++ b/lib/route/neightbl.c @@ -19,31 +19,31 @@ #include <netlink/route/link.h> /** @cond SKIP */ -#define NEIGHTBL_ATTR_FAMILY 0x001 -#define NEIGHTBL_ATTR_STATS 0x002 -#define NEIGHTBL_ATTR_NAME 0x004 -#define NEIGHTBL_ATTR_THRESH1 0x008 -#define NEIGHTBL_ATTR_THRESH2 0x010 -#define NEIGHTBL_ATTR_THRESH3 0x020 -#define NEIGHTBL_ATTR_CONFIG 0x040 -#define NEIGHTBL_ATTR_PARMS 0x080 -#define NEIGHTBL_ATTR_GC_INTERVAL 0x100 - -#define NEIGHTBLPARM_ATTR_IFINDEX 0x0001 -#define NEIGHTBLPARM_ATTR_REFCNT 0x0002 -#define NEIGHTBLPARM_ATTR_QUEUE_LEN 0x0004 -#define NEIGHTBLPARM_ATTR_APP_PROBES 0x0008 -#define NEIGHTBLPARM_ATTR_UCAST_PROBES 0x0010 -#define NEIGHTBLPARM_ATTR_MCAST_PROBES 0x0020 -#define NEIGHTBLPARM_ATTR_PROXY_QLEN 0x0040 -#define NEIGHTBLPARM_ATTR_REACHABLE_TIME 0x0080 +#define NEIGHTBL_ATTR_FAMILY 0x001 +#define NEIGHTBL_ATTR_STATS 0x002 +#define NEIGHTBL_ATTR_NAME 0x004 +#define NEIGHTBL_ATTR_THRESH1 0x008 +#define NEIGHTBL_ATTR_THRESH2 0x010 +#define NEIGHTBL_ATTR_THRESH3 0x020 +#define NEIGHTBL_ATTR_CONFIG 0x040 +#define NEIGHTBL_ATTR_PARMS 0x080 +#define NEIGHTBL_ATTR_GC_INTERVAL 0x100 + +#define NEIGHTBLPARM_ATTR_IFINDEX 0x0001 +#define NEIGHTBLPARM_ATTR_REFCNT 0x0002 +#define NEIGHTBLPARM_ATTR_QUEUE_LEN 0x0004 +#define NEIGHTBLPARM_ATTR_APP_PROBES 0x0008 +#define NEIGHTBLPARM_ATTR_UCAST_PROBES 0x0010 +#define NEIGHTBLPARM_ATTR_MCAST_PROBES 0x0020 +#define NEIGHTBLPARM_ATTR_PROXY_QLEN 0x0040 +#define NEIGHTBLPARM_ATTR_REACHABLE_TIME 0x0080 #define NEIGHTBLPARM_ATTR_BASE_REACHABLE_TIME 0x0100 -#define NEIGHTBLPARM_ATTR_RETRANS_TIME 0x0200 -#define NEIGHTBLPARM_ATTR_GC_STALETIME 0x0400 +#define NEIGHTBLPARM_ATTR_RETRANS_TIME 0x0200 +#define NEIGHTBLPARM_ATTR_GC_STALETIME 0x0400 #define NEIGHTBLPARM_ATTR_DELAY_PROBE_TIME 0x0800 -#define NEIGHTBLPARM_ATTR_ANYCAST_DELAY 0x1000 -#define NEIGHTBLPARM_ATTR_PROXY_DELAY 0x2000 -#define NEIGHTBLPARM_ATTR_LOCKTIME 0x4000 +#define NEIGHTBLPARM_ATTR_ANYCAST_DELAY 0x1000 +#define NEIGHTBLPARM_ATTR_PROXY_DELAY 0x2000 +#define NEIGHTBLPARM_ATTR_LOCKTIME 0x4000 static struct nl_cache_ops rtnl_neightbl_ops; static struct nl_object_ops neightbl_obj_ops; @@ -52,18 +52,18 @@ static struct nl_object_ops neightbl_obj_ops; static uint64_t neightbl_compare(struct nl_object *_a, struct nl_object *_b, uint64_t attrs, int flags) { - struct rtnl_neightbl *a = (struct rtnl_neightbl *) _a; - struct rtnl_neightbl *b = (struct rtnl_neightbl *) _b; + struct rtnl_neightbl *a = (struct rtnl_neightbl *)_a; + struct rtnl_neightbl *b = (struct rtnl_neightbl *)_b; uint64_t diff = 0; #define NT_DIFF(ATTR, EXPR) ATTR_DIFF(attrs, NEIGHTBL_ATTR_##ATTR, a, b, EXPR) - diff |= NT_DIFF(FAMILY, a->nt_family != b->nt_family); - diff |= NT_DIFF(NAME, strcmp(a->nt_name, b->nt_name)); - diff |= NT_DIFF(THRESH1, a->nt_gc_thresh1 != b->nt_gc_thresh1); - diff |= NT_DIFF(THRESH2, a->nt_gc_thresh2 != b->nt_gc_thresh2); - diff |= NT_DIFF(THRESH3, a->nt_gc_thresh3 != b->nt_gc_thresh3); - diff |= NT_DIFF(GC_INTERVAL, a->nt_gc_interval != b->nt_gc_interval); + diff |= NT_DIFF(FAMILY, a->nt_family != b->nt_family); + diff |= NT_DIFF(NAME, strcmp(a->nt_name, b->nt_name)); + diff |= NT_DIFF(THRESH1, a->nt_gc_thresh1 != b->nt_gc_thresh1); + diff |= NT_DIFF(THRESH2, a->nt_gc_thresh2 != b->nt_gc_thresh2); + diff |= NT_DIFF(THRESH3, a->nt_gc_thresh3 != b->nt_gc_thresh3); + diff |= NT_DIFF(GC_INTERVAL, a->nt_gc_interval != b->nt_gc_interval); #undef NT_DIFF @@ -71,8 +71,7 @@ static uint64_t neightbl_compare(struct nl_object *_a, struct nl_object *_b, !(b->ce_mask & NEIGHTBL_ATTR_PARMS)) return diff; - /* XXX: FIXME: Compare parameter table */ - + /* XXX: FIXME: Compare parameter table */ #if 0 #define REQ(F) (fp->ntp_mask & NEIGHTBLPARM_ATTR_##F) @@ -100,17 +99,15 @@ static uint64_t neightbl_compare(struct nl_object *_a, struct nl_object *_b, return diff; } - -static struct nla_policy neightbl_policy[NDTA_MAX+1] = { - [NDTA_NAME] = { .type = NLA_STRING, - .maxlen = NTBLNAMSIZ }, - [NDTA_THRESH1] = { .type = NLA_U32 }, - [NDTA_THRESH2] = { .type = NLA_U32 }, - [NDTA_THRESH3] = { .type = NLA_U32 }, - [NDTA_GC_INTERVAL] = { .type = NLA_U32 }, - [NDTA_CONFIG] = { .minlen = sizeof(struct ndt_config) }, - [NDTA_STATS] = { .minlen = sizeof(struct ndt_stats) }, - [NDTA_PARMS] = { .type = NLA_NESTED }, +static struct nla_policy neightbl_policy[NDTA_MAX + 1] = { + [NDTA_NAME] = { .type = NLA_STRING, .maxlen = NTBLNAMSIZ }, + [NDTA_THRESH1] = { .type = NLA_U32 }, + [NDTA_THRESH2] = { .type = NLA_U32 }, + [NDTA_THRESH3] = { .type = NLA_U32 }, + [NDTA_GC_INTERVAL] = { .type = NLA_U32 }, + [NDTA_CONFIG] = { .minlen = sizeof(struct ndt_config) }, + [NDTA_STATS] = { .minlen = sizeof(struct ndt_stats) }, + [NDTA_PARMS] = { .type = NLA_NESTED }, }; static int neightbl_msg_parser(struct nl_cache_ops *ops, @@ -185,11 +182,11 @@ static int neightbl_msg_parser(struct nl_cache_ops *ops, if (err < 0) goto errout; -#define COPY_ENTRY(name, var) \ - if (tbp[NDTPA_ ##name]) { \ - p->ntp_ ##var = nla_get_u32(tbp[NDTPA_ ##name]); \ - p->ntp_mask |= NEIGHTBLPARM_ATTR_ ##name; \ - } +#define COPY_ENTRY(name, var) \ + if (tbp[NDTPA_##name]) { \ + p->ntp_##var = nla_get_u32(tbp[NDTPA_##name]); \ + p->ntp_mask |= NEIGHTBLPARM_ATTR_##name; \ + } COPY_ENTRY(IFINDEX, ifindex); COPY_ENTRY(REFCNT, refcnt); @@ -211,7 +208,7 @@ static int neightbl_msg_parser(struct nl_cache_ops *ops, ntbl->ce_mask |= NEIGHTBL_ATTR_PARMS; } - err = pp->pp_cb((struct nl_object *) ntbl, pp); + err = pp->pp_cb((struct nl_object *)ntbl, pp); errout: rtnl_neightbl_put(ntbl); return err; @@ -222,10 +219,9 @@ static int neightbl_request_update(struct nl_cache *c, struct nl_sock *h) return nl_rtgen_request(h, RTM_GETNEIGHTBL, AF_UNSPEC, NLM_F_DUMP); } - static void neightbl_dump_line(struct nl_object *arg, struct nl_dump_params *p) { - struct rtnl_neightbl *ntbl = (struct rtnl_neightbl *) arg; + struct rtnl_neightbl *ntbl = (struct rtnl_neightbl *)arg; nl_dump_line(p, "%s", ntbl->nt_name); @@ -261,101 +257,102 @@ static void neightbl_dump_line(struct nl_object *arg, struct nl_dump_params *p) nl_dump(p, "\n"); } -static void neightbl_dump_details(struct nl_object *arg, struct nl_dump_params *p) +static void neightbl_dump_details(struct nl_object *arg, + struct nl_dump_params *p) { char x[32], y[32], z[32]; - struct rtnl_neightbl *ntbl = (struct rtnl_neightbl *) arg; + struct rtnl_neightbl *ntbl = (struct rtnl_neightbl *)arg; neightbl_dump_line(arg, p); if (ntbl->ce_mask & NEIGHTBL_ATTR_CONFIG) { nl_dump_line(p, " key-len %u entry-size %u last-flush %s\n", - ntbl->nt_config.ndtc_key_len, - ntbl->nt_config.ndtc_entry_size, - nl_msec2str(ntbl->nt_config.ndtc_last_flush, - x, sizeof(x))); - - nl_dump_line(p, " gc threshold %u/%u/%u interval %s " \ - "chain-position %u\n", - ntbl->nt_gc_thresh1, ntbl->nt_gc_thresh2, - ntbl->nt_gc_thresh3, - nl_msec2str(ntbl->nt_gc_interval, x, sizeof(x)), - ntbl->nt_config.ndtc_hash_chain_gc); + ntbl->nt_config.ndtc_key_len, + ntbl->nt_config.ndtc_entry_size, + nl_msec2str(ntbl->nt_config.ndtc_last_flush, x, + sizeof(x))); + + nl_dump_line(p, + " gc threshold %u/%u/%u interval %s " + "chain-position %u\n", + ntbl->nt_gc_thresh1, ntbl->nt_gc_thresh2, + ntbl->nt_gc_thresh3, + nl_msec2str(ntbl->nt_gc_interval, x, sizeof(x)), + ntbl->nt_config.ndtc_hash_chain_gc); nl_dump_line(p, " hash-rand 0x%08X/0x%08X last-rand %s\n", - ntbl->nt_config.ndtc_hash_rnd, - ntbl->nt_config.ndtc_hash_mask, - nl_msec2str(ntbl->nt_config.ndtc_last_rand, - x, sizeof(x))); + ntbl->nt_config.ndtc_hash_rnd, + ntbl->nt_config.ndtc_hash_mask, + nl_msec2str(ntbl->nt_config.ndtc_last_rand, x, + sizeof(x))); } if (ntbl->ce_mask & NEIGHTBL_ATTR_PARMS) { struct rtnl_neightbl_parms *pa = &ntbl->nt_parms; - nl_dump_line(p, " refcnt %u pending-queue-limit %u " \ - "proxy-delayed-queue-limit %u\n", - pa->ntp_refcnt, - pa->ntp_queue_len, - pa->ntp_proxy_qlen); - - nl_dump_line(p, " num-userspace-probes %u num-unicast-probes " \ - "%u num-multicast-probes %u\n", - pa->ntp_app_probes, - pa->ntp_ucast_probes, - pa->ntp_mcast_probes); - - nl_dump_line(p, " min-age %s base-reachable-time %s " \ - "stale-check-interval %s\n", - nl_msec2str(pa->ntp_locktime, x, sizeof(x)), - nl_msec2str(pa->ntp_base_reachable_time, - y, sizeof(y)), - nl_msec2str(pa->ntp_gc_stale_time, z, sizeof(z))); - - nl_dump_line(p, " initial-probe-delay %s answer-delay %s " \ - "proxy-answer-delay %s\n", - nl_msec2str(pa->ntp_probe_delay, x, sizeof(x)), - nl_msec2str(pa->ntp_anycast_delay, y, sizeof(y)), - nl_msec2str(pa->ntp_proxy_delay, z, sizeof(z))); + nl_dump_line(p, + " refcnt %u pending-queue-limit %u " + "proxy-delayed-queue-limit %u\n", + pa->ntp_refcnt, pa->ntp_queue_len, + pa->ntp_proxy_qlen); + + nl_dump_line(p, + " num-userspace-probes %u num-unicast-probes " + "%u num-multicast-probes %u\n", + pa->ntp_app_probes, pa->ntp_ucast_probes, + pa->ntp_mcast_probes); + + nl_dump_line(p, + " min-age %s base-reachable-time %s " + "stale-check-interval %s\n", + nl_msec2str(pa->ntp_locktime, x, sizeof(x)), + nl_msec2str(pa->ntp_base_reachable_time, y, + sizeof(y)), + nl_msec2str(pa->ntp_gc_stale_time, z, sizeof(z))); + + nl_dump_line(p, + " initial-probe-delay %s answer-delay %s " + "proxy-answer-delay %s\n", + nl_msec2str(pa->ntp_probe_delay, x, sizeof(x)), + nl_msec2str(pa->ntp_anycast_delay, y, sizeof(y)), + nl_msec2str(pa->ntp_proxy_delay, z, sizeof(z))); } } static void neightbl_dump_stats(struct nl_object *arg, struct nl_dump_params *p) { - struct rtnl_neightbl *ntbl = (struct rtnl_neightbl *) arg; + struct rtnl_neightbl *ntbl = (struct rtnl_neightbl *)arg; neightbl_dump_details(arg, p); if (!(ntbl->ce_mask & NEIGHTBL_ATTR_STATS)) return; - nl_dump_line(p, " " \ - " lookups %" PRIu64 \ - " hits %" PRIu64 \ - " failed %" PRIu64 \ - " allocations %" PRIu64 \ - " destroys %" PRIu64 \ - "\n", - ntbl->nt_stats.ndts_lookups, - ntbl->nt_stats.ndts_hits, - ntbl->nt_stats.ndts_res_failed, - ntbl->nt_stats.ndts_allocs, - ntbl->nt_stats.ndts_destroys); - - nl_dump_line(p, " " \ - " hash-grows %" PRIu64 \ - " forced-gc-runs %" PRIu64 \ - " periodic-gc-runs %" PRIu64 \ - "\n", - ntbl->nt_stats.ndts_hash_grows, - ntbl->nt_stats.ndts_forced_gc_runs, - ntbl->nt_stats.ndts_periodic_gc_runs); - - nl_dump_line(p, " " \ - " rcv-unicast-probes %" PRIu64 \ - " rcv-multicast-probes %" PRIu64 \ - "\n", - ntbl->nt_stats.ndts_rcv_probes_ucast, - ntbl->nt_stats.ndts_rcv_probes_mcast); + nl_dump_line(p, + " " + " lookups %llu hits %llu failed %llu" + " allocations %llu destroys %llu\n", + (long long unsigned)ntbl->nt_stats.ndts_lookups, + (long long unsigned)ntbl->nt_stats.ndts_hits, + (long long unsigned)ntbl->nt_stats.ndts_res_failed, + (long long unsigned)ntbl->nt_stats.ndts_allocs, + (long long unsigned)ntbl->nt_stats.ndts_destroys); + + nl_dump_line(p, + " " + " hash-grows %llu forced-gc-runs %llu" + " periodic-gc-runs %llu\n", + (long long unsigned)ntbl->nt_stats.ndts_hash_grows, + (long long unsigned)ntbl->nt_stats.ndts_forced_gc_runs, + (long long unsigned)ntbl->nt_stats.ndts_periodic_gc_runs); + + nl_dump_line(p, + " " + " rcv-unicast-probes %llu" + " rcv-multicast-probes %llu" + "\n", + (long long unsigned)ntbl->nt_stats.ndts_rcv_probes_ucast, + (long long unsigned)ntbl->nt_stats.ndts_rcv_probes_mcast); } /** @@ -365,12 +362,12 @@ static void neightbl_dump_stats(struct nl_object *arg, struct nl_dump_params *p) struct rtnl_neightbl *rtnl_neightbl_alloc(void) { - return (struct rtnl_neightbl *) nl_object_alloc(&neightbl_obj_ops); + return (struct rtnl_neightbl *)nl_object_alloc(&neightbl_obj_ops); } void rtnl_neightbl_put(struct rtnl_neightbl *neightbl) { - nl_object_put((struct nl_object *) neightbl); + nl_object_put((struct nl_object *)neightbl); } /** @} */ @@ -417,11 +414,11 @@ struct rtnl_neightbl *rtnl_neightbl_get(struct nl_cache *cache, if (cache->c_ops != &rtnl_neightbl_ops) return NULL; - nl_list_for_each_entry(nt, &cache->c_items, ce_list) { + nl_list_for_each_entry (nt, &cache->c_items, ce_list) { if (!strcasecmp(nt->nt_name, name) && ((!ifindex && !nt->nt_parms.ntp_ifindex) || (ifindex && ifindex == nt->nt_parms.ntp_ifindex))) { - nl_object_get((struct nl_object *) nt); + nl_object_get((struct nl_object *)nt); return nt; } } @@ -480,8 +477,7 @@ int rtnl_neightbl_build_change_request(struct rtnl_neightbl *old, NLA_PUT_U32(m, NDTA_THRESH2, tmpl->nt_gc_thresh2); if (tmpl->ce_mask & NEIGHTBL_ATTR_GC_INTERVAL) - NLA_PUT_U64(m, NDTA_GC_INTERVAL, - tmpl->nt_gc_interval); + NLA_PUT_U64(m, NDTA_GC_INTERVAL, tmpl->nt_gc_interval); if (tmpl->ce_mask & NEIGHTBL_ATTR_PARMS) { struct rtnl_neightbl_parms *p = &tmpl->nt_parms; @@ -492,8 +488,7 @@ int rtnl_neightbl_build_change_request(struct rtnl_neightbl *old, if (old->nt_parms.ntp_mask & NEIGHTBLPARM_ATTR_IFINDEX) NLA_PUT_U32(parms, NDTPA_IFINDEX, - old->nt_parms.ntp_ifindex); - + old->nt_parms.ntp_ifindex); if (p->ntp_mask & NEIGHTBLPARM_ATTR_QUEUE_LEN) NLA_PUT_U32(parms, NDTPA_QUEUE_LEN, p->ntp_queue_len); @@ -510,8 +505,7 @@ int rtnl_neightbl_build_change_request(struct rtnl_neightbl *old, p->ntp_mcast_probes); if (p->ntp_mask & NEIGHTBLPARM_ATTR_PROXY_QLEN) - NLA_PUT_U32(parms, NDTPA_PROXY_QLEN, - p->ntp_proxy_qlen); + NLA_PUT_U32(parms, NDTPA_PROXY_QLEN, p->ntp_proxy_qlen); if (p->ntp_mask & NEIGHTBLPARM_ATTR_BASE_REACHABLE_TIME) NLA_PUT_U64(parms, NDTPA_BASE_REACHABLE_TIME, @@ -535,7 +529,7 @@ int rtnl_neightbl_build_change_request(struct rtnl_neightbl *old, if (p->ntp_mask & NEIGHTBLPARM_ATTR_PROXY_DELAY) NLA_PUT_U64(parms, NDTPA_PROXY_DELAY, - p->ntp_proxy_delay); + p->ntp_proxy_delay); if (p->ntp_mask & NEIGHTBLPARM_ATTR_LOCKTIME) NLA_PUT_U64(parms, NDTPA_LOCKTIME, p->ntp_locktime); @@ -574,7 +568,7 @@ int rtnl_neightbl_change(struct nl_sock *sk, struct rtnl_neightbl *old, { struct nl_msg *msg; int err; - + if ((err = rtnl_neightbl_build_change_request(old, tmpl, &msg)) < 0) return err; diff --git a/lib/route/qdisc/tbf.c b/lib/route/qdisc/tbf.c index a60399c..ba8e304 100644 --- a/lib/route/qdisc/tbf.c +++ b/lib/route/qdisc/tbf.c @@ -115,9 +115,9 @@ static void tbf_dump_details(struct rtnl_tc *tc, void *data, cl = nl_cancel_down_bits(1 << tbf->qt_peakrate.rs_cell_log, &clu); - nl_dump_line(p, " peak-rate %.2f%s/s (%.0f%s) " - "bucket-size %.1f%s cell-size %.1f%s" - "latency %.1f%s", + nl_dump_line(p, + " peak-rate %.2f%s/s (%.0f%s) " + "bucket-size %.1f%s cell-size %.1f%s", pr, pru, prb, prbu, bs, bsu, cl, clu); } } diff --git a/lib/route/tc.c b/lib/route/tc.c index fb89511..a06a478 100644 --- a/lib/route/tc.c +++ b/lib/route/tc.c @@ -949,22 +949,19 @@ void rtnl_tc_dump_stats(struct nl_object *obj, struct nl_dump_params *p) res = nl_cancel_down_bytes(tc->tc_stats[RTNL_TC_BYTES], &unit); - nl_dump_line(p, - " %10.2f %3s %10u %-10u %-10u %-10u %-10u\n", - res, unit, - tc->tc_stats[RTNL_TC_PACKETS], - tc->tc_stats[RTNL_TC_DROPS], - tc->tc_stats[RTNL_TC_OVERLIMITS], - tc->tc_stats[RTNL_TC_QLEN], - tc->tc_stats[RTNL_TC_BACKLOG]); + nl_dump_line( + p, + " %10.2f %3s %10llu %-10llu %-10llu %-10llu %-10llu\n", + res, unit, (long long unsigned)tc->tc_stats[RTNL_TC_PACKETS], + (long long unsigned)tc->tc_stats[RTNL_TC_DROPS], + (long long unsigned)tc->tc_stats[RTNL_TC_OVERLIMITS], + (long long unsigned)tc->tc_stats[RTNL_TC_QLEN], + (long long unsigned)tc->tc_stats[RTNL_TC_BACKLOG]); res = nl_cancel_down_bytes(tc->tc_stats[RTNL_TC_RATE_BPS], &unit); - nl_dump_line(p, - " %10.2f %3s/s %10u/s\n", - res, - unit, - tc->tc_stats[RTNL_TC_RATE_PPS]); + nl_dump_line(p, " %10.2f %3s/s %10llu/s\n", res, unit, + (long long unsigned)tc->tc_stats[RTNL_TC_RATE_PPS]); } uint64_t rtnl_tc_compare(struct nl_object *aobj, struct nl_object *bobj, diff --git a/lib/xfrm/ae.c b/lib/xfrm/ae.c index d76000d..b8039e3 100644 --- a/lib/xfrm/ae.c +++ b/lib/xfrm/ae.c @@ -314,8 +314,9 @@ static void xfrm_ae_dump_line(struct nl_object *a, struct nl_dump_params *p) ae->flags, ae->mark.m, ae->mark.v); nl_dump_line(p, "\tlifetime current: \n"); - nl_dump_line(p, "\t\tbytes %llu packets %llu \n", ae->lifetime_cur.bytes, - ae->lifetime_cur.packets); + nl_dump_line(p, "\t\tbytes %llu packets %llu \n", + (long long unsigned)ae->lifetime_cur.bytes, + (long long unsigned)ae->lifetime_cur.packets); if (ae->lifetime_cur.add_time != 0) { add_time = ae->lifetime_cur.add_time; diff --git a/lib/xfrm/sa.c b/lib/xfrm/sa.c index 3b657bf..5567eb7 100644 --- a/lib/xfrm/sa.c +++ b/lib/xfrm/sa.c @@ -447,14 +447,23 @@ static void xfrm_sa_dump_line(struct nl_object *a, struct nl_dump_params *p) sprintf (mode, "INF"); else sprintf (mode, "%" PRIu64, sa->lft->hard_packet_limit); - nl_dump_line(p, "\t\thard limit: %s (bytes), %s (packets)\n", flags, mode); - nl_dump_line(p, "\t\tsoft add_time: %llu (seconds), soft use_time: %llu (seconds) \n", - sa->lft->soft_add_expires_seconds, sa->lft->soft_use_expires_seconds); - nl_dump_line(p, "\t\thard add_time: %llu (seconds), hard use_time: %llu (seconds) \n", - sa->lft->hard_add_expires_seconds, sa->lft->hard_use_expires_seconds); + nl_dump_line(p, "\t\thard limit: %s (bytes), %s (packets)\n", flags, + mode); + nl_dump_line( + p, + "\t\tsoft add_time: %llu (seconds), soft use_time: %llu (seconds) \n", + (long long unsigned)sa->lft->soft_add_expires_seconds, + (long long unsigned)sa->lft->soft_use_expires_seconds); + nl_dump_line( + p, + "\t\thard add_time: %llu (seconds), hard use_time: %llu (seconds) \n", + (long long unsigned)sa->lft->hard_add_expires_seconds, + (long long unsigned)sa->lft->hard_use_expires_seconds); nl_dump_line(p, "\tlifetime current: \n"); - nl_dump_line(p, "\t\t%llu bytes, %llu packets\n", sa->curlft.bytes, sa->curlft.packets); + nl_dump_line(p, "\t\t%llu bytes, %llu packets\n", + (long long unsigned)sa->curlft.bytes, + (long long unsigned)sa->curlft.packets); if (sa->curlft.add_time != 0) { add_time = sa->curlft.add_time; diff --git a/lib/xfrm/sp.c b/lib/xfrm/sp.c index 9cf351a..df9e2fb 100644 --- a/lib/xfrm/sp.c +++ b/lib/xfrm/sp.c @@ -361,15 +361,25 @@ static void xfrm_sp_dump_line(struct nl_object *a, struct nl_dump_params *p) sprintf (share, "INF"); else sprintf (share, "%" PRIu64, sp->lft->hard_packet_limit); - nl_dump_line(p, "\t\tsoft limit: %s (bytes), %s (packets) \n", dir, action); - nl_dump_line(p, "\t\thard limit: %s (bytes), %s (packets) \n", flags, share); - nl_dump_line(p, "\t\tsoft add_time: %llu (seconds), soft use_time: %llu (seconds) \n", - sp->lft->soft_add_expires_seconds, sp->lft->soft_use_expires_seconds); - nl_dump_line(p, "\t\thard add_time: %llu (seconds), hard use_time: %llu (seconds) \n", - sp->lft->hard_add_expires_seconds, sp->lft->hard_use_expires_seconds); + nl_dump_line(p, "\t\tsoft limit: %s (bytes), %s (packets) \n", dir, + action); + nl_dump_line(p, "\t\thard limit: %s (bytes), %s (packets) \n", flags, + share); + nl_dump_line( + p, + "\t\tsoft add_time: %llu (seconds), soft use_time: %llu (seconds) \n", + (long long unsigned)sp->lft->soft_add_expires_seconds, + (long long unsigned)sp->lft->soft_use_expires_seconds); + nl_dump_line( + p, + "\t\thard add_time: %llu (seconds), hard use_time: %llu (seconds) \n", + (long long unsigned)sp->lft->hard_add_expires_seconds, + (long long unsigned)sp->lft->hard_use_expires_seconds); nl_dump_line(p, "\tlifetime current: \n"); - nl_dump_line(p, "\t\t%llu bytes, %llu packets\n", sp->curlft.bytes, sp->curlft.packets); + nl_dump_line(p, "\t\t%llu bytes, %llu packets\n", + (long long unsigned)sp->curlft.bytes, + (long long unsigned)sp->curlft.packets); if (sp->curlft.add_time != 0) { |