Retire use of getprotobynumber()

Dead weight. If this feature is wanted getprotobynumber()
should be called once on startup.

Change-Id: I0358bacdc60466f676fa1aab7f4b7c9e588d8d74
Reviewed-on: https://code.wireshark.org/review/24045
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
This commit is contained in:
João Valverde 2017-10-24 23:09:19 +01:00 committed by João Valverde
parent 18237cfd15
commit 0527747e23
4 changed files with 1 additions and 30 deletions

View File

@ -108,7 +108,6 @@ if(HAVE_GETOPT_LONG)
check_symbol_exists("optreset" HAVE_OPTRESET)
endif()
endif()
check_function_exists("getprotobynumber" HAVE_GETPROTOBYNUMBER)
check_function_exists("getifaddrs" HAVE_GETIFADDRS)
check_function_exists("issetugid" HAVE_ISSETUGID)
check_function_exists("mkdtemp" HAVE_MKDTEMP)

View File

@ -95,9 +95,6 @@
/* Define to 1 if you have the <getopt.h> header file. */
#cmakedefine HAVE_GETOPT_H 1
/* Define to 1 if you have the `getprotobynumber' function. */
#cmakedefine HAVE_GETPROTOBYNUMBER 1
/* Define to 1 if you have the <grp.h> header file. */
#cmakedefine HAVE_GRP_H 1

View File

@ -2347,7 +2347,6 @@ AC_REPLACE_FUNCS(strptime)
AC_REPLACE_FUNCS(popcount)
AC_CHECK_FUNCS(mkstemps mkdtemp)
AC_CHECK_FUNCS(getprotobynumber)
AC_CHECK_FUNCS(issetugid)
AC_CHECK_FUNCS(sysconf)
AC_CHECK_FUNCS(getifaddrs)

View File

@ -269,31 +269,7 @@ static const value_string ipproto_val[] = {
value_string_ext ipproto_val_ext = VALUE_STRING_EXT_INIT(ipproto_val);
const char *ipprotostr(const int proto) {
const char *s;
if ((s = try_val_to_str_ext(proto, &ipproto_val_ext)) != NULL)
return s;
s = "Unknown";
#ifdef HAVE_GETPROTOBYNUMBER
/*
* XXX - have another flag for resolving network-layer
* protocol names?
*/
if (gbl_resolv_flags.mac_name || gbl_resolv_flags.network_name ||
gbl_resolv_flags.transport_name) {
static char buf[128];
struct protoent *pe;
pe = getprotobynumber(proto);
if (pe) {
g_strlcpy(buf, pe->p_name, sizeof(buf));
s = buf;
}
}
#endif
return s;
return val_to_str_ext_const(proto, &ipproto_val_ext, "Unknown");
}
/* https://www.iana.org/assignments/ipv6-parameters/ipv6-parameters.xhtml#extension-header */