From d7f469c15c1fd8315061f85b87a19946c3ea4700 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Mon, 9 Jan 2012 02:40:57 +0100 Subject: [PATCH] Some minor fixes. --- proto/bgp/packets.c | 2 +- sysdep/bsd/krt-sock.c | 20 ++++++++++---------- sysdep/unix/io.c | 12 ++++++------ sysdep/unix/unix.h | 5 +++-- 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c index bbb0865f..998abb7b 100644 --- a/proto/bgp/packets.c +++ b/proto/bgp/packets.c @@ -831,7 +831,7 @@ bgp_set_next_hop(struct bgp_proto *p, rta *a) if (p->cf->gw_mode == GW_DIRECT) { - neighbor *ng; + neighbor *ng = NULL; if (ipa_nonzero(*nexthop)) ng = neigh_find(&p->p, nexthop, 0); diff --git a/sysdep/bsd/krt-sock.c b/sysdep/bsd/krt-sock.c index a41be838..4bf6600d 100644 --- a/sysdep/bsd/krt-sock.c +++ b/sysdep/bsd/krt-sock.c @@ -134,9 +134,9 @@ krt_sock_send(int cmd, rte *e) _I0(gw) = 0xfe800000 | (i->index & 0x0000ffff); #endif - fill_in_sockaddr(&dst, net->n.prefix, 0); - fill_in_sockaddr(&mask, ipa_mkmask(net->n.pxlen), 0); - fill_in_sockaddr(&gate, gw, 0); + fill_in_sockaddr(&dst, net->n.prefix, NULL, 0); + fill_in_sockaddr(&mask, ipa_mkmask(net->n.pxlen), NULL, 0); + fill_in_sockaddr(&gate, gw, NULL, 0); switch (a->dest) { @@ -163,7 +163,7 @@ krt_sock_send(int cmd, rte *e) return -1; } - fill_in_sockaddr(&gate, i->addr->ip, 0); + fill_in_sockaddr(&gate, i->addr->ip, NULL, 0); msg.rtm.rtm_addrs |= RTA_GATEWAY; } break; @@ -274,19 +274,19 @@ krt_read_rt(struct ks_msg *msg, struct krt_proto *p, int scan) GETADDR(&mask, RTA_NETMASK); if (sa_family_check(&dst)) - get_sockaddr(&dst, &idst, NULL, 0); + get_sockaddr(&dst, &idst, NULL, NULL, 0); else SKIP("invalid DST"); /* We will check later whether we have valid gateway addr */ if (sa_family_check(&gate)) - get_sockaddr(&gate, &igate, NULL, 0); + get_sockaddr(&gate, &igate, NULL, NULL, 0); else igate = IPA_NONE; /* We do not test family for RTA_NETMASK, because BSD sends us some strange values, but interpreting them as IPv4/IPv6 works */ - get_sockaddr(&mask, &imask, NULL, 0); + get_sockaddr(&mask, &imask, NULL, NULL, 0); int c = ipa_classify_net(idst); if ((c < 0) || !(c & IADDR_HOST) || ((c & IADDR_SCOPE_MASK) <= SCOPE_LINK)) @@ -512,9 +512,9 @@ krt_read_addr(struct ks_msg *msg) if (!sa_family_check(&addr)) return; - get_sockaddr(&addr, &iaddr, NULL, 0); - get_sockaddr(&mask, &imask, NULL, 0); - get_sockaddr(&brd, &ibrd, NULL, 0); + get_sockaddr(&addr, &iaddr, NULL, NULL, 0); + get_sockaddr(&mask, &imask, NULL, NULL, 0); + get_sockaddr(&brd, &ibrd, NULL, NULL, 0); if ((masklen = ipa_mklen(imask)) < 0) { diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c index d72161f1..2dced67a 100644 --- a/sysdep/unix/io.c +++ b/sysdep/unix/io.c @@ -609,8 +609,8 @@ sk_insert(sock *s) #ifdef IPV6 -static void -fill_in_sockaddr(sockaddr *sa, ip_addr a, struct iface *ifa, unsigned port) +void +fill_in_sockaddr(struct sockaddr_in6 *sa, ip_addr a, struct iface *ifa, unsigned port) { memset(sa, 0, sizeof (struct sockaddr_in6)); sa->sin6_family = AF_INET6; @@ -625,7 +625,7 @@ fill_in_sockaddr(sockaddr *sa, ip_addr a, struct iface *ifa, unsigned port) sa->sin6_scope_id = ifa->index; } -static void +void get_sockaddr(struct sockaddr_in6 *sa, ip_addr *a, struct iface **ifa, unsigned *port, int check) { if (check && sa->sin6_family != AF_INET6) @@ -641,8 +641,8 @@ get_sockaddr(struct sockaddr_in6 *sa, ip_addr *a, struct iface **ifa, unsigned * #else -static void -fill_in_sockaddr(sockaddr *sa, ip_addr a, struct iface *ifa, unsigned port) +void +fill_in_sockaddr(struct sockaddr_in *sa, ip_addr a, struct iface *ifa, unsigned port) { memset (sa, 0, sizeof (struct sockaddr_in)); sa->sin_family = AF_INET; @@ -653,7 +653,7 @@ fill_in_sockaddr(sockaddr *sa, ip_addr a, struct iface *ifa, unsigned port) set_inaddr(&sa->sin_addr, a); } -static void +void get_sockaddr(struct sockaddr_in *sa, ip_addr *a, struct iface **ifa, unsigned *port, int check) { if (check && sa->sin_family != AF_INET) diff --git a/sysdep/unix/unix.h b/sysdep/unix/unix.h index ff31af29..3e85c85c 100644 --- a/sysdep/unix/unix.h +++ b/sysdep/unix/unix.h @@ -45,11 +45,12 @@ static inline int sa_family_check(sockaddr *sa) { return sa->sin_family == AF_IN #endif struct birdsock; +struct iface; void io_init(void); void io_loop(void); -// void fill_in_sockaddr(sockaddr *sa, ip_addr a, struct iface *ifa, unsigned port); -// void get_sockaddr(struct sockaddr_in6 *sa, ip_addr *a, struct iface **ifa, unsigned *port, int check); +void fill_in_sockaddr(sockaddr *sa, ip_addr a, struct iface *ifa, unsigned port); +void get_sockaddr(sockaddr *sa, ip_addr *a, struct iface **ifa, unsigned *port, int check); void sk_open_unix(struct birdsock *s, char *name); void *tracked_fopen(struct pool *, char *name, char *mode); void test_old_bird(char *path);