Commit f65b6c9b authored by Dan Williams's avatar Dan Williams

	Patch from Robert Paskowitz:
	* NEWS
	  src/NetworkManagerDevice.[ch]
	  src/backends/NetworkManagerDebian.c
	  src/backends/NetworkManagerGentoo.c
	  src/backends/NetworkManagerRedHat.c
	  src/backends/NetworkManagerSlackware.c
		- Add support for grabbing and using a broadcast address
			from system config files
		- Some Gentoo backend fixes for grabbing network config
		- Fix LOG_WARN->LOG_WARNING


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@239 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
parent e567bab9
2004-10-14 Dan Williams <dcbw@redhat.com>
Patch from Robert Paskowitz:
* NEWS
src/NetworkManagerDevice.[ch]
src/backends/NetworkManagerDebian.c
src/backends/NetworkManagerGentoo.c
src/backends/NetworkManagerRedHat.c
src/backends/NetworkManagerSlackware.c
- Add support for grabbing and using a broadcast address
from system config files
- Some Gentoo backend fixes for grabbing network config
- Fix LOG_WARN->LOG_WARNING
2004-10-14 Dan Williams <dcbw@redhat.com>
* NEWS: a few small fixes in the credits
......
......@@ -5,6 +5,7 @@ NetworkManager:
* Lots of fixes, Dan Williams
* Support static IP addresses, Dan Williams
- Get broadcast address from config files, Robert Paskowitz
* Support for non-ESSID-broadcasting base stations, Dan Williams
* Only accept and manager 802.3 and 802.11 devices, Dan Williams
* Don't blow away an active wired connection on startup, Dan Williams
......
......@@ -94,6 +94,7 @@ typedef struct NMDeviceConfigInfo
guint32 ip4_gateway;
guint32 ip4_address;
guint32 ip4_netmask;
guint32 ip4_broadcast;
/* FIXME: ip6 stuff */
} NMDeviceConfigInfo;
......@@ -2504,6 +2505,19 @@ void nm_device_config_set_ip4_netmask (NMDevice *dev, guint32 netmask)
dev->config_info.ip4_netmask = netmask;
}
guint32 nm_device_config_get_ip4_broadcast (NMDevice *dev)
{
g_return_val_if_fail (dev != NULL, 0);
return (dev->config_info.ip4_broadcast);
}
void nm_device_config_set_ip4_broadcast (NMDevice *dev, guint32 broadcast)
{
g_return_if_fail (dev != NULL);
dev->config_info.ip4_broadcast = broadcast;
}
/****************************************/
......
......@@ -116,6 +116,8 @@ guint32 nm_device_config_get_ip4_gateway (NMDevice *dev);
void nm_device_config_set_ip4_gateway (NMDevice *dev, guint32 gateway);
guint32 nm_device_config_get_ip4_netmask (NMDevice *dev);
void nm_device_config_set_ip4_netmask (NMDevice *dev, guint32 netmask);
guint32 nm_device_config_get_ip4_broadcast (NMDevice *dev);
void nm_device_config_set_ip4_broadcast (NMDevice *dev, guint32 broadcast);
/* Utility routines */
NMDevice * nm_get_device_by_udi (NMData *data, const char *udi);
......
......@@ -172,7 +172,7 @@ void nm_system_device_flush_addresses (NMDevice *dev)
*/
gboolean nm_system_device_setup_static_ip4_config (NMDevice *dev)
{
syslog (LOG_WARN, "nm_system_device_setup_static_ip4_config() is not implemented yet for this distribution.\n");
syslog (LOG_WARNING, "nm_system_device_setup_static_ip4_config() is not implemented yet for this distribution.\n");
}
......
......@@ -194,20 +194,7 @@ void nm_system_device_flush_addresses (NMDevice *dev)
*/
gboolean nm_system_device_setup_static_ip4_config (NMDevice *dev)
{
syslog (LOG_WARN, "nm_system_device_setup_static_ip4_config() is not implemented yet for this distribution.\n");
}
/*
* nm_system_device_update_config_info
*
* Retrieve any relevant configuration info for a particular device
* from the system network configuration information. Clear out existing
* info before setting stuff too.
*
*/
void nm_system_device_update_config_info (NMDevice *dev)
{
syslog (LOG_WARNING, "nm_system_device_setup_static_ip4_config() is not implemented yet for this distribution.\n");
}
......@@ -300,6 +287,7 @@ void nm_system_device_update_config_info (NMDevice *dev)
guint32 ip4_address = 0;
guint32 ip4_netmask = 0;
guint32 ip4_gateway = 0;
guint32 ip4_broadcast = 0;
g_return_if_fail (dev != NULL);
......@@ -308,6 +296,7 @@ void nm_system_device_update_config_info (NMDevice *dev)
nm_device_config_set_ip4_address (dev, 0);
nm_device_config_set_ip4_gateway (dev, 0);
nm_device_config_set_ip4_netmask (dev, 0);
nm_device_config_set_ip4_broadcast (dev, 0);
/* Gentoo systems store this information in
* /etc/conf.d/net, this is for all interfaces.
......@@ -351,8 +340,6 @@ void nm_system_device_update_config_info (NMDevice *dev)
}
else
{
syslog (LOG_WARNING, "Device '%s' is setup as static, and we do not (yet) support that\n",
nm_device_get_iface (dev));
use_dhcp = FALSE;
confToken = strtok(&buffer[strlen(confline) + 2], " ");
while (count < 3)
......@@ -373,6 +360,7 @@ void nm_system_device_update_config_info (NMDevice *dev)
else if (strcmp(confToken, "broadcast") == 0)
{
confToken = strtok(NULL, " ");
ip4_broadcast = inet_addr (confToken);
count++;
bNext = 1;
}
......@@ -395,7 +383,6 @@ void nm_system_device_update_config_info (NMDevice *dev)
sscanf(buffer, ipline, &ipa, &ipb, &ipc, &ipd);
sprintf(ipline, "%d.%d.%d.%d", ipa, ipb, ipc, ipd);
ip4_gateway = inet_addr (ipline);
syslog (LOG_WARNING, "Gateway(%s): %s", nm_device_get_iface (dev), ipline);
}
}
}
......@@ -412,5 +399,7 @@ void nm_system_device_update_config_info (NMDevice *dev)
nm_device_config_set_ip4_gateway (dev, ip4_gateway);
if (ip4_netmask)
nm_device_config_set_ip4_netmask (dev, ip4_netmask);
if (ip4_broadcast)
nm_device_config_set_ip4_broadcast (dev, ip4_broadcast);
}
}
......@@ -212,6 +212,7 @@ gboolean nm_system_device_setup_static_ip4_config (NMDevice *dev)
addr = nm_device_config_get_ip4_address (dev);
netmask = nm_device_config_get_ip4_netmask (dev);
iface = nm_device_get_iface (dev);
broadcast = nm_device_config_get_ip4_broadcast (dev);
/* Calculate the prefix (# bits stripped off by the netmask) */
for (i = 0; i < IPBITS; i++)
......@@ -220,8 +221,9 @@ gboolean nm_system_device_setup_static_ip4_config (NMDevice *dev)
prefix--;
}
/* Calculate the broadcast address */
broadcast = ((addr & (int)netmask) | ~(int)netmask);
/* Calculate the broadcast address if the user didn't specify one */
if (!broadcast)
broadcast = ((addr & (int)netmask) | ~(int)netmask);
/* FIXME: what if some other device is already using our IP address? */
......@@ -350,6 +352,7 @@ void nm_system_device_update_config_info (NMDevice *dev)
guint32 ip4_address = 0;
guint32 ip4_netmask = 0;
guint32 ip4_gateway = 0;
guint32 ip4_broadcast = 0;
g_return_if_fail (dev != NULL);
......@@ -358,6 +361,7 @@ void nm_system_device_update_config_info (NMDevice *dev)
nm_device_config_set_ip4_address (dev, 0);
nm_device_config_set_ip4_gateway (dev, 0);
nm_device_config_set_ip4_netmask (dev, 0);
nm_device_config_set_ip4_broadcast (dev, 0);
/* Red Hat/Fedora Core systems store this information in
* /etc/sysconfig/network-scripts/ifcfg-* where * is the interface
......@@ -425,6 +429,13 @@ void nm_system_device_update_config_info (NMDevice *dev)
}
}
buf = svGetValue (file, "BROADCAST");
if (buf)
{
ip4_broadcast = inet_addr (buf);
free (buf);
}
if (!use_dhcp && (!ip4_address || !ip4_gateway || !ip4_netmask))
{
syslog (LOG_ERR, "Error: network configuration for device '%s' was invalid (non-DCHP configuration,"
......@@ -440,6 +451,8 @@ void nm_system_device_update_config_info (NMDevice *dev)
nm_device_config_set_ip4_gateway (dev, ip4_gateway);
if (ip4_netmask)
nm_device_config_set_ip4_netmask (dev, ip4_netmask);
if (ip4_broadcast)
nm_device_config_set_ip4_broadcast (dev, ip4_broadcast);
#if 0
syslog (LOG_DEBUG, "------ Config (%s)", nm_device_get_iface (dev));
......
......@@ -166,7 +166,7 @@ void nm_system_device_flush_addresses (NMDevice *dev)
*/
gboolean nm_system_device_setup_static_ip4_config (NMDevice *dev)
{
syslog (LOG_WARN, "nm_system_device_setup_static_ip4_config() is not implemented yet for this distribution.\n");
syslog (LOG_WARNING, "nm_system_device_setup_static_ip4_config() is not implemented yet for this distribution.\n");
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment