[hipl-commit] [trunk] Rev 3915: Replace IFNAMSIZ by IF_NAMESIZE; the latter is POSIX.

  • From: Diego Biurrun <diego@xxxxxxxxxx>
  • To: hipl-commit@xxxxxxxxxxxxx
  • Date: Wed, 10 Mar 2010 19:21:02 +0200

Committer: Diego Biurrun <diego@xxxxxxxxxx>
Date: Wed Mar 10 18:20:51 2010 +0100
Revision: 3915
Revision-id: diego@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Branch nick: trunk

Log:
  Replace IFNAMSIZ by IF_NAMESIZE; the latter is POSIX.

Modified:
  M  firewall/rule_management.c
  M  hipd/netdev.c
  M  lib/tool/nlink.c

=== modified file 'firewall/rule_management.c'
--- firewall/rule_management.c  2010-03-09 18:26:22 +0000
+++ firewall/rule_management.c  2010-03-10 17:20:51 +0000
@@ -16,6 +16,7 @@
 
 #include <stdio.h>
 #include <string.h>
+#include <net/if.h>
 #include <netinet/in.h>
 //#include <linux/types.h>
 #include <linux/netfilter.h>
@@ -898,12 +899,12 @@
     } else {
         option->boolean = 1;
     }
-    if (strlen(token) > IFNAMSIZ) {
+    if (strlen(token) > IF_NAMESIZE) {
         HIP_DEBUG("parse_if error: invalid length interface name\n");
         free(option);
         return NULL;
     } else {
-        option->value = (char *) malloc(IFNAMSIZ);
+        option->value = (char *) malloc(IF_NAMESIZE);
         strcpy(option->value, token);
     }
     return option;

=== modified file 'hipd/netdev.c'
--- hipd/netdev.c       2010-03-10 13:03:35 +0000
+++ hipd/netdev.c       2010-03-10 17:20:51 +0000
@@ -21,6 +21,7 @@
 /* required for s6_addr32 */
 #define _BSD_SOURCE
 
+#include <net/if.h>
 #include <netinet/in.h>
 #include <sys/ioctl.h>
 #include <ifaddrs.h>
@@ -105,7 +106,7 @@
     int ret  = 0;
 
     ifr.ifr_ifindex = -1;
-    strncpy(ifr.ifr_name, device_name, (size_t) IFNAMSIZ);
+    strncpy(ifr.ifr_name, device_name, (size_t) IF_NAMESIZE);
     sock            = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
 
     if (ioctl(sock, SIOCGIFINDEX, &ifr) == 0) {

=== modified file 'lib/tool/nlink.c'
--- lib/tool/nlink.c    2010-03-09 18:26:22 +0000
+++ lib/tool/nlink.c    2010-03-10 17:20:51 +0000
@@ -30,6 +30,7 @@
 /* required for s6_addr32 */
 #define _BSD_SOURCE
 
+#include <net/if.h>
 #include <sys/ioctl.h>
 
 #include "config.h"
@@ -1361,7 +1362,7 @@
     int fd;
     int err;
 
-    strncpy(ifr.ifr_name, dev, IFNAMSIZ);
+    strncpy(ifr.ifr_name, dev, IF_NAMESIZE);
     fd  = get_ctl_fd();
     if (fd < 0) {
         return -1;

Other related posts:

  • » [hipl-commit] [trunk] Rev 3915: Replace IFNAMSIZ by IF_NAMESIZE; the latter is POSIX. - Diego Biurrun