Re: Using XML to handle all configuration files
>>>>> "Nicolás" == Nicolás Lichtmaier <nick@debian.org> writes:
>> For that matter, compare it with the original style
>>
>> interfaces # This is a comment auto lo auto inet auto loopback
>> iface lo inet loopback iface eth0 inet static address 10.1.2.2
>> network 10.1.0.0 netmask 255.255.0.0 broadcast 10.1.255.255
>> gateway 10.1.2.254
>>
>> And consider that you dont have to do stupid things like match
>> ((()))))) and you can simply use # as God intended. I prefer
>> the current style to either of the two proposed alternatives.
Nicolás> Are the multiple "stanzas" separated with whitespace?
Nicolás> With the words iface| auto... how do I merge lines? could
Nicolás> I put address and netork in the same line? Now we want to
Nicolás> handle aliases... we need to code a way to handle aliases
Nicolás> lists (and invent a syntaxis). How do I safely
Nicolás> modify/check this file with a script?
Perhaps that is a bad example because aliases are handled as separate
interfaces (you could of course argue that this isn't a good
approach...).
Perhaps this might be a better example:
# iface eth0 inet static
# address 192.168.1.42
# network 192.168.1.0
# netmask 255.255.255.128
# broadcast 192.168.1.0
# up route add -net 192.168.1.128 netmask 255.255.255.128 gw 192.168.1.2
# up route add default gw 192.168.1.200
# down route del default gw 192.168.1.200
# down route del -net 192.168.1.128 netmask 255.255.255.128 gw 192.168.1.2
Wouldn't this be better?
<iface name="eth0" family="inet" method="static">
<address>192.168.1.42</address>
<network>192.168.1.0</network>
<netmask>255.255.255.128</netmask>
<broadcast>192.168.1.0</broadcast>
<route>
<network>192.168.1.128</network>
<netmask>255.255.255.128</netmask>
<gateway>192.168.1.2</gateway>
</route>
<route>
<default/>
<gateway> 192.168.1.200</gateway>
</route>
</iface>
That way, any program that looks at this file can understand
the routes, and not have to parse the command line for route.
Something else you could look at along these lines: firewall rules
associated with a particular interface. This requires solving a number
of issues though, so I won't attempt it here.
--
Brian May <bam@debian.org>
Reply to: