[netcf-devel] [PATCH] Use an explicit PREFIX from the initscripts

Laine Stump laine at laine.org
Tue Sep 15 02:44:24 UTC 2009


On 09/14/2009 08:29 PM, David Lutterkort wrote:
> Even though it's not documented, initscripts allows setting the address
> prefix with PREFIX.
>    


Yep, that did the trick. Thanks!

One thing I wonder about - do you think we need to worry about symmetry? 
The file may start out using PREFIX, but we'll always write it as 
NETMASK. Hopefully something like Network Manager will be smart enough 
to recognize NETMASK and do the right thing...

>    * data/xml/initscripts-put.xsl: use explicit PREFIX if it is present,
>      otherwise calculate prefix from NETMASK
> ---
>   data/xml/initscripts-put.xsl |   11 ++++++++---
>   1 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/data/xml/initscripts-put.xsl b/data/xml/initscripts-put.xsl
> index 886a265..0f73f50 100644
> --- a/data/xml/initscripts-put.xsl
> +++ b/data/xml/initscripts-put.xsl
> @@ -171,9 +171,14 @@
>           </xsl:when>
>           <xsl:when test="$uses_static">
>             <ip address="{node[@label = 'IPADDR']/@value}">
> -<xsl:if test="node[@label = 'NETMASK']">
> -<xsl:attribute name="prefix"><xsl:value-of select="ipcalc:prefix(node[@label = 'NETMASK']/@value)"/></xsl:attribute>
> -</xsl:if>
> +<xsl:choose>
> +<xsl:when test="node[@label = 'PREFIX']">
> +<xsl:attribute name="prefix"><xsl:value-of select="node[@label = 'PREFIX']/@value"/></xsl:attribute>
> +</xsl:when>
> +<xsl:when test="node[@label = 'NETMASK']">
> +<xsl:attribute name="prefix"><xsl:value-of select="ipcalc:prefix(node[@label = 'NETMASK']/@value)"/></xsl:attribute>
> +</xsl:when>
> +</xsl:choose>
>             </ip>
>             <xsl:if test="node[@label = 'GATEWAY']">
>               <route gateway="{node[@label = 'GATEWAY']/@value}"/>
>    



More information about the netcf-devel mailing list