slightly nicer ifname cmp
[oweals/gnunet.git] / src / nat / nat.c
index 3fcfbd2f10f47e482e321570b266d6efecd0f9d2..9eb7e7e7be68c2554800bb645af3c7b8fd43bbc6 100644 (file)
@@ -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;