GNOME Bugzilla – Bug 753578
OpenVPN configuration (.ovpn) import ignores route entries
Last modified: 2015-11-27 08:05:01 UTC
OpenVPN configuration files can store routing information with a line like this: route 192.168.88.0 255.255.252 192.168.88.254 This should route traffic to 192.168.88.0/22 through 192.168.88.254. NetworkManager seems to completely ignore these entries though. It is possible to look through the file and type in the route configuration manually.
I meant to write 255.255.252.0 (/22) for the mask.
NetworkManager spawns openvpn with "--route-noexec" and manages routes itself. So routes are not in VPN setting and are not passed to openvpn. However NM should support importing/exporting static routes via the "route" option and place that in IPV4 setting. Implemented in branches: jk/import-route-rh753578-master jk/import-route-rh753578 (There is a difference in handling routes in libnm vs. libnm-util).
jk/import-route-rh753578-master doesn't compile with NM and libnma fresh from master. libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -DNM_OPENVPN_OLD -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32 -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libdrm -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_4 -I../src -DICONDIR=\"/TMP/NM-openvpn/share/pixmaps\" -DUIDIR=\"/TMP/NM-openvpn/share/gnome-vpn-properties/openvpn\" -DLOCALEDIR=\"/TMP/NM-openvpn/share/locale\" -I/opt/test/include/libnm-glib -I/opt/test/include/NetworkManager -I/opt/test/include/libnm-glib -I/opt/test/include/NetworkManager -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -DNM_VERSION_MIN_REQUIRED=NM_VERSION_1_2 -DNM_VERSION_MAX_ALLOWED=NM_VERSION_1_2 -pthread -I/opt/test/include/libnm-gtk -I/opt/test/include/libnm-glib -I/opt/test/include/NetworkManager -I/usr/include/dbus-1.0 -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libdrm -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -Wall -std=gnu89 -g -Og -Wall -Wstrict-overflow -Wshadow -Wmissing-declarations -Wmissing-prototypes -Wdeclaration-after-statement -Wstrict-prototypes -Wfloat-equal -Wno-unused-parameter -Wno-sign-compare -fno-strict-aliasing -Wno-unused-but-set-variable -c import-export.c -fPIC -DPIC -o .libs/libnm_openvpn_properties_la-import-export.o import-export.c: In function ‘do_import’: import-export.c:473:2: error: unknown type name ‘NMSettingIPConfig’ NMSettingIPConfig *s_ip4;
(In reply to Thomas Haller from comment #3) > jk/import-route-rh753578-master doesn't compile with NM and libnma fresh > from master. > > > libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -DNM_OPENVPN_OLD > -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include > -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32 -pthread > -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 > -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 > -I/usr/lib64/dbus-1.0/include -I/usr/include/gtk-3.0 > -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 > -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 > -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 > -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libdrm > -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 > -I/usr/include/libpng16 -I/usr/include/glib-2.0 > -I/usr/lib64/glib-2.0/include -DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_4 > -I../src -DICONDIR=\"/TMP/NM-openvpn/share/pixmaps\" > -DUIDIR=\"/TMP/NM-openvpn/share/gnome-vpn-properties/openvpn\" > -DLOCALEDIR=\"/TMP/NM-openvpn/share/locale\" -I/opt/test/include/libnm-glib > -I/opt/test/include/NetworkManager -I/opt/test/include/libnm-glib > -I/opt/test/include/NetworkManager -I/usr/include/dbus-1.0 > -I/usr/lib64/dbus-1.0/include -I/usr/include/glib-2.0 > -I/usr/lib64/glib-2.0/include -DNM_VERSION_MIN_REQUIRED=NM_VERSION_1_2 > -DNM_VERSION_MAX_ALLOWED=NM_VERSION_1_2 -pthread > -I/opt/test/include/libnm-gtk -I/opt/test/include/libnm-glib > -I/opt/test/include/NetworkManager -I/usr/include/dbus-1.0 > -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 > -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 > -I/usr/lib64/dbus-1.0/include -I/usr/include/gtk-3.0 > -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 > -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 > -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 > -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libdrm > -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 > -I/usr/include/libpng16 -I/usr/include/glib-2.0 > -I/usr/lib64/glib-2.0/include -Wall -std=gnu89 -g -Og -Wall > -Wstrict-overflow -Wshadow -Wmissing-declarations -Wmissing-prototypes > -Wdeclaration-after-statement -Wstrict-prototypes -Wfloat-equal > -Wno-unused-parameter -Wno-sign-compare -fno-strict-aliasing > -Wno-unused-but-set-variable -c import-export.c -fPIC -DPIC -o > .libs/libnm_openvpn_properties_la-import-export.o > import-export.c: In function ‘do_import’: > import-export.c:473:2: error: unknown type name ‘NMSettingIPConfig’ > NMSettingIPConfig *s_ip4; It does compile. It seems you used an old/borked config: -I/opt/test/include/libnm-glib -I/opt/test/include/libnm-gtk ... try to clean and configure with the new paths.
I did not realize that we compile master both with libnm and old libnm-util for comptibility too. I have re-pushed jk/import-route-rh753578-master with dual ifdefed implementation.
LGTM
Committed as master: 4eb5f3a import/export: import and export "route" option (bgo #753578) nm-1-0: 2877624 import/export: import and export "route" option (bgo #753578)