Commit 61789872 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Make merge_ifconf use explicit defaults.

parent 20ca275d
...@@ -498,14 +498,17 @@ add_filter(struct filter *filter, struct filter **filters) ...@@ -498,14 +498,17 @@ add_filter(struct filter *filter, struct filter **filters)
} }
static void static void
merge_ifconf(struct interface_conf *dest, struct interface_conf *src) merge_ifconf(struct interface_conf *dest,
const struct interface_conf *src1,
const struct interface_conf *src2)
{ {
assert(strcmp(dest->ifname, src->ifname) == 0);
#define MERGE(field) \ #define MERGE(field) \
do { \ do { \
if(src->field) \ if(src1->field) \
dest->field = src->field; \ dest->field = src1->field; \
else \
dest->field = src2->field; \
} while(0) } while(0)
MERGE(hello_interval); MERGE(hello_interval);
...@@ -531,7 +534,7 @@ add_ifconf(struct interface_conf *if_conf, struct interface_conf **if_confs) ...@@ -531,7 +534,7 @@ add_ifconf(struct interface_conf *if_conf, struct interface_conf **if_confs)
if_c = *if_confs; if_c = *if_confs;
while(if_c->next) { while(if_c->next) {
if(strcmp(if_c->ifname, if_conf->ifname) == 0) { if(strcmp(if_c->ifname, if_conf->ifname) == 0) {
merge_ifconf(if_c, if_conf); merge_ifconf(if_c, if_conf, if_c);
free(if_conf); free(if_conf);
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment