[netcf-devel] [PATCH] Fix bug that eats config parameters which have identical names.

Hendrik Schwartke hendrik at os-t.de
Thu Sep 6 09:02:23 UTC 2012


Here is a interface definition to test this behavior:
<interface type='bridge' name='test'>
<start mode='onboot'/>
<protocol family='ipv4'>
<ip address='192.168.160.10' prefix='24'/>
</protocol>
<protocol family='ipv6'>
<ip address='fe80::f400:4eff:fe18:5fe6' prefix='64'/>
</protocol>
<bridge>
<interface type='vlan' name='eth0.202'>
<vlan tag='202'>
<interface name='eth0'/>
</vlan>
</interface>
<interface type='vlan' name='eth0.212'>
<vlan tag='212'>
<interface name='eth0'/>
</vlan>
</interface>
</bridge>
</interface>


On 05.09.2012 16:24, Hendrik Schwartke wrote:
> Two (or more) nodes with identical names that are in the same
> element are passed to libaugeas in such a way that only the last
> node is actually written to the config file.
> If e.g. there are two pre-up commands for a bridge on debian only
> one is written to /etc/network/interfaces.
> This fix changes this behaviour so that all of them are written.
> ---
>   src/drv_debian.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/drv_debian.c b/src/drv_debian.c
> index 04953e3..1bf7558 100644
> --- a/src/drv_debian.c
> +++ b/src/drv_debian.c
> @@ -679,7 +679,7 @@ static int aug_put_xml(struct netcf *ncf, xmlDocPtr xml) {
>                       label = xml_prop(node, "label");
>                       value = xml_prop(node, "value");
>
> -                    r = aug_fmt_set(ncf, value, "%s/%s[%d]/%s",
> +                    r = aug_fmt_set(ncf, value, "%s/%s[%d]/%s[last()+1]",
>                                       network_interfaces_path,
>                                       arraylabel, n, label ? label : "1");
>                       ERR_COND_BAIL(r<  0, ncf, EOTHER);



More information about the netcf-devel mailing list