mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-09 23:40:33 +01:00
ifupdown: normalize keys using - or _ (debian #609831)
This commit is contained in:
parent
96044f7d94
commit
f2f406b316
2 changed files with 7 additions and 1 deletions
|
|
@ -51,6 +51,7 @@ void add_block(const char *type, const char* name)
|
|||
void add_data(const char *key,const char *data)
|
||||
{
|
||||
if_data *ret;
|
||||
char *idx;
|
||||
|
||||
// Check if there is a block where we can attach our data
|
||||
if (first == NULL)
|
||||
|
|
@ -58,6 +59,11 @@ void add_data(const char *key,const char *data)
|
|||
|
||||
ret = (if_data*) calloc(1,sizeof(struct _if_data));
|
||||
ret->key = g_strdup(key);
|
||||
// Normalize keys. Convert '_' to '-', as ifupdown accepts both variants.
|
||||
// When querying keys via ifparser_getkey(), use '-'.
|
||||
while ((idx = strrchr(ret->key, '_'))) {
|
||||
*idx = '-';
|
||||
}
|
||||
ret->data = g_strdup(data);
|
||||
|
||||
if (last->info == NULL)
|
||||
|
|
|
|||
|
|
@ -366,7 +366,7 @@ SCPluginIfupdown_init (NMSystemConfigInterface *config)
|
|||
/* Bridge configuration */
|
||||
if(!strncmp ("br", block->name, 2)) {
|
||||
/* Try to find bridge ports */
|
||||
const char *ports = ifparser_getkey (block, "bridge_ports");
|
||||
const char *ports = ifparser_getkey (block, "bridge-ports");
|
||||
if (ports) {
|
||||
int i;
|
||||
int state = 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue