diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2012-04-30 15:31:32 +0200 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2012-04-30 15:31:32 +0200 |
commit | 396dfa9042305f62da1f56589c4b98fac57fc2f6 (patch) | |
tree | fcd1bcf1a7b1afe9a98d11018c77ecff68b40f63 /sysdep/linux/netlink/netlink.c | |
parent | 182a78957d60a4c91c1ff8d1ff0f09b1b64b70ba (diff) |
Cleanup in sysdep KRT code, part 1.
OS-dependent functions renamed to be more consistent,
prepared to merge krt-set and krt-scan headers.
Name changes:
struct krt_if_params -> struct kif_params
struct krt_if_status -> struct kif_status
struct krt_set/scan_params -> struct krt_params
struct krt_set/scan_status -> struct krt_status
krt_if_params_same -> kif_sys_reconfigure
krt_if_copy_params -> kif_sys_copy_config
krt_set/scan_params_same -> krt_sys_reconfigure
krt_set/scan_copy_params -> krt_sys_copy_config
krt_if_scan -> kif_do_scan
krt_set_notify -> krt_do_notify
krt_scan_fire -> krt_do_scan
krt_if_ -> kif_sys_
krt_scan_ -> krt_sys_
krt_set_ -> krt_sys_
Diffstat (limited to 'sysdep/linux/netlink/netlink.c')
-rw-r--r-- | sysdep/linux/netlink/netlink.c | 65 |
1 files changed, 40 insertions, 25 deletions
diff --git a/sysdep/linux/netlink/netlink.c b/sysdep/linux/netlink/netlink.c index 182088a1..e3faf043 100644 --- a/sysdep/linux/netlink/netlink.c +++ b/sysdep/linux/netlink/netlink.c @@ -548,7 +548,7 @@ nl_parse_addr(struct nlmsghdr *h) } void -krt_if_scan(struct kif_proto *p UNUSED) +kif_do_scan(struct kif_proto *p UNUSED) { struct nlmsghdr *h; @@ -634,7 +634,7 @@ nl_send_route(struct krt_proto *p, rte *e, struct ea_list *eattrs, int new) r.r.rtm_family = BIRD_AF; r.r.rtm_dst_len = net->n.pxlen; r.r.rtm_tos = 0; - r.r.rtm_table = KRT_CF->scan.table_id; + r.r.rtm_table = KRT_CF->sys.table_id; r.r.rtm_protocol = RTPROT_BIRD; r.r.rtm_scope = RT_SCOPE_UNIVERSE; nl_add_attr_ipa(&r.h, sizeof(r), RTA_DST, net->n.prefix); @@ -687,7 +687,7 @@ nl_send_route(struct krt_proto *p, rte *e, struct ea_list *eattrs, int new) } void -krt_set_notify(struct krt_proto *p, net *n, rte *new, rte *old, struct ea_list *eattrs) +krt_do_notify(struct krt_proto *p, net *n, rte *new, rte *old, struct ea_list *eattrs) { int err = 0; @@ -940,7 +940,7 @@ nl_parse_route(struct nlmsghdr *h, int scan) } void -krt_scan_fire(struct krt_proto *p UNUSED) /* CONFIG_ALL_TABLES_AT_ONCE => p is NULL */ +krt_do_scan(struct krt_proto *p UNUSED) /* CONFIG_ALL_TABLES_AT_ONCE => p is NULL */ { struct nlmsghdr *h; @@ -1084,15 +1084,38 @@ nl_open_async(void) static u8 nl_cf_table[(NL_NUM_TABLES+7) / 8]; void -krt_scan_preconfig(struct config *c UNUSED) +krt_sys_start(struct krt_proto *p, int first) +{ + nl_table_map[KRT_CF->sys.table_id] = p; + if (first) + { + nl_open(); + nl_open_async(); + } +} + +void +krt_sys_shutdown(struct krt_proto *p UNUSED, int last UNUSED) +{ +} + +int +krt_sys_reconfigure(struct krt_proto *p UNUSED, struct krt_config *n, struct krt_config *o) +{ + return n->sys.table_id == o->sys.table_id; +} + + +void +krt_sys_preconfig(struct config *c UNUSED) { bzero(&nl_cf_table, sizeof(nl_cf_table)); } void -krt_scan_postconfig(struct krt_config *x) +krt_sys_postconfig(struct krt_config *x) { - int id = x->scan.table_id; + int id = x->sys.table_id; if (nl_cf_table[id/8] & (1 << (id%8))) cf_error("Multiple kernel syncers defined for table #%d", id); @@ -1100,35 +1123,27 @@ krt_scan_postconfig(struct krt_config *x) } void -krt_scan_construct(struct krt_config *x) +krt_sys_init_config(struct krt_config *cf) { -#ifndef IPV6 - x->scan.table_id = RT_TABLE_MAIN; -#else - x->scan.table_id = 254; -#endif + cf->sys.table_id = RT_TABLE_MAIN; } void -krt_scan_start(struct krt_proto *p, int first) +krt_sys_copy_config(struct krt_config *d, struct krt_config *s) { - init_list(&p->scan.temp_ifs); - nl_table_map[KRT_CF->scan.table_id] = p; - if (first) - { - nl_open(); - nl_open_async(); - } + d->sys.table_id = s->sys.table_id; } + + void -krt_scan_shutdown(struct krt_proto *p UNUSED, int last UNUSED) +kif_sys_start(struct kif_proto *p UNUSED) { + nl_open(); + nl_open_async(); } void -krt_if_start(struct kif_proto *p UNUSED) +kif_sys_shutdown(struct kif_proto *p UNUSED) { - nl_open(); - nl_open_async(); } |