From cfe34a316e35a209fcd814ccf3523c262e8d4b0a Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Mon, 5 Jul 2010 17:50:19 +0200 Subject: Implements hostcache and recursive next hops. Hostcache is a structure for monitoring changes in a routing table that is used for routes with dynamic/recursive next hops. This is needed for proper iBGP next hop handling. --- sysdep/bsd/krt-sock.c | 18 ++++++------------ sysdep/linux/krt-scan.c | 15 ++++++--------- sysdep/linux/netlink/netlink.c | 17 +++++++---------- 3 files changed, 19 insertions(+), 31 deletions(-) (limited to 'sysdep') diff --git a/sysdep/bsd/krt-sock.c b/sysdep/bsd/krt-sock.c index 4c8676e..9ae658d 100644 --- a/sysdep/bsd/krt-sock.c +++ b/sysdep/bsd/krt-sock.c @@ -244,7 +244,6 @@ krt_set_start(struct krt_proto *x, int first UNUSED) static void krt_read_rt(struct ks_msg *msg, struct krt_proto *p, int scan) { - rta a; rte *e; net *net; sockaddr dst, gate, mask; @@ -329,17 +328,12 @@ krt_read_rt(struct ks_msg *msg, struct krt_proto *p, int scan) net = net_get(p->p.table, idst, pxlen); - bzero(&a, sizeof(a)); - - a.proto = &p->p; - a.source = RTS_INHERIT; - a.scope = SCOPE_UNIVERSE; - a.cast = RTC_UNICAST; - a.flags = a.aflags = 0; - a.from = IPA_NONE; - a.gw = IPA_NONE; - a.iface = NULL; - a.eattrs = NULL; + rta a = { + .proto = &p->p, + .source = RTS_INHERIT, + .scope = SCOPE_UNIVERSE, + .cast = RTC_UNICAST + }; /* reject/blackhole routes have also set RTF_GATEWAY, we wil check them first. */ diff --git a/sysdep/linux/krt-scan.c b/sysdep/linux/krt-scan.c index feb128e..8591607 100644 --- a/sysdep/linux/krt-scan.c +++ b/sysdep/linux/krt-scan.c @@ -48,7 +48,6 @@ krt_parse_entry(byte *ent, struct krt_proto *p) int masklen; net *net; byte *iface = ent; - rta a; rte *e; if (sscanf(ent, "%*s\t%x\t%x\t%x\t%*d\t%*d\t%*d\t%x\t", &dest0, &gw0, &flags, &mask0) != 4) @@ -88,14 +87,12 @@ krt_parse_entry(byte *ent, struct krt_proto *p) net = net_get(p->p.table, dest, masklen); - a.proto = &p->p; - a.source = RTS_INHERIT; - a.scope = SCOPE_UNIVERSE; - a.cast = RTC_UNICAST; - a.flags = a.aflags = 0; - a.from = IPA_NONE; - a.iface = NULL; - a.eattrs = NULL; + rta a = { + .proto = &p->p, + .source = RTS_INHERIT, + .scope = SCOPE_UNIVERSE, + .cast = RTC_UNICAST + }; if (flags & RTF_GATEWAY) { diff --git a/sysdep/linux/netlink/netlink.c b/sysdep/linux/netlink/netlink.c index a10a2e9..2dd0359 100644 --- a/sysdep/linux/netlink/netlink.c +++ b/sysdep/linux/netlink/netlink.c @@ -570,7 +570,6 @@ nl_parse_route(struct nlmsghdr *h, int scan) struct rtattr *a[RTA_CACHEINFO+1]; int new = h->nlmsg_type == RTM_NEWROUTE; ip_addr dst; - rta ra; rte *e; net *net; u32 oif; @@ -655,15 +654,13 @@ nl_parse_route(struct nlmsghdr *h, int scan) } net = net_get(p->p.table, dst, i->rtm_dst_len); - ra.proto = &p->p; - ra.source = RTS_INHERIT; - ra.scope = SCOPE_UNIVERSE; - ra.cast = RTC_UNICAST; - ra.flags = ra.aflags = 0; - ra.from = IPA_NONE; - ra.gw = IPA_NONE; - ra.iface = NULL; - ra.eattrs = NULL; + + rta ra = { + .proto = &p->p, + .source = RTS_INHERIT, + .scope = SCOPE_UNIVERSE, + .cast = RTC_UNICAST + }; switch (i->rtm_type) { -- cgit v1.2.3