OSSP CVS Repository

ossp - Difference in ossp-pkg/l2/l2_sockmon.c versions 1.3 and 1.4
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/l2/l2_sockmon.c 1.3 -> 1.4

--- l2_sockmon.c 2001/09/06 19:29:14     1.3
+++ l2_sockmon.c 2001/09/07 13:03:07     1.4
@@ -27,6 +27,8 @@
 **  l2_sockmon.c: Socket monitor for use with l2_test.c
 */
 
+#include <l2.h>
+
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -100,6 +102,10 @@
     /* Set up an IPv4 TCP socket to listen on for connections. */
     if (iFamily == AF_INET6)
     {
+        /* initialize address structures */
+        memset(&laddr6,  0, sizeof(laddr6));
+        memset(&laddr6,  0, sizeof(laddr6));
+
         laddr6.sin6_family      = AF_INET6;
         laddr6.sin6_flowinfo    = 0;
         laddr6.sin6_port        = iPort;
@@ -107,6 +113,10 @@
     }
     else if (iFamily == AF_INET)
     {
+        /* initialize address structures */
+        memset(&laddr4,  0, sizeof(laddr4));
+        memset(&laddr4,  0, sizeof(laddr4));
+
         laddr4.sin_family       = AF_INET;
         laddr4.sin_port         = iPort;
         laddr4.sin_addr.s_addr  = INADDR_ANY;
@@ -149,6 +159,10 @@
 
     if (iProtocol == IPPROTO_UDP) {
         if (iFamily == AF_INET6) {
+            /* initialize address structures */
+            memset(&caddr6,  0, sizeof(caddr6));
+            memset(&caddr6,  0, sizeof(caddr6));
+
             for (;;) { /* Receive messages */
                 faddrlen = sizeof(caddr6);
                 memset(pszBuf, 0x0, BUFFSIZ); /* Init the buffer */
@@ -181,6 +195,10 @@
             }
         }
         else if (iFamily == AF_INET) {
+            /* initialize address structures */
+            memset(&caddr4,  0, sizeof(caddr4));
+            memset(&caddr4,  0, sizeof(caddr4));
+
             for (;;) { /* Receive messages */
                 faddrlen = sizeof(caddr4);
                 memset(pszBuf, 0x0, BUFFSIZ); /* Init the buffer */
@@ -222,6 +240,10 @@
 
         /* Wait for a connection request */
         if (iFamily == AF_INET6) {
+            /* initialize address structures */
+            memset(&faddr6,  0, sizeof(faddr6));
+            memset(&faddr6,  0, sizeof(faddr6));
+
             for (;;) {
                 faddrlen = sizeof (faddr6);
                 iNewsock = accept(iSock, (struct sockaddr *)&faddr6, &faddrlen);
@@ -237,6 +259,10 @@
             }
         }
         else if (iFamily == AF_INET) {
+            /* initialize address structures */
+            memset(&faddr4,  0, sizeof(faddr4));
+            memset(&faddr4,  0, sizeof(faddr4));
+
             for (;;) {
                 faddrlen = sizeof (faddr4);
                 iNewsock = accept(iSock, (struct sockaddr *)&faddr4, &faddrlen);

CVSTrac 2.0.1