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.
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user