summaryrefslogtreecommitdiff
path: root/src/platform/nm-linux-platform.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-04-05 17:33:21 +0200
committerThomas Haller <thaller@redhat.com>2018-04-09 20:16:30 +0200
commit28b5118ad2f35c984ea53e3df817b6cd0a090ab9 (patch)
tree44827df1f7ee0e4c9d8ab49a00efd20ca0d3feda /src/platform/nm-linux-platform.c
parent01ad4f33ed489d2ffa4ab55ec72a17609694a0cf (diff)
platform: assert in nm_platform_link_tun_add() for unsupported options
It doesn't make sense that NetworkManager adds non-persist tun devices, likewise, only the type IFF_TUN or IFF_TAP is supported. Assert that the values are as expected.
Diffstat (limited to 'src/platform/nm-linux-platform.c')
-rw-r--r--src/platform/nm-linux-platform.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index b8d252070..495d765b1 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -5597,8 +5597,9 @@ link_tun_add (NMPlatform *platform,
struct ifreq ifr = { };
nm_auto_close int fd = -1;
- if (!NM_IN_SET (props->type, IFF_TAP, IFF_TUN))
- return FALSE;
+ if ( !NM_IN_SET (props->type, IFF_TAP, IFF_TUN)
+ || !props->persist)
+ g_return_val_if_reached (FALSE);
fd = open ("/dev/net/tun", O_RDWR | O_CLOEXEC);
if (fd < 0)