summaryrefslogtreecommitdiffstats
path: root/proto/radv
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2011-11-07 00:31:23 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2011-11-07 00:31:23 +0100
commita7f23f581f5e3efe92ec97dfca7d01c66f31ab04 (patch)
tree3a8f7cffb7abce83b7bce8be87d21be8a2fbff72 /proto/radv
parent74add5df17c386bd109ebea7b1dac04d1651ae51 (diff)
downloadbird-a7f23f581f5e3efe92ec97dfca7d01c66f31ab04.tar
bird-a7f23f581f5e3efe92ec97dfca7d01c66f31ab04.zip
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 'proto/radv')
-rw-r--r--proto/radv/radv.c16
-rw-r--r--proto/radv/radv.h8
2 files changed, 19 insertions, 5 deletions
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
};
diff --git a/proto/radv/radv.h b/proto/radv/radv.h
index fe121f2..12bfe42 100644
--- a/proto/radv/radv.h
+++ b/proto/radv/radv.h
@@ -46,14 +46,14 @@
struct radv_config
{
struct proto_config c;
- list patt_list; /* List of iface configs */
- list pref_list; /* Global list of prefix configs */
+ list patt_list; /* List of iface configs (struct radv_iface_config) */
+ list pref_list; /* Global list of prefix configs (struct radv_prefix_config) */
};
struct radv_iface_config
{
struct iface_patt i;
- list pref_list; /* Local list of prefix configs */
+ list pref_list; /* Local list of prefix configs (struct radv_prefix_config) */
u32 min_ra_int; /* Standard options from RFC 4261 */
u32 max_ra_int;
@@ -64,7 +64,7 @@ struct radv_iface_config
u32 link_mtu;
u32 reachable_time;
u32 retrans_timer;
- u32 current_hop_limit;
+ u32 current_hop_limit;
u32 default_lifetime;
};