Commit d7f469c1 authored by Ondřej Zajíček's avatar Ondřej Zajíček

Some minor fixes.

parent 3f584374
......@@ -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);
......
......@@ -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)
{
......
......@@ -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)
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment