Hi Dan, Apparently the last patch I submitted broke compiling NetworkManager on Gentoo by removing a variable. This patch reintroduces it, and also cleans up the code to follow the guidelines. Also, I received little to no response on the list regarding this, but it posses a bit of a problem. The configuration format has changed drastically(see net.example), and parsing it, besides being a pain in the ass, will not be backwards compatible, so we'd first need to check versions. I am not sure what could be done exactly, besides what I detailed in my previous e-mail. Do you have any suggestions? Thanks, Robert
--- /var/tmp/portage/NetworkManager-cvs-0.02/work/NetworkManager/src/backends/NetworkManagerGentoo.c 2004-11-23 18:28:16.233067368 -0500
+++ NetworkManagerGentoo.c 2004-10-14 23:00:40.000000000 -0400
@@ -219,8 +219,8 @@
*/
void nm_system_enable_loopback (void)
{
- nm_spawn_process ("/sbin/ip link set dev lo up");
- nm_spawn_process ("/sbin/ip addr add 127.0.0.1/8 brd 127.255.255.255 dev lo label loopback");
+ nm_spawn_process ("/sbin/ip link set dev lo up");
+ nm_spawn_process ("/sbin/ip addr add 127.0.0.1/8 brd 127.255.255.255 dev lo label loopback");
}
/*
@@ -231,7 +231,7 @@
*/
void nm_system_delete_default_route (void)
{
- nm_spawn_process ("/sbin/ip route del default");
+ nm_spawn_process ("/sbin/ip route del default");
}
/*
@@ -279,18 +279,19 @@
*/
void nm_system_device_update_config_info (NMDevice *dev)
{
- char *cfg_file_path = NULL;
- FILE *file = NULL;
- char buffer[100];
- char confline[100], dhcpline[100], ipline[100];
- int ipa, ipb, ipc, ipd;
- int nNext = 0, bNext = 0, count = 0;
- char *confToken;
- gboolean data_good = FALSE;
- gboolean use_dhcp = TRUE;
- guint32 ip4_address = 0;
- guint32 ip4_netmask = 0;
- guint32 ip4_gateway = 0;
+ char *cfg_file_path = NULL;
+ FILE *file = NULL;
+ char buffer[100];
+ char confline[100], dhcpline[100], ipline[100];
+ int ipa, ipb, ipc, ipd;
+ int nNext = 0, bNext = 0, count = 0;
+ char *confToken;
+ gboolean data_good = FALSE;
+ gboolean use_dhcp = TRUE;
+ guint32 ip4_address = 0;
+ guint32 ip4_netmask = 0;
+ guint32 ip4_gateway = 0;
+ guint32 ip4_broadcast = 0;
g_return_if_fail (dev != NULL);
@@ -299,10 +300,11 @@
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.
- */
+ * /etc/conf.d/net, this is for all interfaces.
+ */
cfg_file_path = g_strdup_printf ("/etc/conf.d/net");
if (!cfg_file_path)
@@ -313,91 +315,92 @@
g_free (cfg_file_path);
return;
}
- sprintf(confline, "iface_%s", nm_device_get_iface (dev));
- sprintf(dhcpline, "iface_%s=\"dhcp\"", nm_device_get_iface (dev));
- while (fgets (buffer, 499, file) && !feof (file))
- {
- /* Kock off newline if any */
- g_strstrip (buffer);
+ sprintf(confline, "iface_%s", nm_device_get_iface (dev));
+ sprintf(dhcpline, "iface_%s=\"dhcp\"", nm_device_get_iface (dev));
+ while (fgets (buffer, 499, file) && !feof (file))
+ {
+ /* Kock off newline if any */
+ g_strstrip (buffer);
- if (strncmp (buffer, confline, strlen(confline)) == 0)
+ if (strncmp (buffer, confline, strlen(confline)) == 0)
{
- /* Make sure this config file is for this device */
- if (strncmp (&buffer[strlen(confline) - strlen(nm_device_get_iface (dev))],
- nm_device_get_iface (dev), strlen(nm_device_get_iface (dev))) != 0)
+ /* Make sure this config file is for this device */
+ if (strncmp (&buffer[strlen(confline) - strlen(nm_device_get_iface (dev))],
+ nm_device_get_iface (dev), strlen(nm_device_get_iface (dev))) != 0)
{
- syslog (LOG_WARNING, "System config file '%s' does not define device '%s'\n",
- cfg_file_path, nm_device_get_iface (dev));
- break;
- }
- else
- data_good = TRUE;
+ syslog (LOG_WARNING, "System config file '%s' does not define device '%s'\n",
+ cfg_file_path, nm_device_get_iface (dev));
+ break;
+ }
+ else
+ data_good = TRUE;
- if (strncmp (buffer, dhcpline, strlen(dhcpline)) == 0)
- {
- use_dhcp = TRUE;
- }
- else
- {
- use_dhcp = FALSE;
- confToken = strtok(&buffer[strlen(confline) + 2], " ");
- while (count < 3)
- {
- if (nNext == 1 && bNext == 1)
- {
- ip4_address = inet_addr (confToken);
- count++;
- continue;
- }
- if (strcmp(confToken, "netmask") == 0)
- {
- confToken = strtok(NULL, " ");
- ip4_netmask = inet_addr (confToken);
- count++;
- nNext = 1;
- }
- else if (strcmp(confToken, "broadcast") == 0)
- {
- confToken = strtok(NULL, " ");
- count++;
- bNext = 1;
- }
- else
+ if (strncmp (buffer, dhcpline, strlen(dhcpline)) == 0)
+ {
+ use_dhcp = TRUE;
+ }
+ else
+ {
+ use_dhcp = FALSE;
+ confToken = strtok(&buffer[strlen(confline) + 2], " ");
+ while (count < 3)
{
- ip4_address = inet_addr (confToken);
- count++;
- }
+ if (nNext == 1 && bNext == 1)
+ {
+ ip4_address = inet_addr (confToken);
+ count++;
+ continue;
+ }
+ if (strcmp(confToken, "netmask") == 0)
+ {
+ confToken = strtok(NULL, " ");
+ ip4_netmask = inet_addr (confToken);
+ count++;
+ nNext = 1;
+ }
+ else if (strcmp(confToken, "broadcast") == 0)
+ {
+ confToken = strtok(NULL, " ");
+ ip4_broadcast = inet_addr (confToken);
+ count++;
+ bNext = 1;
+ }
+ else
+ {
+ ip4_address = inet_addr (confToken);
+ count++;
+ }
confToken = strtok(NULL, " ");
}
}
}
- /* If we aren't using dhcp, then try to get the gateway */
- if (!use_dhcp)
- {
- sprintf(ipline, "gateway=\"%s/", nm_device_get_iface (dev));
- if (strncmp(buffer, ipline, strlen(ipline) - 1) == 0)
+ /* If we aren't using dhcp, then try to get the gateway */
+ if (!use_dhcp)
{
- sprintf(ipline, "gateway=\"%s/%%d.%%d.%%d.%%d\"", nm_device_get_iface (dev) );
- sscanf(buffer, ipline, &ipa, &ipb, &ipc, &ipd);
- sprintf(ipline, "%d.%d.%d.%d", ipa, ipb, ipc, ipd);
- ip4_gateway = inet_addr (ipline);
- }
- }
- }
- fclose (file);
- g_free (cfg_file_path);
-
- /* If successful, set values on the device */
- if (data_good)
- {
- nm_device_config_set_use_dhcp (dev, use_dhcp);
- if (ip4_address)
- nm_device_config_set_ip4_address (dev, ip4_address);
- if (ip4_gateway)
- 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);
- }
+ sprintf(ipline, "gateway=\"%s/", nm_device_get_iface (dev));
+ if (strncmp(buffer, ipline, strlen(ipline) - 1) == 0)
+ {
+ sprintf(ipline, "gateway=\"%s/%%d.%%d.%%d.%%d\"", nm_device_get_iface (dev) );
+ sscanf(buffer, ipline, &ipa, &ipb, &ipc, &ipd);
+ sprintf(ipline, "%d.%d.%d.%d", ipa, ipb, ipc, ipd);
+ ip4_gateway = inet_addr (ipline);
+ }
+ }
+ }
+ fclose (file);
+ g_free (cfg_file_path);
+
+ /* If successful, set values on the device */
+ if (data_good)
+ {
+ nm_device_config_set_use_dhcp (dev, use_dhcp);
+ if (ip4_address)
+ nm_device_config_set_ip4_address (dev, ip4_address);
+ if (ip4_gateway)
+ 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);
+ }
}
##############################################################################
# QUICK-START
#
# The quickest start is if you want to use DHCP. In that case,
# everything should work out of the box, no configuration necessary,
# though the startup script will warn you that you haven't specified
# anything.
#
# If you want to use a static address or use DHCP explicitly, jump
# down to the section labelled IFCONFIG.
#
# If you want to do anything more fancy, you should take the time to
# read through the rest of this file.
##############################################################################
# MODULES
#
# We now support modular networking scripts which means we can easily
# add support for new interface types and modules while keeping
# compatability with existing ones.
#
# Modules load by default if the package they need is installed. If
# you specify a module here that doesn't have it's package installed
# then you get an error stating which package you need to install.
# Ideally, you only use the modules setting when you have two or more
# packages installed that supply the same service.
#
# In other words, you probably should DO NOTHING HERE...
# Prefer iproute2 over ifconfig
#modules=( "iproute2" )
# You can also specify other modules for an interface
# In this case we prefer pump over dhcpcd
#modules_eth0=( "pump" )
# You can also specify which modules not to use - for example you may be
# using a supplicant which controls wireless configuration but you still
# want to configure network settings per ESSID associated with.
#modules=( "!wireless" )
##############################################################################
# INTERFACE HANDLERS
#
# We provide two interface handlers presently: ifconfig and iproute2.
# You need one of these to do any kind of network configuration.
#-----------------------------------------------------------------------------
# IFCONFIG
# For ifconfig support, emerge sys-apps/net-tools
# For a static configuration, use something like this
ifconfig_eth0=(
"192.168.1.69 netmask 255.255.255.0"
)
# If you need aliases, use something like this instead. This sets the
# primary eth0 address to 192.168.0.2 and adds two aliases, eth0:1 and
# eth0:2
#ifconfig_eth0=(
# "192.168.0.2 netmask 255.255.255.0"
# "192.168.0.3 netmask 255.255.255.0"
# "192.168.0.4 netmask 255.255.255.0"
#)
# To add IPv6 addresses to an interface (cannot add to an aliased interface)
# These addresses are bogus - use your own
#inet6_eth0=( "4321:0:1:2:3:4:567:89ab" "4321:0:1:2:3:4:567:89ac" )
# If you don't want an inet address on your interface (ie only inet6) then
# supply null as the ifconfig parameter
#ifconfig_eth0=( "null" )
# This is just like setting the gateway config option in the old-style iface
# config, but allows one to add custom routes. This should not be needed if
# you are obtaining an address via DHCP since the default route should be set
# automatically.
routes_eth0=(
"default gw 192.168.1.99"
)
# If a specified module fails (like dhcp - see below), you can specify a fallback like so
#ifconfig_fallback_eth0=( "192.168.0.2 netmask 255.255.255.0" )
# NOTE: fallback entry must match the entry in ifconfig_eth0
#-----------------------------------------------------------------------------
# IPROUTE2
# For iproute2 support, emerge sys-apps/iproute2 and add "iproute2" to the
# modules array above like so
#modules=( "iproute2" )
# For a static configuration, use something like this
#ipaddr_eth0=(
# "192.168.0.2/24"
#)
# If you need aliases, use something like this instead. This sets the
# primary eth0 address to 192.168.0.2 and adds two aliases, eth0:1 and
# eth0:2
#ipaddr_eth0=(
# "192.168.0.2/24"
# "192.168.0.3/24"
# "192.168.0.4/24"
#)
# NOTE: inet6 addresses do not create an aliases
# To add IPv6 addresses to an interface (cannot add to an aliased interface)
# These addresses are bogus - use your own
#inet6_eth0=( "4321:0:1:2:3:4:567:89ab" "4321:0:1:2:3:4:567:89ac" )
# If you don't want an inet address on your interface (ie only inet6) then
# supply null as the ipaddr parameter
#ipaddr_eth0=( "null" )
# The following will set up the default gateway. You can also pass advanced
# route configs via this option.
#iproute_eth0=(
# "default via 192.168.0.1"
#)
# If a specified module fails (like dhcp - see below), you can specify a fallback like so
#ipaddr_fallback_eth0=( "192.168.0.2/24" )
# NOTE: fallback entry must match the entry in ifconfig_eth0
##############################################################################
# OPTIONAL MODULES
#-----------------------------------------------------------------------------
# WIRELESS (802.11 support)
# For wireless support, emerge net-wireless/wireless-tools
#
# Wireless options are held in /etc/conf.d/wireless - but could be here too
# The wireless setting are generally not configured for a specific interface
# as they are more geared towards specific ESSID's
#
# When an interface has been associated with an Access Point, a global
# variable called ESSID is set to the Access Point's ESSID for use in the
# pre/post user functions below - although it's probably only really
# usefull in the postup() function
#
# If you're using a supplicant which controls wireless configuration but you
# still want to configure network settings per ESSID associated with then you
# need to explictally state you don't want wireless
#modules=( "!wireless" )
#-----------------------------------------------------------------------------
# DHCP
# DHCP can be provided by dhcpcd (default), dhclient, udhcpc or pump
#
# dhcpcd: emerge net-misc/dhcpcd
# dhclient: emerge net-misc/dhcp and modules=( "dhclient" ) above
# udhcp: emerge net-misc/udhcp and modules=( "udhcp" ) above
# pump: emerge net-misc/pump and modules=( "pump" ) above
#
# Notes:
# - all clients except for dhclient send the current hostname to the DHCP
# server by default
# - pump does not support NIS
# Regardless of which DHCP client you prefer, you configure them the
# same way using one of following depending on which interface modules
# you're using.
#ifconfig_eth0=( "dhcp" ) # for ifconfig
#ipaddr_eth0=( "dhcp" ) # for iproute2
# For passing custom options to dhcpcd use something like the following. This
# example reduces the timeout for retrieving an address from 60 seconds (the
# default) to 10 seconds.
#dhcpcd_eth0="-t 10"
# dhclient, udhcpc and pump don't have many runtime options
# You can pass options to them in a similar manner to dhcpcd though
#dhclient_eth0="..."
#udhcpc_eth0="..."
#pump_eth0="..."
# To set options for dhclient, you need to have an /etc/dhclient.conf file
# See the dhclient man page for details
# GENERIC DHCP OPTIONS
# These can be set globally (setting=...) or per interface (setting_eth0=...)
# To stop DHCP from overwritting DNS (/etc/resolv.conf) use the below settings
# peer_dns="no"
# peer_dns_eth0="no"
# To stop DHCP from overwritting NIS (/etc/yp.conf) use the below settings
# peer_nis="no"
# peer_nis_eth0="no"
# To stop DHCP from overwritting NTP /etc/ntp.conf use the below settings
# peer_ntp="no"
# peer_ntp_eth0="no"
#-----------------------------------------------------------------------------
# VLAN (802.1q support)
# For VLAN support, emerge net-misc/vconfig
# Specify the VLAN numbers for the interface like so
# Please ensure your VLAN IDs are NOT zero-padded
#vlans_eth0="1 2"
# Then setup the interface for each VLAN using either iproute2 or ifconfig like
# so
#ifconfig_eth0_1=( "dhcp" )
#ifconfig_eth0_2=( "172.16.2.1 netmask 255.255.254.0" )
# This configures eth0_1 to use DHCP and eth0_2 for a static address
#-----------------------------------------------------------------------------
# Bonding
# For link bonding/trunking emerge net-misc/ifenslave
# If you are using any of the slave interfaces, it is important that you remove
# configurations for them and take them down first!
#slaves_bond0="eth2"
#ipaddr_bond0=( "172.16.2.1/23 brd 172.16.3.255" )
#-----------------------------------------------------------------------------
# ADSL
# For ADSL support, emerge net-dialup/rp-pppoe
# You should make the following settings and also put your
# username/password information in /etc/ppp/pap-secrets
# Configure the interface to use ADSL with one of the following lines,
# depending on whether you're using ifconfig (default) or iproute2.
#ifconfig_eth0=( "adsl" )
#ipaddr_eth0=( "adsl" )
# You probably won't need to edit /etc/ppp/pppoe.conf if you set this
#adsl_user_eth0="my-adsl-username"
#-----------------------------------------------------------------------------
# ISDN
# For ISDN support, emerge net-dialup/isdn4k-utils
# You should make the following settings and also put your
# username/password information in /etc/ppp/pap-secrets
# Configure the interface to use ISDN with one of the following lines,
# depending on whether you're using ifconfig (default) or iproute2.
#ifconfig_ippp0=( "dhcp" )
# It's important to specify dhcp if you need it!
#ipaddr_ippp0=( "192.168.0.1/24" )
# Otherwise, you can use a static IP
# NOTE: The interface name must be either ippp or isdn followed by a number
# You may need this option to set the default route
#ipppd_eth0="defaultroute"
#-----------------------------------------------------------------------------
# MAC changer
# For changing MAC addresses emerge net-analyzer/macchanger
# - to set a specific MAC address
#mac_eth0="00:11:22:33:44:55"
# - to randomize the last 3 bytes only
#mac_eth0="random-ending"
# - to randomize between the same physical type of connection (eg fibre,
# copper, wireless) , all vendors
#mac_eth0="random-samekind"
# - to randomize between any physical type of connection (eg fibre, copper,
# wireless) , all vendors
#mac_eth0="random-anykind"
# - full randomization - WARNING: some MAC addresses generated by this may NOT
# act as expected
#mac_eth0="random-full"
# custom - passes all parameters directly to net-analyzer/macchanger
#mac_eth0="some custom set of parameters"
#-----------------------------------------------------------------------------
# TUN/TAP
# For TUN/TAP support emerge sys-apps/usermode-utilities
#
# The below two examples create an interface called tap0
# ifconfig assigns it's address via dhcp
# iproute2 assigns it's address manually
#ifconfig_tap0=( "dhcp" ) # for ifconfig
#ipaddr_tap0=( "192.168.0.1/24") # for iproute2
# NOTE: The interface name must be either tun or tap followed by a number
# For passing custom options to tunctl use something like the following. This
# example sets the owner to adm
#tunctl_tap0="-u adm"
#-----------------------------------------------------------------------------
# Bridging (802.1d)
# For bridging support emerge net-misc/bridge-utils
# To add ports to bridge br0
#bridge_br0="eth0 eth1"
# You NEED to configure the interface as well
#ifconfig_br0=( "null" ) # This is needed so that dhcp is not started!
#ifconfig_br0=( "dhcp" )
#ifconfig_br0=( "192.168.0.1 netmask 255.255.255.0" )
# NOTE: This creates an interface called br0 - you can give the interface
# any name you like
# Below is an example of configuring the bridge
# Consult "man brctl" for more details
#brctl_br0=( "setfd 0" "sethello 0" "stp off" )
#-----------------------------------------------------------------------------
# Tunnelling
# For GRE tunnels
#iptunnel_vpn0="mode gre remote 207.170.82.1 key 0xffffffff ttl 255"
# For IPIP tunnels
#iptunnel_vpn0="mode ipip remote 207.170.82.2 ttl 255"
# To configure the interface via ifconfig
#ifconfig_vpn0=( "192.168.0.2 pointopoint 192.168.1.2" )
# To configure the interface via iproute2
#ipaddr_vpn0=( "192.168.0.2 peer 192.168.1.1" )
##############################################################################
# ADVANCED CONFIGURATION
#
# Four functions can be defined which will be called surrounding the
# start/stop operations. The functions are called with the interface
# name first so that one function can control multiple adapters.
#
# The return values for the preup and predown functions should be 0
# (success) to indicate that configuration or deconfiguration of the
# interface can continue. If preup returns a non-zero value, then
# interface configuration will be aborted. If predown returns a
# non-zero value, then the interface will not be allowed to continue
# deconfiguration.
#
# The return values for the postup and postdown functions are ignored
# since there's nothing to do if they indicate failure.
#preup() {
# # This function could be used, for example, to configure a
# # wireless interface for Cisco LEAP authentication.
#
# # Test for link on the interface prior to bringing it up. This
# # only works on some network adapters and requires the ethtool
# # package to be installed.
# if ethtool $1 | grep -q 'Link detected: no'; then
# ewarn "No link on $1, aborting configuration"
# return 1
# fi
#
# # Remember to return 0 on success
# return 0
#}
#predown() {
# # The default in the script is to test for NFS root and disallow
# # downing interfaces in that case. Note that if you specify a
# # predown() function you will override that logic. Here it is, in
# # case you still want it...
# if is_net_fs /; then
# eerror "root filesystem is network mounted -- can't stop ${IFACE}"
# return 1
# fi
#
# # Remember to return 0 on success
# return 0
#}
#postup() {
# # This function could be used, for example, to register with a
# # dynamic DNS service. Another possibility would be to
# # send/receive mail once the interface is brought up.
# return 0
#}
#postdown() {
# # This function is mostly here for completeness... I haven't
# # thought of anything nifty to do with it yet ;-)
# # Return 0 always
# return 0
#}
Attachment:
signature.asc
Description: This is a digitally signed message part