state: add interface alias support
This commit is contained in:
parent
d4e1997486
commit
6fe4630f52
2 changed files with 17 additions and 0 deletions
|
@ -46,3 +46,19 @@ lif_state_write(const struct lif_dict *state, FILE *f)
|
||||||
fprintf(f, "%s=%s\n", entry->key, (const char *) entry->data);
|
fprintf(f, "%s=%s\n", entry->key, (const char *) entry->data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct lif_interface *
|
||||||
|
lif_state_lookup(struct lif_dict *state, struct lif_dict *if_collection, const char *ifname)
|
||||||
|
{
|
||||||
|
struct lif_dict_entry *entry = lif_dict_find(state, ifname);
|
||||||
|
|
||||||
|
if (entry == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
struct lif_dict_entry *if_entry = lif_dict_find(if_collection, (const char *) entry->data);
|
||||||
|
|
||||||
|
if (if_entry == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return if_entry->data;
|
||||||
|
}
|
||||||
|
|
|
@ -22,5 +22,6 @@
|
||||||
extern void lif_state_upsert(struct lif_dict *state, const char *ifname, struct lif_interface *iface);
|
extern void lif_state_upsert(struct lif_dict *state, const char *ifname, struct lif_interface *iface);
|
||||||
extern void lif_state_delete(struct lif_dict *state, const char *ifname);
|
extern void lif_state_delete(struct lif_dict *state, const char *ifname);
|
||||||
extern void lif_state_write(const struct lif_dict *state, FILE *f);
|
extern void lif_state_write(const struct lif_dict *state, FILE *f);
|
||||||
|
extern struct lif_interface *lif_state_lookup(struct lif_dict *state, struct lif_dict *if_collection, const char *ifname);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue