diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2015-02-21 21:08:23 +0100 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2015-02-21 21:08:23 +0100 |
commit | 2bbc308321894e0fd301766e8d7d78a4ec119053 (patch) | |
tree | cd3b8bab72022801655ad6b420ace93267b29f07 /proto | |
parent | 374917adccb955fbb2796955166fabe46a09e096 (diff) |
Store protocol config size inside protocol structure
Make proto_config_new() use this info instead of supplied size.
Thanks to Alexander V. Chernikov for the patch.
Diffstat (limited to 'proto')
-rw-r--r-- | proto/bfd/bfd.c | 1 | ||||
-rw-r--r-- | proto/bfd/config.Y | 2 | ||||
-rw-r--r-- | proto/bgp/bgp.c | 1 | ||||
-rw-r--r-- | proto/bgp/config.Y | 2 | ||||
-rw-r--r-- | proto/ospf/config.Y | 2 | ||||
-rw-r--r-- | proto/ospf/ospf.c | 1 | ||||
-rw-r--r-- | proto/pipe/config.Y | 2 | ||||
-rw-r--r-- | proto/pipe/pipe.c | 5 | ||||
-rw-r--r-- | proto/radv/config.Y | 2 | ||||
-rw-r--r-- | proto/radv/radv.c | 5 | ||||
-rw-r--r-- | proto/rip/config.Y | 2 | ||||
-rw-r--r-- | proto/rip/rip.c | 8 | ||||
-rw-r--r-- | proto/static/config.Y | 2 | ||||
-rw-r--r-- | proto/static/static.c | 1 |
14 files changed, 21 insertions, 15 deletions
diff --git a/proto/bfd/bfd.c b/proto/bfd/bfd.c index 23e04e40..5f089846 100644 --- a/proto/bfd/bfd.c +++ b/proto/bfd/bfd.c @@ -1112,6 +1112,7 @@ bfd_show_sessions(struct proto *P) struct protocol proto_bfd = { .name = "BFD", .template = "bfd%d", + .config_size = sizeof(struct bfd_config), .init = bfd_init, .start = bfd_start, .shutdown = bfd_shutdown, diff --git a/proto/bfd/config.Y b/proto/bfd/config.Y index 1b07495e..4affb927 100644 --- a/proto/bfd/config.Y +++ b/proto/bfd/config.Y @@ -34,7 +34,7 @@ CF_ADDTO(proto, bfd_proto) bfd_proto_start: proto_start BFD { - this_proto = proto_config_new(&proto_bfd, sizeof(struct bfd_config), $1); + this_proto = proto_config_new(&proto_bfd, $1); init_list(&BFD_CFG->patt_list); init_list(&BFD_CFG->neigh_list); diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c index c8b1867b..016d3e60 100644 --- a/proto/bgp/bgp.c +++ b/proto/bgp/bgp.c @@ -1455,6 +1455,7 @@ struct protocol proto_bgp = { .template = "bgp%d", .attr_class = EAP_BGP, .preference = DEF_PREF_BGP, + .config_size = sizeof(struct bgp_config), .init = bgp_init, .start = bgp_start, .shutdown = bgp_shutdown, diff --git a/proto/bgp/config.Y b/proto/bgp/config.Y index e4875b27..ed40634f 100644 --- a/proto/bgp/config.Y +++ b/proto/bgp/config.Y @@ -34,7 +34,7 @@ CF_GRAMMAR CF_ADDTO(proto, bgp_proto '}' { bgp_check_config(BGP_CFG); } ) bgp_proto_start: proto_start BGP { - this_proto = proto_config_new(&proto_bgp, sizeof(struct bgp_config), $1); + this_proto = proto_config_new(&proto_bgp, $1); BGP_CFG->multihop = -1; /* undefined */ BGP_CFG->hold_time = 240; BGP_CFG->connect_retry_time = 120; diff --git a/proto/ospf/config.Y b/proto/ospf/config.Y index 268b9539..c859960f 100644 --- a/proto/ospf/config.Y +++ b/proto/ospf/config.Y @@ -141,7 +141,7 @@ CF_GRAMMAR CF_ADDTO(proto, ospf_proto '}' { ospf_proto_finish(); } ) ospf_proto_start: proto_start OSPF { - this_proto = proto_config_new(&proto_ospf, sizeof(struct ospf_config), $1); + this_proto = proto_config_new(&proto_ospf, $1); init_list(&OSPF_CFG->area_list); init_list(&OSPF_CFG->vlink_list); OSPF_CFG->tick = OSPF_DEFAULT_TICK; diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c index dab7aab8..1bc4e077 100644 --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@ -1457,6 +1457,7 @@ struct protocol proto_ospf = { .template = "ospf%d", .attr_class = EAP_OSPF, .preference = DEF_PREF_OSPF, + .config_size = sizeof(struct ospf_config), .init = ospf_init, .dump = ospf_dump, .start = ospf_start, diff --git a/proto/pipe/config.Y b/proto/pipe/config.Y index 40637558..8daf2e7c 100644 --- a/proto/pipe/config.Y +++ b/proto/pipe/config.Y @@ -23,7 +23,7 @@ CF_GRAMMAR CF_ADDTO(proto, pipe_proto '}') pipe_proto_start: proto_start PIPE { - this_proto = proto_config_new(&proto_pipe, sizeof(struct pipe_config), $1); + this_proto = proto_config_new(&proto_pipe, $1); PIPE_CFG->mode = PIPE_TRANSPARENT; } ; diff --git a/proto/pipe/pipe.c b/proto/pipe/pipe.c index d6ef153a..6ef80322 100644 --- a/proto/pipe/pipe.c +++ b/proto/pipe/pipe.c @@ -247,7 +247,7 @@ pipe_reconfigure(struct proto *P, struct proto_config *new) if ((P->proto_state != PS_UP) || (proto_reconfig_type == RECONFIG_SOFT)) return 1; - + if ((new->preference != old->preference) || ! filter_same(new->in_filter, old->in_filter) || ! filter_same(new->out_filter, old->out_filter)) @@ -298,7 +298,7 @@ pipe_show_stats(struct pipe_proto *p) * (imp/exp), while stats s2 have switched 'polarity'. */ - cli_msg(-1006, " Routes: %u imported, %u exported", + cli_msg(-1006, " Routes: %u imported, %u exported", s1->imp_routes, s2->imp_routes); cli_msg(-1006, " Route change stats: received rejected filtered ignored accepted"); cli_msg(-1006, " Import updates: %10u %10u %10u %10u %10u", @@ -340,6 +340,7 @@ struct protocol proto_pipe = { .template = "pipe%d", .multitable = 1, .preference = DEF_PREF_PIPE, + .config_size = sizeof(struct pipe_config), .postconfig = pipe_postconfig, .init = pipe_init, .start = pipe_start, diff --git a/proto/radv/config.Y b/proto/radv/config.Y index a26ea88e..da300667 100644 --- a/proto/radv/config.Y +++ b/proto/radv/config.Y @@ -40,7 +40,7 @@ CF_ADDTO(proto, radv_proto) radv_proto_start: proto_start RADV { - this_proto = proto_config_new(&proto_radv, sizeof(struct radv_config), $1); + this_proto = proto_config_new(&proto_radv, $1); init_list(&RADV_CFG->patt_list); init_list(&RADV_CFG->pref_list); init_list(&RADV_CFG->rdnss_list); diff --git a/proto/radv/radv.c b/proto/radv/radv.c index 6be7cd84..6370e006 100644 --- a/proto/radv/radv.c +++ b/proto/radv/radv.c @@ -207,7 +207,7 @@ radv_iface_remove(struct radv_iface *ifa) static void radv_if_notify(struct proto *p, unsigned flags, struct iface *iface) -{ +{ struct proto_radv *ra = (struct proto_radv *) p; struct radv_config *cf = (struct radv_config *) (p->cf); @@ -361,7 +361,7 @@ radv_reconfigure(struct proto *p, struct proto_config *c) // struct radv_config *old = (struct radv_config *) (p->cf); struct radv_config *new = (struct radv_config *) c; - /* + /* * The question is why there is a reconfigure function for RAdv if * it has almost none internal state so restarting the protocol * would probably suffice. One small reason is that restarting the @@ -426,6 +426,7 @@ radv_get_status(struct proto *p, byte *buf) struct protocol proto_radv = { .name = "RAdv", .template = "radv%d", + .config_size = sizeof(struct radv_config), .init = radv_init, .start = radv_start, .shutdown = radv_shutdown, diff --git a/proto/rip/config.Y b/proto/rip/config.Y index 76397520..b2b99095 100644 --- a/proto/rip/config.Y +++ b/proto/rip/config.Y @@ -43,7 +43,7 @@ CF_GRAMMAR CF_ADDTO(proto, rip_cfg '}' { RIP_CFG->passwords = get_passwords(); } ) rip_cfg_start: proto_start RIP { - this_proto = proto_config_new(&proto_rip, sizeof(struct rip_proto_config), $1); + this_proto = proto_config_new(&proto_rip, $1); rip_init_config(RIP_CFG); } ; diff --git a/proto/rip/rip.c b/proto/rip/rip.c index f41f52e7..b77cf409 100644 --- a/proto/rip/rip.c +++ b/proto/rip/rip.c @@ -1050,12 +1050,12 @@ struct protocol proto_rip = { .template = "rip%d", .attr_class = EAP_RIP, .preference = DEF_PREF_RIP, - .get_route_info = rip_get_route_info, - .get_attr = rip_get_attr, - + .config_size = sizeof(struct rip_proto_config), .init = rip_init, .dump = rip_dump, .start = rip_start, .reconfigure = rip_reconfigure, - .copy_config = rip_copy_config + .copy_config = rip_copy_config, + .get_route_info = rip_get_route_info, + .get_attr = rip_get_attr }; diff --git a/proto/static/config.Y b/proto/static/config.Y index 2d9d4b42..a8bfa36f 100644 --- a/proto/static/config.Y +++ b/proto/static/config.Y @@ -26,7 +26,7 @@ CF_GRAMMAR CF_ADDTO(proto, static_proto '}') static_proto_start: proto_start STATIC { - this_proto = proto_config_new(&proto_static, sizeof(struct static_config), $1); + this_proto = proto_config_new(&proto_static, $1); static_init_config((struct static_config *) this_proto); } ; diff --git a/proto/static/static.c b/proto/static/static.c index 8c31cdb8..4b72fa9d 100644 --- a/proto/static/static.c +++ b/proto/static/static.c @@ -531,6 +531,7 @@ struct protocol proto_static = { .name = "Static", .template = "static%d", .preference = DEF_PREF_STATIC, + .config_size = sizeof(struct static_config), .init = static_init, .dump = static_dump, .start = static_start, |