PUD: make name a normal char array in _TRxTxNetworkInterface
authorFerry Huberts <ferry.huberts@pelagic.nl>
Tue, 19 Jun 2012 09:37:27 +0000 (11:37 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Tue, 19 Jun 2012 11:35:26 +0000 (13:35 +0200)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/pud/src/networkInterfaces.c
lib/pud/src/networkInterfaces.h
lib/pud/src/pud.c

index 2c6836e..9fd9685 100644 (file)
@@ -176,7 +176,7 @@ static int createRxSocket(TRxTxNetworkInterface * networkInterface,
         * which the multicast datagrams are to be received. */
        if (ipFamilySetting == AF_INET) {
                struct ip_mreq mc_settings;
-               struct interface* interface = if_ifwithname((const char *)networkInterface->name);
+               struct interface* interface = if_ifwithname(networkInterface->name);
 
                if (!interface) {
                        pudError(true, "Could not get interface address of %s", networkInterface->name);
@@ -197,7 +197,7 @@ static int createRxSocket(TRxTxNetworkInterface * networkInterface,
                struct ipv6_mreq mc6_settings;
                (void) memset(&mc6_settings, 0, sizeof(mc6_settings));
                mc6_settings.ipv6mr_multiaddr = rxMcAddr->in6.sin6_addr;
-               mc6_settings.ipv6mr_interface = if_nametoindex((char *)networkInterface->name);
+               mc6_settings.ipv6mr_interface = if_nametoindex(networkInterface->name);
                errno = 0;
                if (setsockopt(rxSocket, ipProtoSetting, ipAddMembershipSetting,
                                &mc6_settings, sizeof(mc6_settings)) < 0) {
@@ -334,7 +334,7 @@ static int createTxSocket(TRxTxNetworkInterface * networkInterface, union olsr_s
 
        memset(&address, 0, sizeof(address));
        if (txMcAddr->in.sa_family == AF_INET) {
-               struct interface* interface = if_ifwithname((const char *)networkInterface->name);
+               struct interface* interface = if_ifwithname(networkInterface->name);
 
                if (!interface) {
                        pudError(true, "Could not get interface address of %s", networkInterface->name);
@@ -363,7 +363,7 @@ static int createTxSocket(TRxTxNetworkInterface * networkInterface, union olsr_s
                ipMcLoopSetting = IPV6_MULTICAST_LOOP;
                ipMcIfSetting = IPV6_MULTICAST_IF;
                ipTtlSetting = IPV6_MULTICAST_HOPS;
-               ifIndex = if_nametoindex((char *)networkInterface->name);
+               ifIndex = if_nametoindex(networkInterface->name);
 
                addr = &ifIndex;
                addrSize = sizeof(ifIndex);
index 36c6ee1..1dd182c 100644 (file)
@@ -18,7 +18,7 @@ typedef struct _TRxTxNetworkInterface {
                int socketFd;
 
                /** The name of the interface */
-               unsigned char name[IFNAMSIZ + 1];
+               char name[IFNAMSIZ + 1];
 
                /** the socket handler function */
                socket_handler_func handler;
index 2b25f7d..69c63cf 100644 (file)
@@ -99,7 +99,7 @@ static void sendToAllTxInterfaces(unsigned char *buffer,
                TRxTxNetworkInterface *networkInterface = txNetworkInterfaces;
                errno = 0;
                if (sendto(networkInterface->socketFd, buffer, bufferLength, 0, addr, addrSize) < 0) {
-                       pudError(true, "Transmit error on interface %s", (char *) &networkInterface->name);
+                       pudError(true, "Transmit error on interface %s", &networkInterface->name[0]);
                }
                txNetworkInterfaces = networkInterface->next;
        }