NetworkManager r3581 - in trunk: . src
- From: dcbw svn gnome org
- To: svn-commits-list gnome org
- Subject: NetworkManager r3581 - in trunk: . src
- Date: Mon, 21 Apr 2008 21:31:23 +0100 (BST)
Author: dcbw
Date: Mon Apr 21 20:31:23 2008
New Revision: 3581
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3581&view=rev
Log:
2008-04-21 Dan Williams <dcbw redhat com>
* src/nm-ip4-config.c
- (nm_ip4_config_to_rtnl_addr): fill in the broadcast address if it's
not specified (rh #443474)
Modified:
trunk/ChangeLog
trunk/src/nm-ip4-config.c
Modified: trunk/src/nm-ip4-config.c
==============================================================================
--- trunk/src/nm-ip4-config.c (original)
+++ trunk/src/nm-ip4-config.c Mon Apr 21 20:31:23 2008
@@ -460,8 +460,20 @@
if (flags & NM_RTNL_ADDR_NETMASK)
ip4_addr_to_rtnl_prefixlen (priv->ip4_netmask, addr);
- if (flags & NM_RTNL_ADDR_BROADCAST)
- success = (ip4_addr_to_rtnl_broadcast (priv->ip4_broadcast, addr) >= 0);
+ if (flags & NM_RTNL_ADDR_BROADCAST) {
+ guint32 bcast = priv->ip4_broadcast;
+
+ /* Calculate the broadcast address if needed */
+ if (!bcast) {
+ guint32 hostmask, network;
+
+ network = ntohl (priv->ip4_address) & ntohl (priv->ip4_netmask);
+ hostmask = ~ntohl (priv->ip4_netmask);
+ bcast = htonl (network | hostmask);
+ }
+
+ success = (ip4_addr_to_rtnl_broadcast (bcast, addr) >= 0);
+ }
if (!success)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]