diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2011-11-07 00:31:23 +0100 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2011-11-07 00:31:23 +0100 |
commit | a7f23f581f5e3efe92ec97dfca7d01c66f31ab04 (patch) | |
tree | 3a8f7cffb7abce83b7bce8be87d21be8a2fbff72 /nest/rt-dev.c | |
parent | 74add5df17c386bd109ebea7b1dac04d1651ae51 (diff) |
Implements protocol templates.
Based on the patch from Alexander V. Chernikov.
Extended to support almost all protocols.
Uses 'protocol bgp NAME from TEMPLATE { ... }' syntax.
Diffstat (limited to 'nest/rt-dev.c')
-rw-r--r-- | nest/rt-dev.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/nest/rt-dev.c b/nest/rt-dev.c index 239bd268..497ee808 100644 --- a/nest/rt-dev.c +++ b/nest/rt-dev.c @@ -92,9 +92,24 @@ dev_reconfigure(struct proto *p, struct proto_config *new) return iface_patts_equal(&o->iface_list, &n->iface_list, NULL); } +static void +dev_copy_config(struct proto_config *dest, struct proto_config *src) +{ + struct rt_dev_config *d = (struct rt_dev_config *) dest; + struct rt_dev_config *s = (struct rt_dev_config *) src; + + /* + * We copy iface_list as ifaces can be shared by more direct protocols. + * Copy suffices to be is shallow, because new nodes can be added, but + * old nodes cannot be modified (although they contain internal lists). + */ + cfg_copy_list(&d->iface_list, &s->iface_list, sizeof(struct iface_patt)); +} + struct protocol proto_device = { name: "Direct", template: "direct%d", init: dev_init, - reconfigure: dev_reconfigure + reconfigure: dev_reconfigure, + copy_config: dev_copy_config }; |