cli: add 'infiniband' setting support
This commit is contained in:
@@ -102,6 +102,7 @@ static NmcOutputField nmc_fields_settings_names[] = {
|
|||||||
SETTING_FIELD (NM_SETTING_OLPC_MESH_SETTING_NAME, 0), /* 13 */
|
SETTING_FIELD (NM_SETTING_OLPC_MESH_SETTING_NAME, 0), /* 13 */
|
||||||
SETTING_FIELD (NM_SETTING_VPN_SETTING_NAME, 0), /* 14 */
|
SETTING_FIELD (NM_SETTING_VPN_SETTING_NAME, 0), /* 14 */
|
||||||
SETTING_FIELD (NM_SETTING_WIMAX_SETTING_NAME, 0), /* 15 */
|
SETTING_FIELD (NM_SETTING_WIMAX_SETTING_NAME, 0), /* 15 */
|
||||||
|
SETTING_FIELD (NM_SETTING_INFINIBAND_SETTING_NAME, 0), /* 16 */
|
||||||
{NULL, NULL, 0, NULL, 0}
|
{NULL, NULL, 0, NULL, 0}
|
||||||
};
|
};
|
||||||
#define NMC_FIELDS_SETTINGS_NAMES_ALL_X NM_SETTING_CONNECTION_SETTING_NAME","\
|
#define NMC_FIELDS_SETTINGS_NAMES_ALL_X NM_SETTING_CONNECTION_SETTING_NAME","\
|
||||||
@@ -118,7 +119,8 @@ static NmcOutputField nmc_fields_settings_names[] = {
|
|||||||
NM_SETTING_CDMA_SETTING_NAME","\
|
NM_SETTING_CDMA_SETTING_NAME","\
|
||||||
NM_SETTING_BLUETOOTH_SETTING_NAME","\
|
NM_SETTING_BLUETOOTH_SETTING_NAME","\
|
||||||
NM_SETTING_OLPC_MESH_SETTING_NAME","\
|
NM_SETTING_OLPC_MESH_SETTING_NAME","\
|
||||||
NM_SETTING_VPN_SETTING_NAME
|
NM_SETTING_VPN_SETTING_NAME","\
|
||||||
|
NM_SETTING_INFINIBAND_SETTING_NAME
|
||||||
#if WITH_WIMAX
|
#if WITH_WIMAX
|
||||||
#define NMC_FIELDS_SETTINGS_NAMES_ALL NMC_FIELDS_SETTINGS_NAMES_ALL_X","\
|
#define NMC_FIELDS_SETTINGS_NAMES_ALL NMC_FIELDS_SETTINGS_NAMES_ALL_X","\
|
||||||
NM_SETTING_WIMAX_SETTING_NAME
|
NM_SETTING_WIMAX_SETTING_NAME
|
||||||
@@ -364,6 +366,15 @@ nmc_connection_detail (NMConnection *connection, NmCli *nmc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (!strcasecmp (nmc_fields_settings_names[section_idx].name, nmc_fields_settings_names[16].name)) {
|
||||||
|
NMSettingInfiniband *s_infiniband = nm_connection_get_setting_infiniband (connection);
|
||||||
|
if (s_infiniband) {
|
||||||
|
setting_infiniband_details (s_infiniband, nmc);
|
||||||
|
was_output = TRUE;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (print_settings_array)
|
if (print_settings_array)
|
||||||
|
@@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "net/if_arp.h"
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
#include <libnm-util/nm-utils.h>
|
#include <libnm-util/nm-utils.h>
|
||||||
@@ -438,6 +440,18 @@ static NmcOutputField nmc_fields_setting_wimax[] = {
|
|||||||
NM_SETTING_WIMAX_NETWORK_NAME
|
NM_SETTING_WIMAX_NETWORK_NAME
|
||||||
#define NMC_FIELDS_SETTING_WIMAX_COMMON NMC_FIELDS_SETTING_WIMAX_ALL
|
#define NMC_FIELDS_SETTING_WIMAX_COMMON NMC_FIELDS_SETTING_WIMAX_ALL
|
||||||
|
|
||||||
|
/* Available fields for NM_SETTING_INFINIBAND_SETTING_NAME */
|
||||||
|
static NmcOutputField nmc_fields_setting_infiniband[] = {
|
||||||
|
SETTING_FIELD ("name", 12), /* 0 */
|
||||||
|
SETTING_FIELD (NM_SETTING_INFINIBAND_MAC_ADDRESS, 61), /* 1 */
|
||||||
|
SETTING_FIELD (NM_SETTING_INFINIBAND_MTU, 6), /* 2 */
|
||||||
|
{NULL, NULL, 0, NULL, 0}
|
||||||
|
};
|
||||||
|
#define NMC_FIELDS_SETTING_INFINIBAND_ALL "name"","\
|
||||||
|
NM_SETTING_INFINIBAND_MAC_ADDRESS","\
|
||||||
|
NM_SETTING_INFINIBAND_MTU
|
||||||
|
#define NMC_FIELDS_SETTING_INFINIBAND_COMMON NMC_FIELDS_SETTING_INFINIBAND_ALL
|
||||||
|
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
wep_key_type_to_string (NMWepKeyType type)
|
wep_key_type_to_string (NMWepKeyType type)
|
||||||
@@ -1505,3 +1519,37 @@ setting_wimax_details (NMSettingWimax *s_wimax, NmCli *nmc)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
setting_infiniband_details (NMSettingInfiniband *s_infiniband, NmCli *nmc)
|
||||||
|
{
|
||||||
|
const GByteArray *mac;
|
||||||
|
char *mtu_str, *mac_str = NULL;
|
||||||
|
guint32 mode_flag = (nmc->print_output == NMC_PRINT_PRETTY) ? NMC_PF_FLAG_PRETTY : (nmc->print_output == NMC_PRINT_TERSE) ? NMC_PF_FLAG_TERSE : 0;
|
||||||
|
guint32 multiline_flag = nmc->multiline_output ? NMC_PF_FLAG_MULTILINE : 0;
|
||||||
|
guint32 escape_flag = nmc->escape_values ? NMC_PF_FLAG_ESCAPE : 0;
|
||||||
|
|
||||||
|
g_return_val_if_fail (NM_IS_SETTING_INFINIBAND (s_infiniband), FALSE);
|
||||||
|
|
||||||
|
nmc->allowed_fields = nmc_fields_setting_infiniband;
|
||||||
|
nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_INFINIBAND_ALL, nmc->allowed_fields, NULL);
|
||||||
|
nmc->print_fields.flags = multiline_flag | mode_flag | escape_flag | NMC_PF_FLAG_FIELD_NAMES;
|
||||||
|
print_fields (nmc->print_fields, nmc->allowed_fields); /* Print field names */
|
||||||
|
|
||||||
|
mac = nm_setting_infiniband_get_mac_address (s_infiniband);
|
||||||
|
if (mac)
|
||||||
|
mac_str = nm_utils_hwaddr_ntoa (mac->data, ARPHRD_INFINIBAND);
|
||||||
|
mtu_str = g_strdup_printf ("%d", nm_setting_infiniband_get_mtu (s_infiniband));
|
||||||
|
|
||||||
|
nmc->allowed_fields[0].value = NM_SETTING_INFINIBAND_SETTING_NAME;
|
||||||
|
nmc->allowed_fields[1].value = mac_str;
|
||||||
|
nmc->allowed_fields[2].value = strcmp (mtu_str, "0") ? mtu_str : _("auto");
|
||||||
|
|
||||||
|
nmc->print_fields.flags = multiline_flag | mode_flag | escape_flag | NMC_PF_FLAG_SECTION_PREFIX;
|
||||||
|
print_fields (nmc->print_fields, nmc->allowed_fields); /* Print values */
|
||||||
|
|
||||||
|
g_free (mac_str);
|
||||||
|
g_free (mtu_str);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -36,6 +36,7 @@
|
|||||||
#include <nm-setting-olpc-mesh.h>
|
#include <nm-setting-olpc-mesh.h>
|
||||||
#include <nm-setting-vpn.h>
|
#include <nm-setting-vpn.h>
|
||||||
#include <nm-setting-wimax.h>
|
#include <nm-setting-wimax.h>
|
||||||
|
#include <nm-setting-infiniband.h>
|
||||||
|
|
||||||
#include "nmcli.h"
|
#include "nmcli.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
@@ -57,5 +58,6 @@ gboolean setting_bluetooth_details (NMSettingBluetooth *s_bluetooth, NmCli *nmc)
|
|||||||
gboolean setting_olpc_mesh_details (NMSettingOlpcMesh *s_olpc_mesh, NmCli *nmc);
|
gboolean setting_olpc_mesh_details (NMSettingOlpcMesh *s_olpc_mesh, NmCli *nmc);
|
||||||
gboolean setting_vpn_details (NMSettingVPN *s_vpn, NmCli *nmc);
|
gboolean setting_vpn_details (NMSettingVPN *s_vpn, NmCli *nmc);
|
||||||
gboolean setting_wimax_details (NMSettingWimax *s_wimax, NmCli *nmc);
|
gboolean setting_wimax_details (NMSettingWimax *s_wimax, NmCli *nmc);
|
||||||
|
gboolean setting_infiniband_details (NMSettingInfiniband *s_infiniband, NmCli *nmc);
|
||||||
|
|
||||||
#endif /* NMC_SETTINGS_H */
|
#endif /* NMC_SETTINGS_H */
|
||||||
|
Reference in New Issue
Block a user