Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
NetworkManager
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
147
Issues
147
List
Boards
Labels
Service Desk
Milestones
Merge Requests
12
Merge Requests
12
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
NetworkManager
NetworkManager
Commits
71e7434d
Commit
71e7434d
authored
Mar 05, 2012
by
Jiří Klimeš
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cli: add 'bond' setting
parent
5cd9b1e2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
2 deletions
+64
-2
cli/src/connections.c
cli/src/connections.c
+12
-1
cli/src/settings.c
cli/src/settings.c
+49
-0
cli/src/settings.h
cli/src/settings.h
+3
-1
No files found.
cli/src/connections.c
View file @
71e7434d
...
...
@@ -88,6 +88,7 @@ static NmcOutputField nmc_fields_settings_names[] = {
SETTING_FIELD
(
NM_SETTING_VPN_SETTING_NAME
,
0
),
/* 14 */
SETTING_FIELD
(
NM_SETTING_WIMAX_SETTING_NAME
,
0
),
/* 15 */
SETTING_FIELD
(
NM_SETTING_INFINIBAND_SETTING_NAME
,
0
),
/* 16 */
SETTING_FIELD
(
NM_SETTING_BOND_SETTING_NAME
,
0
),
/* 17 */
{
NULL
,
NULL
,
0
,
NULL
,
0
}
};
#define NMC_FIELDS_SETTINGS_NAMES_ALL_X NM_SETTING_CONNECTION_SETTING_NAME","\
...
...
@@ -105,7 +106,8 @@ static NmcOutputField nmc_fields_settings_names[] = {
NM_SETTING_BLUETOOTH_SETTING_NAME","\
NM_SETTING_OLPC_MESH_SETTING_NAME","\
NM_SETTING_VPN_SETTING_NAME","\
NM_SETTING_INFINIBAND_SETTING_NAME
NM_SETTING_INFINIBAND_SETTING_NAME","\
NM_SETTING_BOND_SETTING_NAME
#if WITH_WIMAX
#define NMC_FIELDS_SETTINGS_NAMES_ALL NMC_FIELDS_SETTINGS_NAMES_ALL_X","\
NM_SETTING_WIMAX_SETTING_NAME
...
...
@@ -408,6 +410,15 @@ nmc_connection_detail (NMConnection *connection, NmCli *nmc)
continue
;
}
}
if
(
!
strcasecmp
(
nmc_fields_settings_names
[
section_idx
].
name
,
nmc_fields_settings_names
[
17
].
name
))
{
NMSettingBond
*
s_bond
=
nm_connection_get_setting_bond
(
connection
);
if
(
s_bond
)
{
setting_bond_details
(
s_bond
,
nmc
);
was_output
=
TRUE
;
continue
;
}
}
}
if
(
print_settings_array
)
...
...
cli/src/settings.c
View file @
71e7434d
...
...
@@ -456,6 +456,18 @@ static NmcOutputField nmc_fields_setting_infiniband[] = {
NM_SETTING_INFINIBAND_TRANSPORT_MODE
#define NMC_FIELDS_SETTING_INFINIBAND_COMMON NMC_FIELDS_SETTING_INFINIBAND_ALL
/* Available fields for NM_SETTING_BOND_SETTING_NAME */
static
NmcOutputField
nmc_fields_setting_bond
[]
=
{
SETTING_FIELD
(
"name"
,
8
),
/* 0 */
SETTING_FIELD
(
NM_SETTING_BOND_INTERFACE_NAME
,
15
),
/* 1 */
SETTING_FIELD
(
NM_SETTING_BOND_OPTIONS
,
30
),
/* 2 */
{
NULL
,
NULL
,
0
,
NULL
,
0
}
};
#define NMC_FIELDS_SETTING_BOND_ALL "name"","\
NM_SETTING_BOND_INTERFACE_NAME","\
NM_SETTING_BOND_OPTIONS
#define NMC_FIELDS_SETTING_BOND_COMMON NMC_FIELDS_SETTING_BOND_ALL
static
char
*
wep_key_type_to_string
(
NMWepKeyType
type
)
...
...
@@ -1559,3 +1571,40 @@ setting_infiniband_details (NMSettingInfiniband *s_infiniband, NmCli *nmc)
return
TRUE
;
}
gboolean
setting_bond_details
(
NMSettingBond
*
s_bond
,
NmCli
*
nmc
)
{
GString
*
bond_options_s
;
int
i
;
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_BOND
(
s_bond
),
FALSE
);
nmc
->
allowed_fields
=
nmc_fields_setting_bond
;
nmc
->
print_fields
.
indices
=
parse_output_fields
(
NMC_FIELDS_SETTING_BOND_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 */
bond_options_s
=
g_string_new
(
NULL
);
for
(
i
=
0
;
i
<
nm_setting_bond_get_num_options
(
s_bond
);
i
++
)
{
const
char
*
key
,
*
value
;
nm_setting_bond_get_option
(
s_bond
,
i
,
&
key
,
&
value
);
g_string_append_printf
(
bond_options_s
,
"%s=%s,"
,
key
,
value
);
}
g_string_truncate
(
bond_options_s
,
bond_options_s
->
len
-
1
);
/* chop off trailing ',' */
nmc
->
allowed_fields
[
0
].
value
=
NM_SETTING_BOND_SETTING_NAME
;
nmc
->
allowed_fields
[
1
].
value
=
nm_setting_bond_get_interface_name
(
s_bond
);
nmc
->
allowed_fields
[
2
].
value
=
bond_options_s
->
str
;
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_string_free
(
bond_options_s
,
TRUE
);
return
TRUE
;
}
cli/src/settings.h
View file @
71e7434d
...
...
@@ -14,7 +14,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* (C) Copyright 2010 - 201
1
Red Hat, Inc.
* (C) Copyright 2010 - 201
2
Red Hat, Inc.
*/
#ifndef NMC_SETTINGS_H
...
...
@@ -37,6 +37,7 @@
#include <nm-setting-vpn.h>
#include <nm-setting-wimax.h>
#include <nm-setting-infiniband.h>
#include <nm-setting-bond.h>
#include "nmcli.h"
#include "utils.h"
...
...
@@ -59,5 +60,6 @@ gboolean setting_olpc_mesh_details (NMSettingOlpcMesh *s_olpc_mesh, NmCli *nmc);
gboolean
setting_vpn_details
(
NMSettingVPN
*
s_vpn
,
NmCli
*
nmc
);
gboolean
setting_wimax_details
(
NMSettingWimax
*
s_wimax
,
NmCli
*
nmc
);
gboolean
setting_infiniband_details
(
NMSettingInfiniband
*
s_infiniband
,
NmCli
*
nmc
);
gboolean
setting_bond_details
(
NMSettingBond
*
s_bond
,
NmCli
*
nmc
);
#endif
/* NMC_SETTINGS_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment