Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gateway should be per-interface, ideally generalized to routes #26

Closed
wak-google opened this issue Apr 26, 2019 · 3 comments
Closed

Gateway should be per-interface, ideally generalized to routes #26

wak-google opened this issue Apr 26, 2019 · 3 comments

Comments

@wak-google
Copy link
Contributor

Currently, the daemon writes the gateway route out to all of the interface files. This causes systemd-networkd to load that route for each interface into the kernel, and allows the kernel to decide which route to keep. Thankfully, this works for IPv4 because the kernel able to filter out the requests which don't have addresses matching a network configured for an interface. Unfortunately, for IPv6 it is common to have routers in the local subnet, which all interfaces share. So the kernel tries to instantiate the gateway on all interfaces and ends up doing something weird. Simply by manually editing the configurations and using only a single gateway entry, we can get the system out of the broken state.

Ideally we would just generalize the whole thing to a routes interface and allow clients to specify arbitrary routes that map more closely to systemd-networkd / linux primitives.

00-bmc-eth0.network

[Match]
Name=eth0
[Link]
MACAddress=f4:f5:e8:7:94:10
[Network]
LinkLocalAddressing=yes
IPv6AcceptRA=false
DHCP=false
Address=10.244.20.103/26
Address=2002:af4:7480:1467::/128
Gateway=10.244.20.126
Gateway=fe80::1
[Neighbor]
Address=10.244.20.126
MACAddress=2:32:a:f4:14:7e
[Neighbor]
Address=fe80::1
MACAddress=2:32:0:0:0:0
[DHCP]
ClientIdentifier=mac
UseDNS=true
UseNTP=true
UseHostname=true
SendHostname=true

00-bmc-eth1.network

[Match]
Name=eth1
[Link]
MACAddress=52:55:c9:c4:dd:85
[Network]
LinkLocalAddressing=yes
IPv6AcceptRA=false
DHCP=false
Gateway=10.244.20.126
Gateway=fe80::1
[DHCP]
ClientIdentifier=mac
UseDNS=true
UseNTP=true
UseHostname=true
SendHostname=true

ip -6 route

2002:af4:7480:1467:: dev eth0  metric 256
fe80::/64 dev eth1  metric 256
fe80::/64 dev eth0  metric 256
default  metric 1024
ff00::/8 dev eth1  metric 256
ff00::/8 dev eth0  metric 256

Expected routes

2002:af4:7480:1467:: dev eth0  metric 256
fe80::/64 dev eth1  metric 256
fe80::/64 dev eth0  metric 256
default via fe80::1 dev eth0  metric 1024
ff00::/8 dev eth1  metric 256
ff00::/8 dev eth0  metric 256
@ratagupt
Copy link
Contributor

Seems it is same as openbmc/openbmc#2671

@ratagupt
Copy link
Contributor

ratagupt commented Apr 27, 2019

In that case this is a bug in the systemd-networkd, where if you have the gateway(Gateway=fe80::1) in eth0.network as well as eth1.network then we should have the following routes in the routing table.

2002:af4:7480:1467:: dev eth0 metric 256
fe80::/64 dev eth1 metric 256
fe80::/64 dev eth0 metric 256
default via fe80::1 dev eth0 metric 1024
default via fe80::1 dev eth1 metric 1024
ff00::/8 dev eth1 metric 256
ff00::/8 dev eth0 metric 256

@ratagupt
Copy link
Contributor

@wak-google : Can we close this one as we have already implemented the interface specific gateway.

anoo1 pushed a commit to anoo1/phosphor-networkd that referenced this issue Apr 27, 2022
Whenever vmi sends down the dhcp ip to the biostable, all the
properties (ip address, gateway, prefix length) will be updated
whenever one of them changes in the biostable.
The flow will be like:
    * Dbus signal for method change from static to DHCP or vice versa
    * Dbus signal for IP address change on biostable -
           fetch from biostable and update all 3 props on dbus
    * Dbus signal for prefix length change -
           fetch from biostable update all 3 props on dbus
    * Dbus signal for gateway change -
           from biostable update all 3 props on dbus

Since the above 4 events happens asynchronously, there were places when
the actual value of a biostable attribute is missed (i.e, attribute value fetched
even before getting updated) and hypervisor app dbus gets updated with
a wrong value.

To avoid this issue, when a propertiesChanged signal is caught by the
hypervisor app, then that particular attribute value of the biostable
is fetched and updated onto the dbus, instead of updating all dbus properties
at once.

Tested By:

* set dhcp to true

* set method to static using patch on Bios endpoint:
  PATCH -d '{"Attributes": {"vmi_if1_ipv4_method": "IPv4Static"}}' \
  https://$bmc/redfish/v1/Systems/system/Bios/Settings

* configure static ip via patch on Bios endpoint:
  PATCH -d '{"Attributes": {"vmi_if1_ipv4_ipaddr": "10.5.20.28", \
  "vmi_if1_ipv4_gateway": "10.5.20.1", "vmi_if1_ipv4_prefix_length": 22}}' \
  https://$bmc/redfish/v1/Systems/system/Bios/Settings

* check if the dbus contains the same values as the biostable

Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants