[pisa-src] r1701 - trunk/libpisa/tunnel.c

  • From: Diego Biurrun <diego@xxxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Thu, 19 Nov 2009 03:07:18 +0100

Author: biurrun
Date: Thu Nov 19 03:07:18 2009
New Revision: 1701

Log:
Rename devname function parameter to avoid OS X compilation warnings like:
libpisa/tunnel.c:32: warning: declaration of ‘devname’ shadows a global 
declaration

Modified:
   trunk/libpisa/tunnel.c

Modified: trunk/libpisa/tunnel.c
==============================================================================
--- trunk/libpisa/tunnel.c      Thu Nov 19 03:03:18 2009        (r1700)
+++ trunk/libpisa/tunnel.c      Thu Nov 19 03:07:18 2009        (r1701)
@@ -29,7 +29,7 @@
  * @param len Size of the buffer
  * @return file descriptor of the new tunnel device
  */
-int pisa_tunnel_open_tundev(char* devname, size_t len)
+int pisa_tunnel_open_tundev(char* devicename, size_t len)
 {
        int fd_tun;
        struct ifreq ifr;
@@ -44,7 +44,7 @@
        if (ioctl(fd_tun, TUNSETIFF, (void *)&ifr) < 0)
                die("ioctl on tunnel device failed.", 2);
 
-       strncpy(devname, ifr.ifr_name, len);
+       strncpy(devicename, ifr.ifr_name, len);
 
        return fd_tun;
 }
@@ -54,12 +54,12 @@
  * ifconfig via system. We also add some firewall rules that block HIP traffic
  * over the device. This renders HIPL's try to send UPDATE packets along a
  * tunnel interface useless.
- * @param devname Name of the newly created tunnel device to be configured
+ * @param devicename Name of the newly created tunnel device to be configured
  * @param ipv4 IPv4 address which should be set
  * @param netmask net mask to use for the tunnel
  * @param mtu mtu size to use
  */
-void pisa_tunnel_configure_main(const char* devname, const struct in_addr 
*ipv4, const struct in_addr *netmask, int mtu)
+void pisa_tunnel_configure_main(const char* devicename, const struct in_addr 
*ipv4, const struct in_addr *netmask, int mtu)
 {
        char buffer[1024], ip[INET_ADDRSTRLEN], mask[INET_ADDRSTRLEN];
 
@@ -67,19 +67,19 @@
        inet_ntop(AF_INET, netmask, mask, sizeof(ip));
 
        snprintf(buffer, sizeof(buffer), "ifconfig %s %s netmask %s mtu %d",
-                devname, ip, mask, mtu);
+                devicename, ip, mask, mtu);
        if (system(buffer) < 0)
                PISA_ERROR("ERROR: %s: cannot configure the interface.\n", 
__FUNCTION__);
 
        snprintf(buffer, sizeof(buffer),
                 "iptables -A INPUT -i %s -p udp --sport 50500 --dport 50500 -j 
DROP",
-                devname);
+                devicename);
        if (system(buffer) < 0)
                PISA_ERROR("ERROR: %s: cannot configure iptables.\n", 
__FUNCTION__);
 
        snprintf(buffer, sizeof(buffer),
                 "iptables -A OUTPUT -o %s -p udp --sport 50500 --dport 50500 
-j DROP",
-                devname);
+                devicename);
        if (system(buffer) < 0)
                PISA_ERROR("ERROR: %s: cannot configure iptables.\n", 
__FUNCTION__);
 }
@@ -87,21 +87,21 @@
 /**
  * Remove firewall rules added in pisa_tunnel_configure_main. We do not want
  * to have old firewall rules lingering after termination.
- * @param devname name of the interface
+ * @param devicename name of the interface
  */
-void pisa_tunnel_remove_firewall_rules(const char *devname)
+void pisa_tunnel_remove_firewall_rules(const char *devicename)
 {
        char buffer[1024];
 
        snprintf(buffer, sizeof(buffer),
                 "iptables -D INPUT -i %s -p udp --sport 50500 --dport 50500 -j 
DROP",
-                devname);
+                devicename);
        if (system(buffer) < 0)
                PISA_ERROR("ERROR: %s: cannot configure iptables.\n", 
__FUNCTION__);
 
        snprintf(buffer, sizeof(buffer),
                 "iptables -D OUTPUT -o %s -p udp --sport 50500 --dport 50500 
-j DROP",
-                devname);
+                devicename);
        if (system(buffer) < 0)
                PISA_ERROR("ERROR: %s: cannot configure iptables.\n", 
__FUNCTION__);
 }
@@ -109,18 +109,18 @@
 /**
  * Add a second IPv4 address to the tunnel device. Used for primary
  * connections that set the IP address on the client.
- * @param devname Name of the newly created tunnel device to be configured
+ * @param devicename Name of the newly created tunnel device to be configured
  * @param ipv4 IPv4 address which should be set
  * @param netmask net mask to use for the tunnel
  * @param mtu mtu size to use
  */
-void pisa_tunnel_configure_sub(const char* devname, const struct in_addr *ipv4)
+void pisa_tunnel_configure_sub(const char* devicename, const struct in_addr 
*ipv4)
 {
        char buffer[1024], ip[INET_ADDRSTRLEN];
 
        inet_ntop(AF_INET, ipv4, ip, sizeof(ip));
 
-       snprintf(buffer, 1024, "ifconfig %s add %s", devname, ip);
+       snprintf(buffer, 1024, "ifconfig %s add %s", devicename, ip);
        if (system(buffer) < 0)
                fprintf(stderr, "ERROR: %s: cannot configure the interface.\n", 
__FUNCTION__);
 }

Other related posts:

  • » [pisa-src] r1701 - trunk/libpisa/tunnel.c - Diego Biurrun