[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ipcop-svn
Subject:    [Ipcop-svn] SF.net SVN: ipcop:[3507] ipcop/trunk/src/installer
From:       owes () users ! sourceforge ! net
Date:       2009-08-28 17:44:54
Message-ID: E1Mh5VO-0001T2-PX () dn4whf1 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Revision: 3507
          http://ipcop.svn.sourceforge.net/ipcop/?rev=3507&view=rev
Author:   owes
Date:     2009-08-28 17:44:54 +0000 (Fri, 28 Aug 2009)

Log Message:
-----------
Will need to drop use of _BROADCAST in some other places as well.
Installer/Setup configuration is a special case, as the Broadcast Address is used to \
predefine DHCP End Address.

Modified Paths:
--------------
    ipcop/trunk/src/installer/common.h
    ipcop/trunk/src/installer/helper.c
    ipcop/trunk/src/installer/helper_newt.c
    ipcop/trunk/src/installer/net_dhcp.c

Modified: ipcop/trunk/src/installer/common.h
===================================================================
--- ipcop/trunk/src/installer/common.h	2009-08-28 17:01:06 UTC (rev 3506)
+++ ipcop/trunk/src/installer/common.h	2009-08-28 17:44:54 UTC (rev 3507)
@@ -153,7 +153,6 @@
     char *address[CFG_COLOURS_COUNT][MAX_NETWORK_COLOUR + 1];     /* IP */
     char *netmask[CFG_COLOURS_COUNT][MAX_NETWORK_COLOUR + 1];     /* Subnetmask \
                (like 255.255.255.0) */
     char *netaddress[CFG_COLOURS_COUNT][MAX_NETWORK_COLOUR + 1];  /* Network address \
                */
-    char *broadcast[CFG_COLOURS_COUNT][MAX_NETWORK_COLOUR + 1];   /* Broadcast \
                address */
     char *driver[CFG_COLOURS_COUNT][MAX_NETWORK_COLOUR + 1];      /* Kernel module \
*/  /* following are red-specials */
     char *red_type[MAX_NETWORK_COLOUR + 1];                       /*  */

Modified: ipcop/trunk/src/installer/helper.c
===================================================================
--- ipcop/trunk/src/installer/helper.c	2009-08-28 17:01:06 UTC (rev 3506)
+++ ipcop/trunk/src/installer/helper.c	2009-08-28 17:44:54 UTC (rev 3507)
@@ -562,9 +562,6 @@
                 return FAILURE;
             if (read_ethernet_key(i, j, "NETMASK", &ipcop_ethernet.netmask[i][j], \
exitonerror, "Subnetmask") != SUCCESS)  return FAILURE;
-            if (read_ethernet_key(i, j, "BROADCAST", \
                &ipcop_ethernet.broadcast[i][j], exitonerror, "Broadcast address")
-                != SUCCESS)
-                return FAILURE;
             if (read_ethernet_key(i, j, "NETADDRESS", \
                &ipcop_ethernet.netaddress[i][j], exitonerror, "Network address")
                 != SUCCESS)
                 return FAILURE;

Modified: ipcop/trunk/src/installer/helper_newt.c
===================================================================
--- ipcop/trunk/src/installer/helper_newt.c	2009-08-28 17:01:06 UTC (rev 3506)
+++ ipcop/trunk/src/installer/helper_newt.c	2009-08-28 17:44:54 UTC (rev 3507)
@@ -170,7 +170,6 @@
     char addresskey[STRING_SIZE];
     char netmaskkey[STRING_SIZE];
     char netaddresskey[STRING_SIZE];
-    char broadcastkey[STRING_SIZE];
     newtComponent addresslabel;
     newtComponent netmasklabel;
     newtComponent addressentry;
@@ -186,7 +185,6 @@
     sprintf(addresskey, "%s_1_ADDRESS", colour);
     sprintf(netmaskkey, "%s_1_NETMASK", colour);
     sprintf(netaddresskey, "%s_1_NETADDRESS", colour);
-    sprintf(broadcastkey, "%s_1_BROADCAST", colour);
 
     /* workaround gcc warning, there is really 1 %s there */
     tmpstring=strdup(gettext("TR_ENTER_THE_IP_ADDRESS_INFORMATION"));
@@ -258,7 +256,7 @@
                 errorbox(message);
             }
             else {
-                /* all is well, calc netaddress, broadcast and store everything */
+                /* all is well, calc netaddress and store everything */
                 unsigned long int intaddress;
                 unsigned long int intnetaddress;
                 unsigned long int intnetmask;

Modified: ipcop/trunk/src/installer/net_dhcp.c
===================================================================
--- ipcop/trunk/src/installer/net_dhcp.c	2009-08-28 17:01:06 UTC (rev 3506)
+++ ipcop/trunk/src/installer/net_dhcp.c	2009-08-28 17:44:54 UTC (rev 3507)
@@ -67,7 +67,6 @@
     struct in_addr green_address;
     struct in_addr green_netmask;
     struct in_addr green_netaddress;
-    struct in_addr green_broadcast;
     NODEKV *mainkv = NULL;
     char domainname[STRING_SIZE];
 
@@ -90,10 +89,6 @@
         errorbox(gettext("TR_UNABLE_TO_OPEN_SETTINGS_FILE"));
         return FAILURE;
     }
-    if (inet_aton(ipcop_ethernet.broadcast[GREEN][1], &green_broadcast) == 0) {
-        errorbox(gettext("TR_UNABLE_TO_OPEN_SETTINGS_FILE"));
-        return FAILURE;
-    }
 
     if (read_kv_from_file(&dhcpkv, "/var/ipcop/dhcp/settings") != SUCCESS) {
         errorbox(gettext("TR_UNABLE_TO_OPEN_SETTINGS_FILE"));
@@ -113,9 +108,12 @@
     }
     if (find_kv(dhcpkv, "START_ADDR_GREEN_1") == NULL) {
         uint32_t addr = htonl(green_address.s_addr);
+        uint32_t broadcast;
         struct in_addr iaddr;
+        
+        broadcast = addr | ~htonl(green_netmask.s_addr);
 
-        if (addr+2 < htonl(green_broadcast.s_addr)) {
+        if (addr+2 < broadcast) {
             addr++;
         }
         else {
@@ -129,10 +127,13 @@
     }
     if (find_kv(dhcpkv, "END_ADDR_GREEN_1") == NULL) {
         uint32_t addr = htonl(green_address.s_addr);
+        uint32_t broadcast;
         struct in_addr iaddr;
 
-        if (addr+2 < htonl(green_broadcast.s_addr)) {
-            addr = htonl(green_broadcast.s_addr) - 1;
+        broadcast = addr | ~htonl(green_netmask.s_addr);
+
+        if (addr+2 < broadcast) {
+            addr = broadcast - 1;
         }
         else {
             addr--;


This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ipcop-svn mailing list
Ipcop-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-svn


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic