[pisa-src] r1077 - in trunk: libpisa pisasd

  • From: Thomas Jansen <mithi@xxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Fri, 09 Oct 2009 12:29:16 +0200

Author: tjansen
Date: Fri Oct  9 12:29:15 2009
New Revision: 1077

Log:
Fixed uninitialized MAC addresses in data packets.

Set the MAC bytes to 0 whenever we don't have a MAC (pisacd) or we don't need
a MAC (pisasd).

Modified:
   trunk/libpisa/arp.c
   trunk/pisasd/sdtun.c

Modified: trunk/libpisa/arp.c
==============================================================================
--- trunk/libpisa/arp.c Fri Oct  9 12:13:41 2009        (r1076)
+++ trunk/libpisa/arp.c Fri Oct  9 12:29:15 2009        (r1077)
@@ -146,6 +146,8 @@
        if (pisa_arp_cache_update(ip) == 0)
                return pisa_arp_cache_lookup(ip, mac);
 
+       /* Clean the MAC address if no match could be found */
+       memset(mac, 0, 6);
        return -1;
 }
 

Modified: trunk/pisasd/sdtun.c
==============================================================================
--- trunk/pisasd/sdtun.c        Fri Oct  9 12:13:41 2009        (r1076)
+++ trunk/pisasd/sdtun.c        Fri Oct  9 12:29:15 2009        (r1077)
@@ -157,6 +157,9 @@
        pisa_nat_mapping *map;
        struct sockaddr_in6 addr = {0};
 
+       /* Clean the 6 MAC bytes at the head of the buffer. */
+       memset(buffer, 0, 6);
+
        if ((len = read(sd_ctx.tunnel, buffer + 6, sizeof(buffer) - 6)) < 0) {
                PISA_ERROR("local -> remote: read failed: %s\n", 
strerror(errno));
                return;

Other related posts:

  • » [pisa-src] r1077 - in trunk: libpisa pisasd - Thomas Jansen