From 7a57a3e01b6501ab208c18fe6762de8752d6c358 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 7 Jul 2015 21:45:31 +0000 Subject: slightly nicer ifname cmp --- src/nat/nat.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'src/nat/nat.c') diff --git a/src/nat/nat.c b/src/nat/nat.c index 3fcfbd2f1..9eb7e7e7b 100644 --- a/src/nat/nat.c +++ b/src/nat/nat.c @@ -650,6 +650,13 @@ process_hostname_ip (void *cls, } +/** + * Length of the interface names returned from os_network.c. + * (in that file, hardcoded at 11). + */ +#define IF_NAME_LEN 11 + + /** * Add the IP of our network interface to the list of * our IP addresses. @@ -689,8 +696,9 @@ process_interfaces (void *cls, "IFNAME", &tun_if)) { - if (0 == strcmp (name, - tun_if)) + if (0 == strncasecmp (name, + tun_if, + IF_NAME_LEN)) { GNUNET_free (tun_if); return GNUNET_OK; @@ -703,8 +711,9 @@ process_interfaces (void *cls, "IFNAME", &tun_if)) { - if (0 == strcmp (name, - tun_if)) + if (0 == strncasecmp (name, + tun_if, + IF_NAME_LEN)) { GNUNET_free (tun_if); return GNUNET_OK; @@ -717,8 +726,9 @@ process_interfaces (void *cls, "EXIT_IFNAME", &tun_if)) { - if (0 == strcmp (name, - tun_if)) + if (0 == strncasecmp (name, + tun_if, + IF_NAME_LEN)) { GNUNET_free (tun_if); return GNUNET_OK; -- cgit v1.2.3