cleanup: remove obsolete link-related functions
Use nm-platform instead.
This commit is contained in:
@@ -65,9 +65,6 @@ typedef struct {
|
|||||||
|
|
||||||
/* Sync/blocking request/response connection */
|
/* Sync/blocking request/response connection */
|
||||||
struct nl_sock *nlh_sync;
|
struct nl_sock *nlh_sync;
|
||||||
struct nl_cache * link_cache;
|
|
||||||
|
|
||||||
guint request_status_id;
|
|
||||||
|
|
||||||
GHashTable *subscriptions;
|
GHashTable *subscriptions;
|
||||||
} NMNetlinkMonitorPrivate;
|
} NMNetlinkMonitorPrivate;
|
||||||
@@ -147,46 +144,6 @@ log_error_limited (NMNetlinkMonitor *monitor, guint32 code, const char *fmt, ...
|
|||||||
|
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
|
|
||||||
static void
|
|
||||||
link_msg_handler (struct nl_object *obj, void *arg)
|
|
||||||
{
|
|
||||||
NMNetlinkMonitor *self = NM_NETLINK_MONITOR (arg);
|
|
||||||
struct rtnl_link *filter;
|
|
||||||
struct rtnl_link *link_obj;
|
|
||||||
guint flags;
|
|
||||||
guint ifidx;
|
|
||||||
|
|
||||||
filter = rtnl_link_alloc ();
|
|
||||||
if (!filter) {
|
|
||||||
log_error_limited (self, NM_NETLINK_MONITOR_ERROR_BAD_ALLOC,
|
|
||||||
_("error processing netlink message: %s"),
|
|
||||||
nl_geterror (ENOMEM));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Ensure it's a link object */
|
|
||||||
if (nl_object_match_filter (obj, OBJ_CAST (filter)) == 0) {
|
|
||||||
rtnl_link_put (filter);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
link_obj = (struct rtnl_link *) obj;
|
|
||||||
flags = rtnl_link_get_flags (link_obj);
|
|
||||||
ifidx = rtnl_link_get_ifindex (link_obj);
|
|
||||||
|
|
||||||
nm_log_dbg (LOGD_HW, "netlink link message: iface idx %d flags 0x%X", ifidx, flags);
|
|
||||||
|
|
||||||
/* IFF_LOWER_UP is the indicator of carrier status since kernel commit
|
|
||||||
* b00055aacdb172c05067612278ba27265fcd05ce in 2.6.17.
|
|
||||||
*/
|
|
||||||
if (flags & IFF_LOWER_UP)
|
|
||||||
g_signal_emit (self, signals[CARRIER_ON], 0, ifidx);
|
|
||||||
else
|
|
||||||
g_signal_emit (self, signals[CARRIER_OFF], 0, ifidx);
|
|
||||||
|
|
||||||
rtnl_link_put (filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
event_msg_recv (struct nl_msg *msg, void *arg)
|
event_msg_recv (struct nl_msg *msg, void *arg)
|
||||||
{
|
{
|
||||||
@@ -241,9 +198,6 @@ event_msg_ready (struct nl_msg *msg, void *arg)
|
|||||||
/* Let clients handle generic messages */
|
/* Let clients handle generic messages */
|
||||||
g_signal_emit (self, signals[NOTIFICATION], 0, msg);
|
g_signal_emit (self, signals[NOTIFICATION], 0, msg);
|
||||||
|
|
||||||
/* Parse carrier messages */
|
|
||||||
nl_msg_parse (msg, &link_msg_handler, self);
|
|
||||||
|
|
||||||
return NL_OK;
|
return NL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -411,11 +365,6 @@ static gboolean
|
|||||||
sync_connection_setup (NMNetlinkMonitor *self, GError **error)
|
sync_connection_setup (NMNetlinkMonitor *self, GError **error)
|
||||||
{
|
{
|
||||||
NMNetlinkMonitorPrivate *priv = NM_NETLINK_MONITOR_GET_PRIVATE (self);
|
NMNetlinkMonitorPrivate *priv = NM_NETLINK_MONITOR_GET_PRIVATE (self);
|
||||||
#ifdef LIBNL_NEEDS_ADDR_CACHING_WORKAROUND
|
|
||||||
struct nl_cache *addr_cache;
|
|
||||||
#endif
|
|
||||||
int err;
|
|
||||||
|
|
||||||
/* Set up the event listener connection */
|
/* Set up the event listener connection */
|
||||||
priv->nlh_sync = nl_socket_alloc ();
|
priv->nlh_sync = nl_socket_alloc ();
|
||||||
if (!priv->nlh_sync) {
|
if (!priv->nlh_sync) {
|
||||||
@@ -429,37 +378,8 @@ sync_connection_setup (NMNetlinkMonitor *self, GError **error)
|
|||||||
if (!nlh_setup (priv->nlh_sync, NULL, self, error))
|
if (!nlh_setup (priv->nlh_sync, NULL, self, error))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
#ifdef LIBNL_NEEDS_ADDR_CACHING_WORKAROUND
|
|
||||||
/* Work around apparent libnl bug; rtnl_addr requires that all
|
|
||||||
* addresses have the "peer" attribute set in order to be compared
|
|
||||||
* for equality, but this attribute is not normally set. As a
|
|
||||||
* result, most addresses will not compare as equal even to
|
|
||||||
* themselves, busting caching.
|
|
||||||
*/
|
|
||||||
rtnl_addr_alloc_cache (priv->nlh_sync, &addr_cache);
|
|
||||||
g_warn_if_fail (addr_cache != NULL);
|
|
||||||
nl_cache_get_ops (addr_cache)->co_obj_ops->oo_id_attrs &= ~0x80;
|
|
||||||
nl_cache_free (addr_cache);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
err = rtnl_link_alloc_cache (priv->nlh_sync, AF_UNSPEC, &priv->link_cache);
|
|
||||||
if (err < 0) {
|
|
||||||
g_set_error (error, NM_NETLINK_MONITOR_ERROR,
|
|
||||||
NM_NETLINK_MONITOR_ERROR_NETLINK_ALLOC_LINK_CACHE,
|
|
||||||
_("unable to allocate netlink link cache for monitoring link status: %s"),
|
|
||||||
nl_geterror (err));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
nl_cache_mngt_provide (priv->link_cache);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
if (priv->link_cache) {
|
|
||||||
nl_cache_free (priv->link_cache);
|
|
||||||
priv->link_cache = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->nlh_sync) {
|
if (priv->nlh_sync) {
|
||||||
nl_socket_free (priv->nlh_sync);
|
nl_socket_free (priv->nlh_sync);
|
||||||
priv->nlh_sync = NULL;
|
priv->nlh_sync = NULL;
|
||||||
@@ -570,130 +490,6 @@ nm_netlink_monitor_request_ip6_info (NMNetlinkMonitor *self, GError **error)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
deferred_emit_carrier_state (gpointer user_data)
|
|
||||||
{
|
|
||||||
NMNetlinkMonitor *self = NM_NETLINK_MONITOR (user_data);
|
|
||||||
NMNetlinkMonitorPrivate *priv = NM_NETLINK_MONITOR_GET_PRIVATE (self);
|
|
||||||
int err;
|
|
||||||
|
|
||||||
priv->request_status_id = 0;
|
|
||||||
|
|
||||||
/* Update the link cache with latest state, and if there are no errors
|
|
||||||
* emit the link states for all the interfaces in the cache.
|
|
||||||
*/
|
|
||||||
err = nl_cache_refill (priv->nlh_sync, priv->link_cache);
|
|
||||||
if (err < 0)
|
|
||||||
nm_log_err (LOGD_HW, "error updating link cache: %s", nl_geterror (err));
|
|
||||||
else
|
|
||||||
nl_cache_foreach_filter (priv->link_cache, NULL, link_msg_handler, self);
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nm_netlink_monitor_request_status (NMNetlinkMonitor *self)
|
|
||||||
{
|
|
||||||
NMNetlinkMonitorPrivate *priv;
|
|
||||||
|
|
||||||
g_return_if_fail (NM_IS_NETLINK_MONITOR (self));
|
|
||||||
|
|
||||||
priv = NM_NETLINK_MONITOR_GET_PRIVATE (self);
|
|
||||||
|
|
||||||
/* Schedule the carrier state emission */
|
|
||||||
if (!priv->request_status_id)
|
|
||||||
priv->request_status_id = g_idle_add (deferred_emit_carrier_state, self);
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMNetlinkMonitor *self;
|
|
||||||
struct rtnl_link *filter;
|
|
||||||
GError *error;
|
|
||||||
guint32 flags;
|
|
||||||
} GetFlagsInfo;
|
|
||||||
|
|
||||||
static void
|
|
||||||
get_flags_sync_cb (struct nl_object *obj, void *arg)
|
|
||||||
{
|
|
||||||
GetFlagsInfo *info = arg;
|
|
||||||
|
|
||||||
/* Ensure this cache item matches our filter */
|
|
||||||
if (nl_object_match_filter (obj, OBJ_CAST (info->filter)) != 0)
|
|
||||||
info->flags = rtnl_link_get_flags ((struct rtnl_link *) obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
nm_netlink_monitor_get_flags_sync (NMNetlinkMonitor *self,
|
|
||||||
guint32 ifindex,
|
|
||||||
guint32 *ifflags,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
NMNetlinkMonitorPrivate *priv;
|
|
||||||
GetFlagsInfo info;
|
|
||||||
struct rtnl_link *filter;
|
|
||||||
int err;
|
|
||||||
|
|
||||||
g_return_val_if_fail (NM_IS_NETLINK_MONITOR (self), FALSE);
|
|
||||||
g_return_val_if_fail (ifflags != NULL, FALSE);
|
|
||||||
|
|
||||||
priv = NM_NETLINK_MONITOR_GET_PRIVATE (self);
|
|
||||||
|
|
||||||
/* Update the link cache with the latest information */
|
|
||||||
err = nl_cache_refill (priv->nlh_sync, priv->link_cache);
|
|
||||||
if (err < 0) {
|
|
||||||
g_set_error (error,
|
|
||||||
NM_NETLINK_MONITOR_ERROR,
|
|
||||||
NM_NETLINK_MONITOR_ERROR_LINK_CACHE_UPDATE,
|
|
||||||
_("error updating link cache: %s"),
|
|
||||||
nl_geterror (err));
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* HACK: Apparently to get it working we have to refill the cache twice;
|
|
||||||
* otherwise some kernels (or maybe libnl?) only send a few of the
|
|
||||||
* interfaces in the refill request.
|
|
||||||
*/
|
|
||||||
if (nl_cache_refill (priv->nlh_sync, priv->link_cache)) {
|
|
||||||
g_set_error (error,
|
|
||||||
NM_NETLINK_MONITOR_ERROR,
|
|
||||||
NM_NETLINK_MONITOR_ERROR_LINK_CACHE_UPDATE,
|
|
||||||
_("error updating link cache: %s"),
|
|
||||||
nl_geterror (err));
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set up the filter */
|
|
||||||
filter = rtnl_link_alloc ();
|
|
||||||
if (!filter) {
|
|
||||||
g_set_error (error,
|
|
||||||
NM_NETLINK_MONITOR_ERROR,
|
|
||||||
NM_NETLINK_MONITOR_ERROR_BAD_ALLOC,
|
|
||||||
_("error processing netlink message: %s"),
|
|
||||||
nl_geterror (err));
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
rtnl_link_set_ifindex (filter, ifindex);
|
|
||||||
|
|
||||||
memset (&info, 0, sizeof (info));
|
|
||||||
info.self = self;
|
|
||||||
info.filter = filter;
|
|
||||||
info.error = NULL;
|
|
||||||
nl_cache_foreach_filter (priv->link_cache, NULL, get_flags_sync_cb, &info);
|
|
||||||
|
|
||||||
rtnl_link_put (filter);
|
|
||||||
|
|
||||||
if (info.error) {
|
|
||||||
if (error)
|
|
||||||
*error = info.error;
|
|
||||||
else
|
|
||||||
g_error_free (info.error);
|
|
||||||
return FALSE;
|
|
||||||
} else
|
|
||||||
*ifflags = info.flags;
|
|
||||||
|
|
||||||
return TRUE; /* success */
|
|
||||||
}
|
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
struct nl_sock *
|
struct nl_sock *
|
||||||
@@ -708,76 +504,6 @@ nm_netlink_get_default_handle (void)
|
|||||||
return nlh;
|
return nlh;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
nm_netlink_iface_to_index (const char *iface)
|
|
||||||
{
|
|
||||||
NMNetlinkMonitor *self;
|
|
||||||
NMNetlinkMonitorPrivate *priv;
|
|
||||||
int idx;
|
|
||||||
|
|
||||||
g_return_val_if_fail (iface != NULL, -1);
|
|
||||||
|
|
||||||
self = nm_netlink_monitor_get ();
|
|
||||||
priv = NM_NETLINK_MONITOR_GET_PRIVATE (self);
|
|
||||||
|
|
||||||
nl_cache_refill (priv->nlh_sync, priv->link_cache);
|
|
||||||
idx = rtnl_link_name2i (priv->link_cache, iface);
|
|
||||||
|
|
||||||
return idx;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_netlink_index_to_iface:
|
|
||||||
* @idx: kernel interface index
|
|
||||||
*
|
|
||||||
* Returns: the device name corresponding to the kernel interface index; caller
|
|
||||||
* owns returned value and must free it when it is no longer required
|
|
||||||
**/
|
|
||||||
#define MAX_IFACE_LEN 33
|
|
||||||
char *
|
|
||||||
nm_netlink_index_to_iface (int idx)
|
|
||||||
{
|
|
||||||
NMNetlinkMonitor *self;
|
|
||||||
NMNetlinkMonitorPrivate *priv;
|
|
||||||
char *buf = NULL;
|
|
||||||
|
|
||||||
g_return_val_if_fail (idx >= 0, NULL);
|
|
||||||
|
|
||||||
self = nm_netlink_monitor_get ();
|
|
||||||
priv = NM_NETLINK_MONITOR_GET_PRIVATE (self);
|
|
||||||
|
|
||||||
buf = g_malloc0 (MAX_IFACE_LEN);
|
|
||||||
g_assert (buf);
|
|
||||||
|
|
||||||
nl_cache_refill (priv->nlh_sync, priv->link_cache);
|
|
||||||
if (!rtnl_link_i2name (priv->link_cache, idx, buf, MAX_IFACE_LEN - 1)) {
|
|
||||||
nm_log_warn (LOGD_HW, "(%d) failed to find interface name for index", idx);
|
|
||||||
g_free (buf);
|
|
||||||
buf = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct rtnl_link *
|
|
||||||
nm_netlink_index_to_rtnl_link (int idx)
|
|
||||||
{
|
|
||||||
NMNetlinkMonitor *self;
|
|
||||||
NMNetlinkMonitorPrivate *priv;
|
|
||||||
struct rtnl_link *ret = NULL;
|
|
||||||
|
|
||||||
if (idx <= 0)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
self = nm_netlink_monitor_get ();
|
|
||||||
priv = NM_NETLINK_MONITOR_GET_PRIVATE (self);
|
|
||||||
|
|
||||||
nl_cache_refill (priv->nlh_sync, priv->link_cache);
|
|
||||||
ret = rtnl_link_get (priv->link_cache, idx);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
NMNetlinkMonitor *
|
NMNetlinkMonitor *
|
||||||
@@ -792,8 +518,6 @@ nm_netlink_monitor_get (void)
|
|||||||
|
|
||||||
if (open_connection (singleton, &error)) {
|
if (open_connection (singleton, &error)) {
|
||||||
attach (singleton);
|
attach (singleton);
|
||||||
/* Request initial status of cards */
|
|
||||||
nm_netlink_monitor_request_status (singleton);
|
|
||||||
} else {
|
} else {
|
||||||
nm_log_warn (LOGD_HW, "Failed to connect to netlink: (%d) %s",
|
nm_log_warn (LOGD_HW, "Failed to connect to netlink: (%d) %s",
|
||||||
error ? error->code : 0,
|
error ? error->code : 0,
|
||||||
@@ -821,17 +545,9 @@ finalize (GObject *object)
|
|||||||
{
|
{
|
||||||
NMNetlinkMonitorPrivate *priv = NM_NETLINK_MONITOR_GET_PRIVATE (object);
|
NMNetlinkMonitorPrivate *priv = NM_NETLINK_MONITOR_GET_PRIVATE (object);
|
||||||
|
|
||||||
if (priv->request_status_id)
|
|
||||||
g_source_remove (priv->request_status_id);
|
|
||||||
|
|
||||||
if (priv->io_channel)
|
if (priv->io_channel)
|
||||||
close_connection (NM_NETLINK_MONITOR (object));
|
close_connection (NM_NETLINK_MONITOR (object));
|
||||||
|
|
||||||
if (priv->link_cache) {
|
|
||||||
nl_cache_free (priv->link_cache);
|
|
||||||
priv->link_cache = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->nlh_event) {
|
if (priv->nlh_event) {
|
||||||
nl_socket_free (priv->nlh_event);
|
nl_socket_free (priv->nlh_event);
|
||||||
priv->nlh_event = NULL;
|
priv->nlh_event = NULL;
|
||||||
@@ -865,22 +581,6 @@ nm_netlink_monitor_class_init (NMNetlinkMonitorClass *monitor_class)
|
|||||||
G_STRUCT_OFFSET (NMNetlinkMonitorClass, notification),
|
G_STRUCT_OFFSET (NMNetlinkMonitorClass, notification),
|
||||||
NULL, NULL, g_cclosure_marshal_VOID__POINTER,
|
NULL, NULL, g_cclosure_marshal_VOID__POINTER,
|
||||||
G_TYPE_NONE, 1, G_TYPE_POINTER);
|
G_TYPE_NONE, 1, G_TYPE_POINTER);
|
||||||
|
|
||||||
signals[CARRIER_ON] =
|
|
||||||
g_signal_new ("carrier-on",
|
|
||||||
G_OBJECT_CLASS_TYPE (object_class),
|
|
||||||
G_SIGNAL_RUN_LAST,
|
|
||||||
G_STRUCT_OFFSET (NMNetlinkMonitorClass, carrier_on),
|
|
||||||
NULL, NULL, g_cclosure_marshal_VOID__INT,
|
|
||||||
G_TYPE_NONE, 1, G_TYPE_INT);
|
|
||||||
|
|
||||||
signals[CARRIER_OFF] =
|
|
||||||
g_signal_new ("carrier-off",
|
|
||||||
G_OBJECT_CLASS_TYPE (object_class),
|
|
||||||
G_SIGNAL_RUN_LAST,
|
|
||||||
G_STRUCT_OFFSET (NMNetlinkMonitorClass, carrier_off),
|
|
||||||
NULL, NULL, g_cclosure_marshal_VOID__INT,
|
|
||||||
G_TYPE_NONE, 1, G_TYPE_INT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GQuark
|
GQuark
|
||||||
|
@@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
#include <netlink/netlink.h>
|
#include <netlink/netlink.h>
|
||||||
#include <netlink/route/link.h>
|
|
||||||
|
|
||||||
#define NM_TYPE_NETLINK_MONITOR (nm_netlink_monitor_get_type ())
|
#define NM_TYPE_NETLINK_MONITOR (nm_netlink_monitor_get_type ())
|
||||||
#define NM_NETLINK_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_NETLINK_MONITOR, NMNetlinkMonitor))
|
#define NM_NETLINK_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_NETLINK_MONITOR, NMNetlinkMonitor))
|
||||||
@@ -55,8 +54,6 @@ typedef struct {
|
|||||||
|
|
||||||
/* Signals */
|
/* Signals */
|
||||||
void (*notification) (NMNetlinkMonitor *monitor, struct nl_msg *msg);
|
void (*notification) (NMNetlinkMonitor *monitor, struct nl_msg *msg);
|
||||||
void (*carrier_on) (NMNetlinkMonitor *monitor, int index);
|
|
||||||
void (*carrier_off) (NMNetlinkMonitor *monitor, int index);
|
|
||||||
} NMNetlinkMonitorClass;
|
} NMNetlinkMonitorClass;
|
||||||
|
|
||||||
|
|
||||||
@@ -73,17 +70,7 @@ gboolean nm_netlink_monitor_subscribe (NMNetlinkMonitor *monitor
|
|||||||
gboolean nm_netlink_monitor_request_ip6_info (NMNetlinkMonitor *monitor,
|
gboolean nm_netlink_monitor_request_ip6_info (NMNetlinkMonitor *monitor,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
void nm_netlink_monitor_request_status (NMNetlinkMonitor *monitor);
|
|
||||||
|
|
||||||
gboolean nm_netlink_monitor_get_flags_sync (NMNetlinkMonitor *monitor,
|
|
||||||
guint32 ifindex,
|
|
||||||
guint32 *ifflags,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
/* Generic utility functions */
|
/* Generic utility functions */
|
||||||
int nm_netlink_iface_to_index (const char *iface);
|
|
||||||
char * nm_netlink_index_to_iface (int idx);
|
|
||||||
struct rtnl_link *nm_netlink_index_to_rtnl_link (int idx);
|
|
||||||
struct nl_sock * nm_netlink_get_default_handle (void);
|
struct nl_sock * nm_netlink_get_default_handle (void);
|
||||||
|
|
||||||
#endif /* NM_NETLINK_MONITOR_H */
|
#endif /* NM_NETLINK_MONITOR_H */
|
||||||
|
1259
src/nm-system.c
1259
src/nm-system.c
File diff suppressed because it is too large
Load Diff
@@ -22,16 +22,12 @@
|
|||||||
#ifndef NETWORK_MANAGER_SYSTEM_H
|
#ifndef NETWORK_MANAGER_SYSTEM_H
|
||||||
#define NETWORK_MANAGER_SYSTEM_H
|
#define NETWORK_MANAGER_SYSTEM_H
|
||||||
|
|
||||||
#include <netlink/route/rtnl.h>
|
#include <glib.h>
|
||||||
#include <netlink/route/route.h>
|
#include <netlink/route/route.h>
|
||||||
|
|
||||||
#include <net/ethernet.h>
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
#include "nm-device.h"
|
#include "nm-device.h"
|
||||||
#include "nm-ip4-config.h"
|
#include "nm-ip4-config.h"
|
||||||
#include "nm-setting-bond.h"
|
#include "nm-setting-bond.h"
|
||||||
#include "nm-setting-vlan.h"
|
|
||||||
|
|
||||||
gboolean nm_system_iface_flush_routes (int ifindex, int family);
|
gboolean nm_system_iface_flush_routes (int ifindex, int family);
|
||||||
|
|
||||||
@@ -83,61 +79,6 @@ gboolean nm_system_apply_ip6_config (int ifindex,
|
|||||||
int priority,
|
int priority,
|
||||||
NMIP6ConfigCompareFlags flags);
|
NMIP6ConfigCompareFlags flags);
|
||||||
|
|
||||||
gboolean nm_system_iface_set_up (int ifindex,
|
|
||||||
gboolean up,
|
|
||||||
gboolean *no_firmware);
|
|
||||||
|
|
||||||
guint32 nm_system_iface_get_flags (int ifindex);
|
|
||||||
gboolean nm_system_iface_is_up (int ifindex);
|
|
||||||
|
|
||||||
gboolean nm_system_iface_set_mtu (int ifindex, guint32 mtu);
|
|
||||||
|
|
||||||
gboolean nm_system_iface_set_mac (int ifindex, const struct ether_addr *mac);
|
|
||||||
|
|
||||||
gboolean nm_system_iface_set_arp (int ifindex, gboolean arp);
|
|
||||||
|
|
||||||
gboolean nm_system_apply_bonding_config (const char *iface,
|
gboolean nm_system_apply_bonding_config (const char *iface,
|
||||||
NMSettingBond *s_bond);
|
NMSettingBond *s_bond);
|
||||||
gboolean nm_system_add_bonding_master (const char *iface);
|
|
||||||
|
|
||||||
gboolean nm_system_bond_enslave (gint master_ifindex,
|
|
||||||
const char *master_iface,
|
|
||||||
gint slave_ifindex,
|
|
||||||
const char *slave_iface);
|
|
||||||
gboolean nm_system_bond_release (gint master_ifindex,
|
|
||||||
const char *master_iface,
|
|
||||||
gint slave_ifindex,
|
|
||||||
const char *slave_iface);
|
|
||||||
|
|
||||||
enum {
|
|
||||||
NM_IFACE_TYPE_UNSPEC = 0,
|
|
||||||
NM_IFACE_TYPE_BOND,
|
|
||||||
NM_IFACE_TYPE_VLAN,
|
|
||||||
NM_IFACE_TYPE_BRIDGE,
|
|
||||||
NM_IFACE_TYPE_DUMMY
|
|
||||||
};
|
|
||||||
|
|
||||||
int nm_system_get_iface_type (int ifindex, const char *name);
|
|
||||||
|
|
||||||
gboolean nm_system_get_iface_vlan_info (int ifindex,
|
|
||||||
int *out_parent_ifindex,
|
|
||||||
int *out_vlan_id);
|
|
||||||
|
|
||||||
gboolean nm_system_add_vlan_iface (NMConnection *connection,
|
|
||||||
const char *iface,
|
|
||||||
int parent_ifindex);
|
|
||||||
gboolean nm_system_del_vlan_iface (const char *iface);
|
|
||||||
|
|
||||||
gboolean nm_system_create_bridge (const char *iface, gboolean *out_exists);
|
|
||||||
gboolean nm_system_del_bridge (const char *iface);
|
|
||||||
|
|
||||||
gboolean nm_system_bridge_attach (int master_ifindex,
|
|
||||||
const char *master_iface,
|
|
||||||
int slave_ifindex,
|
|
||||||
const char *slave_iface);
|
|
||||||
gboolean nm_system_bridge_detach (int master_ifindex,
|
|
||||||
const char *master_iface,
|
|
||||||
int slave_ifindex,
|
|
||||||
const char *slave_iface);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user