From a7f23f581f5e3efe92ec97dfca7d01c66f31ab04 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Mon, 7 Nov 2011 00:31:23 +0100 Subject: Implements protocol templates. Based on the patch from Alexander V. Chernikov. Extended to support almost all protocols. Uses 'protocol bgp NAME from TEMPLATE { ... }' syntax. --- proto/radv/radv.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'proto/radv/radv.c') diff --git a/proto/radv/radv.c b/proto/radv/radv.c index 01cb689..42d4bff 100644 --- a/proto/radv/radv.c +++ b/proto/radv/radv.c @@ -318,6 +318,19 @@ radv_reconfigure(struct proto *p, struct proto_config *c) return 1; } +static void +radv_copy_config(struct proto_config *dest, struct proto_config *src) +{ + struct radv_config *d = (struct radv_config *) dest; + struct radv_config *s = (struct radv_config *) src; + + /* We clean up patt_list, ifaces are non-sharable */ + init_list(&d->patt_list); + + /* We copy pref_list, shallow copy suffices */ + cfg_copy_list(&d->iface_list, &s->iface_list, sizeof(struct iface_patt)); +} + struct protocol proto_radv = { .name = "RAdv", @@ -325,5 +338,6 @@ struct protocol proto_radv = { .init = radv_init, .start = radv_start, .shutdown = radv_shutdown, - .reconfigure = radv_reconfigure + .reconfigure = radv_reconfigure, + .copy_config = radv_copy_config }; -- cgit v1.2.3