wwan/ofono: handle missing default gateway
Summary
Handle cases when a gateway address is not provided by the mobile operator when using static IP assignment method.
Purpose
Sometimes, an operator does not send a default gateway when the ofono context is brought online. Currently, NetworkManager treats this as a fault and stops processing the connection activation. As can be seen from upstream ofono tests,in this case, the gateway should be set to 0.0.0.0
, so the final configuration looks like:
$ nmcli con show ESM
GENERAL.NAME: ESM
GENERAL.UUID: 07d8dd55-537f-596d-a095-35c747b7c570
GENERAL.DEVICES: n900_2
GENERAL.IP-IFACE: gprs0
GENERAL.STATE: activated
GENERAL.DEFAULT: no
GENERAL.DEFAULT6: no
GENERAL.SPEC-OBJECT: --
GENERAL.VPN: no
GENERAL.DBUS-PATH: /org/freedesktop/NetworkManager/ActiveConnection/47
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/Settings/8
GENERAL.ZONE: --
GENERAL.MASTER-PATH: --
IP4.ADDRESS[1]: 10.4.143.166/32
IP4.GATEWAY: 0.0.0.0
IP4.ROUTE[1]: dst = 0.0.0.0/0, nh = 0.0.0.0, mt = 700
IP4.DNS[1]: 8.8.8.8
IP4.DNS[2]: 69.63.64.12
IP6.GATEWAY: --
$ ip route show
default dev gprs0 scope link metric 700
Checklist
Please read https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/main/CONTRIBUTING.md before opening the merge request. In particular, check that:
-
the subject for all commits is concise and explicative -
the message for all commits explains the reason for the change -
the source is properly formatted -
any relevant documentation is up to date -
you have added unit tests if applicable