Sometimes, the peer doesn't supply any address. The noremoteip option to pppd option can be used to simply accept this instead of complaining and using a dummy IP address. However, an OpenWRT patch to pppd then breaks the default route by trying to set 0.0.0.0 as the gateway.
This commit changes the patch to only set a patch when a gateway address is actually available. Signed-off-by: Matthijs Kooijman <matth...@stdin.nl> --- .../ppp/patches/340-populate_default_gateway.patch | 27 ++++++++++------------ 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/package/network/services/ppp/patches/340-populate_default_gateway.patch b/package/network/services/ppp/patches/340-populate_default_gateway.patch index 1c6d9ac..b81f1d6 100644 --- a/package/network/services/ppp/patches/340-populate_default_gateway.patch +++ b/package/network/services/ppp/patches/340-populate_default_gateway.patch @@ -7,28 +7,25 @@ This behaviour breaks various downstream programs which attempt to infer the default gateway IP address from the system default route entry. This patch addresses the issue by filling in the peer address as gateway -when generating the default route entry. +when generating the default route entry, but only when an address is +available. Signed-off-by: Jo-Philipp Wich <j...@openwrt.org> +Signed-off-by: Matthijs Kooijman <matth...@stdin.nl> --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c -@@ -1709,6 +1709,9 @@ int sifdefaultroute (int unit, u_int32_t - memset (&rt, 0, sizeof (rt)); - SET_SA_FAMILY (rt.rt_dst, AF_INET); - -+ SET_SA_FAMILY(rt.rt_gateway, AF_INET); -+ SIN_ADDR(rt.rt_gateway) = gateway; -+ - rt.rt_dev = ifname; - - if (kernel_version > KVERSION(2,1,0)) { -@@ -1716,7 +1719,7 @@ int sifdefaultroute (int unit, u_int32_t - SIN_ADDR(rt.rt_genmask) = 0L; +@@ -1717,6 +1717,13 @@ } -- rt.rt_flags = RTF_UP; -+ rt.rt_flags = RTF_UP | RTF_GATEWAY; + rt.rt_flags = RTF_UP; ++ ++ if (gateway) { ++ rt.rt_flags |= RTF_GATEWAY; ++ SET_SA_FAMILY(rt.rt_gateway, AF_INET); ++ SIN_ADDR(rt.rt_gateway) = gateway; ++ } ++ if (ioctl(sock_fd, SIOCADDRT, &rt) < 0) { if (!ok_error(errno)) error("default route ioctl(SIOCADDRT): %m"); -- 1.8.0 _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel