You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/net-misc/iputils/files/iputils-99999999-tracepath4...

31 lines
824 B

From 2c4d0838dda90515d4971881d86e8b969baebe01 Mon Sep 17 00:00:00 2001
From: Thomas Deutschmann <whissi@gentoo.org>
Date: Thu, 19 Oct 2017 17:38:20 +0200
Subject: [PATCH] tracepath: Support calling `tracepath` as `tracepath4` or
`tracepath6`
---
tracepath.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tracepath.c b/tracepath.c
index b0eb911..d2a6edf 100644
--- a/tracepath.c
+++ b/tracepath.c
@@ -394,6 +394,12 @@ int main(int argc, char **argv)
setlocale(LC_ALL, "");
#endif
+ /* Support being called using `tracepath4` or `tracepath6` symlinks */
+ if (argv[0][strlen(argv[0])-1] == '4')
+ hints.ai_family = AF_INET;
+ else if (argv[0][strlen(argv[0])-1] == '6')
+ hints.ai_family = AF_INET6;
+
while ((ch = getopt(argc, argv, "46nbh?l:m:p:")) != EOF) {
switch(ch) {
case '4':
--
2.14.3