CumulusNetworks / ifupdown2

GNU General Public License v2.0
161 stars 75 forks source link

Comma-separated ADDRFAM value breaks resolvconf #288

Open jaqxues opened 10 months ago

jaqxues commented 10 months ago

We have the following configuration:

/etc/network/interfaces ``` # eth0 is slave # eth1 is slave auto bond0 iface bond0 inet manual bond-slaves eth0 eth1 bond-mode 802.3ad bond-xmit-hash-policy layer3+4 bond-miimon 100 bond-lacp-rate 1 bond-min-links 1 post-up echo 1000 > /sys/class/net/${IFACE}/bonding/ad_actor_sys_prio iface bond0 inet6 manual # Explicitly disabling acceptance of RAs can race, disable IPv6 on this interface instead. post-up echo 1 > /proc/sys/net/ipv6/conf/${IFACE}/disable_ipv6 # eth2 is slave # eth3 is slave auto bond1 iface bond1 inet manual bond-slaves eth2 eth3 bond-mode 802.3ad bond-xmit-hash-policy layer3+4 bond-miimon 100 bond-lacp-rate 1 bond-min-links 1 post-up echo 1000 > /sys/class/net/${IFACE}/bonding/ad_actor_sys_prio iface bond1 inet6 manual # Explicitly disabling acceptance of RAs can race, disable IPv6 on this interface instead. post-up echo 1 > /proc/sys/net/ipv6/conf/${IFACE}/disable_ipv6 # The loopback network interface auto lo iface lo inet loopback auto vmbr0 iface vmbr0 inet static bridge-ports bond1 bridge-stp off bridge-fd 0 address 10.233.42.19/24 iface vmbr0 inet6 manual # Explicitly disabling acceptance of RAs can race, disable IPv6 on this interface instead. post-up echo 1 > /proc/sys/net/ipv6/conf/${IFACE}/disable_ipv6 auto vmbr1 iface vmbr1 inet static bridge-ports bond0 bridge-stp off bridge-fd 0 address xxx.xxx.xxx.xxx/26 gateway xxx.xxx.xxx.1 dns-nameservers xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx dns-search vis.ethz.ch iface vmbr1 inet6 static address xxxx:xx:xx:....::119/118 # ifupdown2 enables forwarding automatically on bridges which have an IP assigned. # Set accept_ra to 2 for them being accepted with forwarding enabled. post-up echo 2 > /proc/sys/net/ipv6/conf/${IFACE}/accept_ra ```

For vmbr1, we specify the dns-nameservers etc. We include inet and inet6 configurations. This makes ifupdown2 pass an ADDRFAM value to resolvconf that looks like inet,inet6 which is not supported by the resolvconf hook for ifupdown2.

Is this an issue of ifupdown2 or resolvconf? I would argue that ifupdown2 should follow ifupdown in this case to not break compatibility.

julienfortin commented 10 months ago

@jaqxues what does ifupdown1 do in that case? Maybe you can write your own wrapper around resolvconf to ignore it.

jaqxues commented 10 months ago

I tested what ifupdown1 does with bonds (not bridges, so slightly different network interfaces file). It calls the hook twice, once with ADDRFAM=inet and once for ADDRFAM=inet6.

Currently ifupdown2 seems to even ignore the IF_ADDRESS for inet6 as seen in these configurations...

/etc/network/interfaces.d/bond0 ``` # eth0 is slave # eth1 is slave auto bond0 iface bond0 inet static slaves eth0 eth1 bond_mode 802.3ad bond_xmit_hash_policy layer3+4 bond_miimon 100 bond_lacp-rate 1 echo 1000 > /sys/class/net/bond0/bonding/ad_actor_sys_prio address xxx.xxx.xxx.xxx network xxx.xxx.xxx.xxx netmask xxx.xxx.xxx.x broadcast xxx.xxx.xxx.xxx gateway xxx.xxx.xxx.1 dns-nameservers xxx.xxx.xxx.xx xxx.xxx.xxx.xx dns-search vis.ethz.ch iface bond0 inet6 static address xxxx:xx:xx:xx/118 ```
julienfortin commented 10 months ago

So, if present, we have to run all hook for each address family? It would be better if each hook would handle the comma syntax though. But if this is what ifupdown1 does, then i'm okay with it, feel free to submit a PR.

jaqxues commented 10 months ago

Apparently resolvconf has a fix on debian that can handle comma separated...