aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/utils/iproute2/patches/001-fix-print_0xhex-on-32-bit.patch
blob: 25994b417325e0b9d0a86085266d61a4de5a9aff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
From 90c5c969f0b9a2fbb0016b955fecc359aa884220 Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen@networkplumber.org>
Date: Mon, 10 Dec 2018 14:20:32 -0800
Subject: [PATCH] fix print_0xhex on 32 bit

The argument to print_0xhex is converted to unsigned long long
so the format string give for normal printout has to be some
variant of %llx. Otherwise, bogus values will be printed on
32 bit platforms.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 bridge/link.c            | 2 +-
 ip/ipaddress.c           | 2 +-
 ip/iplink_bridge.c       | 2 +-
 ip/iplink_bridge_slave.c | 6 +++---
 ip/iplink_geneve.c       | 5 ++---
 ip/iplink_vxlan.c        | 8 +++-----
 ip/ipntable.c            | 2 +-
 ip/iproute.c             | 8 ++++----
 ip/iproute_lwtunnel.c    | 2 +-
 ip/iprule.c              | 6 +++---
 ip/iptuntap.c            | 2 +-
 ip/link_gre.c            | 6 +++---
 ip/link_gre6.c           | 4 ++--
 ip/link_ip6tnl.c         | 2 +-
 ip/link_iptnl.c          | 4 ++--
 ip/link_vti.c            | 2 +-
 ip/link_vti6.c           | 2 +-
 tc/m_ife.c               | 2 +-
 tc/q_htb.c               | 2 +-
 tc/q_taprio.c            | 2 +-
 20 files changed, 34 insertions(+), 37 deletions(-)

--- a/bridge/link.c
+++ b/bridge/link.c
@@ -90,7 +90,7 @@ static void print_hwmode(__u16 mode)
 {
 	if (mode >= ARRAY_SIZE(hw_mode))
 		print_0xhex(PRINT_ANY, "hwmode",
-			    "hwmode %#hx ", mode);
+			    "hwmode %#llx ", mode);
 	else
 		print_string(PRINT_ANY, "hwmode",
 			     "hwmode %s ", hw_mode[mode]);
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -129,7 +129,7 @@ static void print_operstate(FILE *f, __u
 		if (is_json_context())
 			print_uint(PRINT_JSON, "operstate_index", NULL, state);
 		else
-			print_0xhex(PRINT_FP, NULL, "state %#x", state);
+			print_0xhex(PRINT_FP, NULL, "state %#llx", state);
 	} else if (brief) {
 		print_color_string(PRINT_ANY,
 				   oper_state_color(state),
--- a/ip/iplink_bridge.c
+++ b/ip/iplink_bridge.c
@@ -524,7 +524,7 @@ static void bridge_print_opt(struct link
 	if (tb[IFLA_BR_GROUP_FWD_MASK])
 		print_0xhex(PRINT_ANY,
 			    "group_fwd_mask",
-			    "group_fwd_mask %#x ",
+			    "group_fwd_mask %#llx ",
 			    rta_getattr_u16(tb[IFLA_BR_GROUP_FWD_MASK]));
 
 	if (tb[IFLA_BR_GROUP_ADDR]) {
--- a/ip/iplink_bridge_slave.c
+++ b/ip/iplink_bridge_slave.c
@@ -167,11 +167,11 @@ static void bridge_slave_print_opt(struc
 			     rta_getattr_u8(tb[IFLA_BRPORT_UNICAST_FLOOD]));
 
 	if (tb[IFLA_BRPORT_ID])
-		print_0xhex(PRINT_ANY, "id", "port_id 0x%x ",
+		print_0xhex(PRINT_ANY, "id", "port_id %#llx ",
 			    rta_getattr_u16(tb[IFLA_BRPORT_ID]));
 
 	if (tb[IFLA_BRPORT_NO])
-		print_0xhex(PRINT_ANY, "no", "port_no 0x%x ",
+		print_0xhex(PRINT_ANY, "no", "port_no %#llx ",
 			   rta_getattr_u16(tb[IFLA_BRPORT_NO]));
 
 	if (tb[IFLA_BRPORT_DESIGNATED_PORT])
@@ -266,7 +266,7 @@ static void bridge_slave_print_opt(struc
 
 		fwd_mask = rta_getattr_u16(tb[IFLA_BRPORT_GROUP_FWD_MASK]);
 		print_0xhex(PRINT_ANY, "group_fwd_mask",
-			    "group_fwd_mask 0x%x ", fwd_mask);
+			    "group_fwd_mask %#llx ", fwd_mask);
 		_bitmask2str(fwd_mask, convbuf, sizeof(convbuf), fwd_mask_tbl);
 		print_string(PRINT_ANY, "group_fwd_mask_str",
 			     "group_fwd_mask_str %s ", convbuf);
--- a/ip/iplink_geneve.c
+++ b/ip/iplink_geneve.c
@@ -276,7 +276,7 @@ static void geneve_print_opt(struct link
 		tos = rta_getattr_u8(tb[IFLA_GENEVE_TOS]);
 	if (tos) {
 		if (is_json_context() || tos != 1)
-			print_0xhex(PRINT_ANY, "tos", "tos 0x%x ", tos);
+			print_0xhex(PRINT_ANY, "tos", "tos %#llx ", tos);
 		else
 			print_string(PRINT_FP, NULL, "tos %s ", "inherit");
 	}
@@ -286,8 +286,7 @@ static void geneve_print_opt(struct link
 
 		if (label)
 			print_0xhex(PRINT_ANY,
-				    "label",
-				    "flowlabel %#x ",
+				    "label", "flowlabel %#llx ",
 				    ntohl(label));
 	}
 
--- a/ip/iplink_vxlan.c
+++ b/ip/iplink_vxlan.c
@@ -522,7 +522,7 @@ static void vxlan_print_opt(struct link_
 		tos = rta_getattr_u8(tb[IFLA_VXLAN_TOS]);
 	if (tos) {
 		if (is_json_context() || tos != 1)
-			print_0xhex(PRINT_ANY, "tos", "tos 0x%x ", tos);
+			print_0xhex(PRINT_ANY, "tos", "tos %#llx ", tos);
 		else
 			print_string(PRINT_FP, NULL, "tos %s ", "inherit");
 	}
@@ -542,10 +542,8 @@ static void vxlan_print_opt(struct link_
 		__u32 label = rta_getattr_u32(tb[IFLA_VXLAN_LABEL]);
 
 		if (label)
-			print_0xhex(PRINT_ANY,
-				    "label",
-				    "flowlabel %#x ",
-				    ntohl(label));
+			print_0xhex(PRINT_ANY, "label",
+				    "flowlabel %#llx ", ntohl(label));
 	}
 
 	if (tb[IFLA_VXLAN_AGEING]) {
--- a/ip/ipntable.c
+++ b/ip/ipntable.c
@@ -360,7 +360,7 @@ static void print_ndtconfig(const struct
 	print_uint(PRINT_ANY, "hash_rnd",
 		   "        hash_rnd %u ", ndtc->ndtc_hash_rnd);
 	print_0xhex(PRINT_ANY, "hash_mask",
-		    "hash_mask %08x ", ndtc->ndtc_hash_mask);
+		    "hash_mask %08llx ", ndtc->ndtc_hash_mask);
 
 	print_uint(PRINT_ANY, "hash_chain_gc",
 		   "hash_chain_gc %u ", ndtc->ndtc_hash_chain_gc);
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -346,7 +346,7 @@ static void print_rtax_features(FILE *fp
 
 	if (features)
 		print_0xhex(PRINT_ANY,
-			    "features", "0x%x ", of);
+			    "features", "%#llx ", of);
 }
 
 static void print_rt_flags(FILE *fp, unsigned int flags)
@@ -483,10 +483,10 @@ static void print_rta_cacheinfo(FILE *fp
 	}
 	if (ci->rta_id)
 		print_0xhex(PRINT_ANY, "ipid",
-			    "ipid 0x%04x ", ci->rta_id);
+			    "ipid 0x%04llx ", ci->rta_id);
 	if (ci->rta_ts || ci->rta_tsage) {
 		print_0xhex(PRINT_ANY, "ts",
-			    "ts 0x%x", ci->rta_ts);
+			    "ts 0x%llx", ci->rta_ts);
 		print_uint(PRINT_ANY, "tsage",
 			   "tsage %usec ", ci->rta_tsage);
 	}
@@ -885,7 +885,7 @@ int print_route(const struct sockaddr_nl
 				print_uint(PRINT_JSON, "mark", NULL, mark);
 			else if (mark >= 16)
 				print_0xhex(PRINT_FP, NULL,
-					    "mark 0x%x ", mark);
+					    "mark 0x%llx ", mark);
 			else
 				print_uint(PRINT_FP, NULL,
 					   "mark %u ", mark);
--- a/ip/iproute_lwtunnel.c
+++ b/ip/iproute_lwtunnel.c
@@ -115,7 +115,7 @@ static void print_srh(FILE *fp, struct i
 
 		tlv = (struct sr6_tlv_hmac *)((char *)srh + offset);
 		print_0xhex(PRINT_ANY, "hmac",
-			    "hmac 0x%X ", ntohl(tlv->hmackeyid));
+			    "hmac %llX ", ntohl(tlv->hmackeyid));
 	}
 }
 
--- a/ip/iprule.c
+++ b/ip/iprule.c
@@ -263,10 +263,10 @@ int print_rule(const struct sockaddr_nl
 
 		if (tb[FRA_FWMASK] &&
 		    (mask = rta_getattr_u32(tb[FRA_FWMASK])) != 0xFFFFFFFF) {
-			print_0xhex(PRINT_ANY, "fwmark", "fwmark 0x%x", mark);
-			print_0xhex(PRINT_ANY, "fwmask", "/0x%x ", mask);
+			print_0xhex(PRINT_ANY, "fwmark", "fwmark %#llx", mark);
+			print_0xhex(PRINT_ANY, "fwmask", "/%#llx ", mask);
 		} else {
-			print_0xhex(PRINT_ANY, "fwmark", "fwmark 0x%x ", mark);
+			print_0xhex(PRINT_ANY, "fwmark", "fwmark %#llx ", mark);
 		}
 	}
 
--- a/ip/iptuntap.c
+++ b/ip/iptuntap.c
@@ -254,7 +254,7 @@ static void print_flags(long flags)
 	flags &= ~(IFF_TUN | IFF_TAP | IFF_NO_PI | IFF_ONE_QUEUE |
 		   IFF_VNET_HDR | IFF_PERSIST | IFF_NOFILTER);
 	if (flags)
-		print_0xhex(PRINT_ANY, NULL, "%#x", flags);
+		print_0xhex(PRINT_ANY, NULL, "%#llx", flags);
 
 	close_json_array(PRINT_JSON, NULL);
 }
--- a/ip/link_gre.c
+++ b/ip/link_gre.c
@@ -463,7 +463,7 @@ static void gre_print_opt(struct link_ut
 		tos = rta_getattr_u8(tb[IFLA_GRE_TOS]);
 	if (tos) {
 		if (is_json_context() || tos != 1)
-			print_0xhex(PRINT_ANY, "tos", "tos 0x%x ", tos);
+			print_0xhex(PRINT_ANY, "tos", "tos %#llx ", tos);
 		else
 			print_string(PRINT_FP, NULL, "tos %s ", "inherit");
 	}
@@ -508,7 +508,7 @@ static void gre_print_opt(struct link_ut
 
 		if (fwmark) {
 			print_0xhex(PRINT_ANY,
-				    "fwmark", "fwmark 0x%x ", fwmark);
+				    "fwmark", "fwmark %#llx ", fwmark);
 		}
 	}
 
@@ -541,7 +541,7 @@ static void gre_print_opt(struct link_ut
 		__u16 erspan_hwid = rta_getattr_u16(tb[IFLA_GRE_ERSPAN_HWID]);
 
 		print_0xhex(PRINT_ANY,
-			    "erspan_hwid", "erspan_hwid 0x%x ", erspan_hwid);
+			    "erspan_hwid", "erspan_hwid %#llx ", erspan_hwid);
 	}
 
 	tnl_print_encap(tb,
--- a/ip/link_gre6.c
+++ b/ip/link_gre6.c
@@ -576,7 +576,7 @@ static void gre_print_opt(struct link_ut
 
 		if (fwmark) {
 			print_0xhex(PRINT_ANY,
-				    "fwmark", "fwmark 0x%x ", fwmark);
+				    "fwmark", "fwmark %#llx ", fwmark);
 		}
 	}
 
@@ -609,7 +609,7 @@ static void gre_print_opt(struct link_ut
 		__u16 erspan_hwid = rta_getattr_u16(tb[IFLA_GRE_ERSPAN_HWID]);
 
 		print_0xhex(PRINT_ANY,
-			    "erspan_hwid", "erspan_hwid 0x%x ", erspan_hwid);
+			    "erspan_hwid", "erspan_hwid %#llx ", erspan_hwid);
 	}
 
 	tnl_print_encap(tb,
--- a/ip/link_ip6tnl.c
+++ b/ip/link_ip6tnl.c
@@ -457,7 +457,7 @@ static void ip6tunnel_print_opt(struct l
 
 		if (fwmark) {
 			print_0xhex(PRINT_ANY,
-				    "fwmark", "fwmark 0x%x ", fwmark);
+				    "fwmark", "fwmark %#llx ", fwmark);
 		}
 	}
 
--- a/ip/link_iptnl.c
+++ b/ip/link_iptnl.c
@@ -418,7 +418,7 @@ static void iptunnel_print_opt(struct li
 		tos = rta_getattr_u8(tb[IFLA_IPTUN_TOS]);
 	if (tos) {
 		if (is_json_context() || tos != 1)
-			print_0xhex(PRINT_ANY, "tos", "tos 0x%x ", tos);
+			print_0xhex(PRINT_ANY, "tos", "tos %#llx ", tos);
 		else
 			print_string(PRINT_FP, NULL, "tos %s ", "inherit");
 	}
@@ -476,7 +476,7 @@ static void iptunnel_print_opt(struct li
 
 		if (fwmark) {
 			print_0xhex(PRINT_ANY,
-				    "fwmark", "fwmark 0x%x ", fwmark);
+				    "fwmark", "fwmark %#llx ", fwmark);
 		}
 	}
 
--- a/ip/link_vti.c
+++ b/ip/link_vti.c
@@ -208,7 +208,7 @@ static void vti_print_opt(struct link_ut
 
 		if (fwmark) {
 			print_0xhex(PRINT_ANY,
-				    "fwmark", "fwmark 0x%x ", fwmark);
+				    "fwmark", "fwmark %#llx ", fwmark);
 		}
 	}
 }
--- a/ip/link_vti6.c
+++ b/ip/link_vti6.c
@@ -210,7 +210,7 @@ static void vti6_print_opt(struct link_u
 
 		if (fwmark) {
 			print_0xhex(PRINT_ANY,
-				    "fwmark", "fwmark 0x%x ", fwmark);
+				    "fwmark", "fwmark %#llx ", fwmark);
 		}
 	}
 }
--- a/tc/m_ife.c
+++ b/tc/m_ife.c
@@ -247,7 +247,7 @@ static int print_ife(struct action_util
 	if (tb[TCA_IFE_TYPE]) {
 		ife_type = rta_getattr_u16(tb[TCA_IFE_TYPE]);
 		has_optional = 1;
-		print_0xhex(PRINT_ANY, "type", "type 0x%X ", ife_type);
+		print_0xhex(PRINT_ANY, "type", "type %#llX ", ife_type);
 	}
 
 	if (has_optional)
--- a/tc/q_htb.c
+++ b/tc/q_htb.c
@@ -332,7 +332,7 @@ static int htb_print_opt(struct qdisc_ut
 		if (RTA_PAYLOAD(tb[TCA_HTB_INIT])  < sizeof(*gopt)) return -1;
 
 		print_int(PRINT_ANY, "r2q", "r2q %d", gopt->rate2quantum);
-		print_0xhex(PRINT_ANY, "default", " default %x", gopt->defcls);
+		print_0xhex(PRINT_ANY, "default", " default %#llx", gopt->defcls);
 		print_uint(PRINT_ANY, "direct_packets_stat",
 			   " direct_packets_stat %u", gopt->direct_pkts);
 		if (show_details) {