mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-15 20:45:32 +00:00
nmtui: add support for cloned mac in bond interfaces
This is useful because bond gets its mac from first slave and order of slave attachement is not guaranteed. For example if we have bond with wifi and ethernet we want mac from wifi to be use by bond interface because many wifi defices do now allow one to send data with spoofed macs. Signed-off-by: Nikolay Martynov <mar.kolya@gmail.com>
This commit is contained in:
parent
6a4af482f0
commit
fd14aa033e
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include "nmt-page-bond.h"
|
||||
|
||||
#include "nmt-mac-entry.h"
|
||||
#include "nmt-address-list.h"
|
||||
#include "nmt-slave-list.h"
|
||||
|
||||
|
@ -336,6 +337,7 @@ nmt_page_bond_constructed (GObject *object)
|
|||
NmtPageBondPrivate *priv = NMT_PAGE_BOND_GET_PRIVATE (bond);
|
||||
NmtEditorSection *section;
|
||||
NmtEditorGrid *grid;
|
||||
NMSettingWired *s_wired;
|
||||
NMSettingBond *s_bond;
|
||||
NmtNewtWidget *widget, *label;
|
||||
NMConnection *conn;
|
||||
|
@ -348,6 +350,12 @@ nmt_page_bond_constructed (GObject *object)
|
|||
}
|
||||
priv->s_bond = s_bond;
|
||||
|
||||
s_wired = nm_connection_get_setting_wired (conn);
|
||||
if (!s_wired) {
|
||||
nm_connection_add_setting (conn, nm_setting_wired_new ());
|
||||
s_wired = nm_connection_get_setting_wired (conn);
|
||||
}
|
||||
|
||||
section = nmt_editor_section_new (_("BOND"), NULL, TRUE);
|
||||
grid = nmt_editor_section_get_body (section);
|
||||
|
||||
|
@ -413,6 +421,12 @@ nmt_page_bond_constructed (GObject *object)
|
|||
nmt_editor_grid_append (grid, _("ARP targets"), widget, NULL);
|
||||
priv->arp_ip_target = NMT_ADDRESS_LIST (widget);
|
||||
|
||||
widget = nmt_mac_entry_new (40, ETH_ALEN, NMT_MAC_ENTRY_TYPE_CLONED);
|
||||
g_object_bind_property (s_wired, NM_SETTING_WIRED_CLONED_MAC_ADDRESS,
|
||||
widget, "mac-address",
|
||||
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
||||
nmt_editor_grid_append (grid, _("Cloned MAC address"), widget, NULL);
|
||||
|
||||
g_signal_connect (s_bond, "notify::" NM_SETTING_BOND_OPTIONS,
|
||||
G_CALLBACK (bond_options_changed), bond);
|
||||
bond_options_changed (G_OBJECT (s_bond), NULL, bond);
|
||||
|
|
Loading…
Reference in a new issue