bond: check for NULL bond mode value in update_connection()

Don't crash if the bond mode can't be read from sysfs - for example
when the interface disappears. The generated connection will be bogus,
but at that point it doesn't matter because the in-memory connection
will be destroyed.

Fixes: 056a973a4f

https://bugzilla.redhat.com/show_bug.cgi?id=1459580
This commit is contained in:
Beniamino Galvani 2017-06-07 18:51:41 +02:00
parent f07dca941d
commit 5600a27c2a

View file

@ -177,7 +177,7 @@ update_connection (NMDevice *device, NMConnection *connection)
*p = '\0';
}
if (nm_streq (*options, NM_SETTING_BOND_OPTION_MODE))
if (value && nm_streq (*options, NM_SETTING_BOND_OPTION_MODE))
mode = _nm_setting_bond_mode_from_string (value);
if (!_nm_setting_bond_option_supported (*options, mode))