diff --git a/ChangeLog b/ChangeLog index 0fe522673..118d05231 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-04-21 Dan Williams + + * src/nm-ip4-config.c + - (nm_ip4_config_to_rtnl_addr): fill in the broadcast address if it's + not specified (rh #443474) + 2008-04-20 Dan Williams * src/NetworkManagerUtils.c diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c index 46fe62dc7..4e849a22b 100644 --- a/src/nm-ip4-config.c +++ b/src/nm-ip4-config.c @@ -460,8 +460,20 @@ struct rtnl_addr * nm_ip4_config_to_rtnl_addr (NMIP4Config *config, guint32 flag 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) {