1
0
This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
ZyXEL_PMG5617GA/package/busybox/patches/054-ENHANCE_traceroute_data_output.patch
2022-11-27 10:16:14 +00:00

86 lines
2.8 KiB
Diff

Index: busybox-1_20_1/networking/traceroute.c
===================================================================
--- busybox-1_20_1.orig/networking/traceroute.c 2015-10-08 18:44:06.716334987 +0800
+++ busybox-1_20_1/networking/traceroute.c 2015-10-08 18:42:36.052737900 +0800
@@ -303,7 +303,7 @@
#endif
/*End ZyXEL zcfg*/
-#define OPT_STRING "FIlnrdvxt:i:m:p:q:s:w:z:f:" \
+#define OPT_STRING "FIlnrdvxt:i:m:p:q:s:w:z:f:k:" \
IF_FEATURE_TRACEROUTE_SOURCE_ROUTE("g:") \
"4" IF_TRACEROUTE6("6")
enum {
@@ -324,9 +324,10 @@
OPT_WAITTIME = (1 << 14), /* w */
OPT_PAUSE_MS = (1 << 15), /* z */
OPT_FIRST_TTL = (1 << 16), /* f */
- OPT_SOURCE_ROUTE = (1 << 17) * ENABLE_FEATURE_TRACEROUTE_SOURCE_ROUTE, /* g */
- OPT_IPV4 = (1 << (17+ENABLE_FEATURE_TRACEROUTE_SOURCE_ROUTE)), /* 4 */
- OPT_IPV6 = (1 << (18+ENABLE_FEATURE_TRACEROUTE_SOURCE_ROUTE)) * ENABLE_TRACEROUTE6, /* 6 */
+ OPT_OUTPUT_RDM = (1 << 17), /* k */
+ OPT_SOURCE_ROUTE = (1 << 18) * ENABLE_FEATURE_TRACEROUTE_SOURCE_ROUTE, /* g */
+ OPT_IPV4 = (1 << (18+ENABLE_FEATURE_TRACEROUTE_SOURCE_ROUTE)), /* 4 */
+ OPT_IPV6 = (1 << (19+ENABLE_FEATURE_TRACEROUTE_SOURCE_ROUTE)) * ENABLE_TRACEROUTE6, /* 6 */
};
#define verbose (option_mask32 & OPT_VERBOSE)
@@ -373,6 +374,7 @@
/* loose source route gateway list (including room for final destination) */
uint32_t gwlist[NGATEWAYS + 1];
#endif
+ int outputRDM;
};
#define G (*ptr_to_globals)
@@ -389,6 +391,7 @@
#endif
#define recv_pkt (G.recv_pkt )
#define gwlist (G.gwlist )
+#define outputRDM (G.outputRDM)
#define INIT_G() do { \
SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
port = 32768 + 666; \
@@ -869,6 +872,13 @@
char *recv_str = NULL;
int buf_size = 0;
+
+ if(!outputRDM) {
+ printf("Standard output only\n");
+
+ return ZCFG_SUCCESS;
+ }
+
buf_size = sizeof(zcfgMsg_t)+payloadLen;
sendBuf = malloc(buf_size);
sendMsgHdr = (zcfgMsg_t*)sendBuf;
@@ -934,13 +944,15 @@
const char *payload = NULL;
int payloadLen = 0;
#endif
+ char *outputrdm_str;
+
INIT_G();
/* minimum 1 arg */
opt_complementary = "-1:x-x" IF_FEATURE_TRACEROUTE_SOURCE_ROUTE(":g::");
op |= getopt32(argv, OPT_STRING
, &tos_str, &device, &max_ttl_str, &port_str, &nprobes_str
- , &source, &waittime_str, &pausemsecs_str, &first_ttl_str
+ , &source, &waittime_str, &pausemsecs_str, &first_ttl_str, &outputrdm_str
#if ENABLE_FEATURE_TRACEROUTE_SOURCE_ROUTE
, &source_route_list
#endif
@@ -963,6 +975,10 @@
port = xatou16(port_str);
if (op & OPT_NPROBES)
nprobes = xatou_range(nprobes_str, 1, INT_MAX);
+#ifdef ZCFG_SUPPORT
+ if (op & OPT_OUTPUT_RDM)
+ outputRDM = xatou_range(outputrdm_str, 0, 1);
+#endif
if (op & OPT_SOURCE) {
/*
* set the ip source address of the outbound