Found by Hans de Goede <hdegoede@xxxxxxxxxx>. The netmask to prefix conversion code was not correct. Adapted this patch from a patch Hans made to mkinitrd. --- isys/iface.c | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/isys/iface.c b/isys/iface.c index eb3a20b..2a67817 100644 --- a/isys/iface.c +++ b/isys/iface.c @@ -300,7 +300,8 @@ struct in_addr *iface_prefix2netmask(int prefix) { * Convert an IPv4 netmask to an IPv4 CIDR prefix. Return -1 on failure. */ int iface_netmask2prefix(struct in_addr *netmask) { - int ret = -1; + int prefix = 32; + unsigned int s_addr; struct in_addr mask; if (netmask == NULL) { @@ -308,13 +309,14 @@ int iface_netmask2prefix(struct in_addr *netmask) { } memcpy(&mask, netmask, sizeof(struct in_addr)); + s_addr = ntohl(mask.s_addr); - while (mask.s_addr != 0) { - mask.s_addr = mask.s_addr >> 1; - ret++; + while (!(s_addr & 1)) { + s_addr >>= 1; + prefix--; } - return ret; + return prefix; } /* -- 1.6.1.3 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list