diff options
Diffstat (limited to 'sysdep/unix')
-rw-r--r-- | sysdep/unix/krt-iface.h | 3 | ||||
-rw-r--r-- | sysdep/unix/krt-set.h | 1 | ||||
-rw-r--r-- | sysdep/unix/krt.Y | 4 | ||||
-rw-r--r-- | sysdep/unix/krt.c | 32 | ||||
-rw-r--r-- | sysdep/unix/krt.h | 2 |
5 files changed, 38 insertions, 4 deletions
diff --git a/sysdep/unix/krt-iface.h b/sysdep/unix/krt-iface.h index 48075d6b..9e12bcc3 100644 --- a/sysdep/unix/krt-iface.h +++ b/sysdep/unix/krt-iface.h @@ -17,6 +17,7 @@ struct krt_if_status { extern int if_scan_sock; -static inline int kif_params_same(struct krt_if_params *old, struct krt_if_params *new) { return 1; } +static inline int kif_params_same(struct krt_if_params *old UNUSED, struct krt_if_params *new UNUSED) { return 1; } +static inline void kif_copy_params(struct krt_if_params *dest UNUSED, struct krt_if_params *src UNUSED) { } #endif diff --git a/sysdep/unix/krt-set.h b/sysdep/unix/krt-set.h index 5d0b2134..87cffcfc 100644 --- a/sysdep/unix/krt-set.h +++ b/sysdep/unix/krt-set.h @@ -16,5 +16,6 @@ struct krt_set_status { }; static inline int krt_set_params_same(struct krt_set_params *o UNUSED, struct krt_set_params *n UNUSED) { return 1; } +static inline void krt_set_copy_params(struct krt_set_params *d UNUSED, struct krt_set_params *s UNUSED) { } #endif diff --git a/sysdep/unix/krt.Y b/sysdep/unix/krt.Y index 0375a13b..86081966 100644 --- a/sysdep/unix/krt.Y +++ b/sysdep/unix/krt.Y @@ -30,7 +30,7 @@ kern_proto_start: proto_start KERNEL { if (cf_krt) cf_error("Kernel protocol already defined"); #endif - cf_krt = this_proto = proto_config_new(&proto_unix_kernel, sizeof(struct krt_config)); + cf_krt = this_proto = proto_config_new(&proto_unix_kernel, sizeof(struct krt_config), $1); this_proto->preference = DEF_PREF_INHERITED; THIS_KRT->scan_time = 60; THIS_KRT->learn = THIS_KRT->persist = 0; @@ -66,7 +66,7 @@ CF_ADDTO(proto, kif_proto '}') kif_proto_start: proto_start DEVICE { if (cf_kif) cf_error("Kernel device protocol already defined"); - cf_kif = this_proto = proto_config_new(&proto_unix_iface, sizeof(struct kif_config)); + cf_kif = this_proto = proto_config_new(&proto_unix_iface, sizeof(struct kif_config), $1); this_proto->preference = DEF_PREF_DIRECT; THIS_KIF->scan_time = 60; init_list(&THIS_KIF->primary); diff --git a/sysdep/unix/krt.c b/sysdep/unix/krt.c index 70570703..e5a8ce17 100644 --- a/sysdep/unix/krt.c +++ b/sysdep/unix/krt.c @@ -216,6 +216,23 @@ kif_reconfigure(struct proto *p, struct proto_config *new) return 1; } +static void +kif_copy_config(struct proto_config *dest, struct proto_config *src) +{ + struct kif_config *d = (struct kif_config *) dest; + struct kif_config *s = (struct kif_config *) src; + + /* Shallow copy of everything (just scan_time currently) */ + proto_copy_rest(dest, src, sizeof(struct krt_config)); + + /* Copy primary addr list */ + cfg_copy_list(&d->primary, &s->primary, sizeof(struct kif_primary_item)); + + /* Fix sysdep parts */ + kif_copy_params(&d->iface, &s->iface); +} + + struct protocol proto_unix_iface = { name: "Device", template: "device%d", @@ -224,6 +241,7 @@ struct protocol proto_unix_iface = { start: kif_start, shutdown: kif_shutdown, reconfigure: kif_reconfigure, + copy_config: kif_copy_config }; /* @@ -908,6 +926,19 @@ krt_reconfigure(struct proto *p, struct proto_config *new) ; } +static void +krt_copy_config(struct proto_config *dest, struct proto_config *src) +{ + struct krt_config *d = (struct krt_config *) dest; + struct krt_config *s = (struct krt_config *) src; + + /* Shallow copy of everything */ + proto_copy_rest(dest, src, sizeof(struct krt_config)); + + /* Fix sysdep parts */ + krt_set_copy_params(&d->set, &s->set); + krt_scan_copy_params(&d->scan, &s->scan); +} static int krt_get_attr(eattr * a, byte * buf, int buflen UNUSED) @@ -936,6 +967,7 @@ struct protocol proto_unix_kernel = { start: krt_start, shutdown: krt_shutdown, reconfigure: krt_reconfigure, + copy_config: krt_copy_config, get_attr: krt_get_attr, #ifdef KRT_ALLOW_LEARN dump: krt_dump, diff --git a/sysdep/unix/krt.h b/sysdep/unix/krt.h index f83e6ee6..7bb4fe70 100644 --- a/sysdep/unix/krt.h +++ b/sysdep/unix/krt.h @@ -100,7 +100,7 @@ struct kif_config { struct proto_config c; struct krt_if_params iface; int scan_time; /* How often we re-scan interfaces */ - list primary; /* Preferences for primary addresses */ + list primary; /* Preferences for primary addresses (struct kif_primary_item) */ }; struct kif_proto { |