aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-10-15 16:01:08 +0000
committerGerrit Code Review <gerrit@2a01:4f8:191:444b:0:0:2:12>2017-10-15 16:01:08 +0000
commit5bacb59a6c314001a053977acb4aece4695b356a (patch)
tree90ccd8631688553fa0060d6e831418cb1a31eb28
parent5b0096a2368769fbcd6ec879cc9951489f20df51 (diff)
parente37f48eaf9c7ed378c774ec97bd3b3d0f303e4a7 (diff)
Merge "sgsnemu: Use getprotobynumber() in print_ipprot()"
-rw-r--r--sgsnemu/sgsnemu.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/sgsnemu/sgsnemu.c b/sgsnemu/sgsnemu.c
index 50eca63..23cf208 100644
--- a/sgsnemu/sgsnemu.c
+++ b/sgsnemu/sgsnemu.c
@@ -993,16 +993,12 @@ static char *proc_ipv6_conf_read(const char *dev, const char *file)
static char *print_ipprot(int t)
{
- switch (t) {
- case 1:
- return "ICMP";
- case 6:
- return "TCP";
- case 17:
- return "UDP";
- default:
+ struct protoent *pe = getprotobynumber(t);
+
+ if (!pe)
return "Unknown";
- };
+ else
+ return pe->p_name;
}
static char *print_icmptype(int t)