diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2009-08-27 18:25:46 +0200 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2009-08-27 18:25:46 +0200 |
commit | 061ab802a67cfc336785f6daeecdcbd4910734ed (patch) | |
tree | a3815a619b1e3e553638e4aad6508757e5bc6f7a /sysdep | |
parent | b49e6f5a65d437cb7e7bdefe8397e0f550496012 (diff) | |
download | bird-061ab802a67cfc336785f6daeecdcbd4910734ed.tar bird-061ab802a67cfc336785f6daeecdcbd4910734ed.zip |
Temporary OSPFv3 development commit
Diffstat (limited to 'sysdep')
-rw-r--r-- | sysdep/unix/io.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c index a5e0522..d954716 100644 --- a/sysdep/unix/io.c +++ b/sysdep/unix/io.c @@ -636,6 +636,12 @@ fill_in_sockaddr(sockaddr *sa, ip_addr a, unsigned port) set_inaddr(&sa->sin6_addr, a); } +static inline void +fill_in_sockifa(sockaddr *sa, struct iface *ifa) +{ + sa->sin6_scope_id = ifa ? ifa->index : 0; +} + void get_sockaddr(struct sockaddr_in6 *sa, ip_addr *a, unsigned *port, int check) { @@ -661,6 +667,11 @@ fill_in_sockaddr(sockaddr *sa, ip_addr a, unsigned port) set_inaddr(&sa->sin_addr, a); } +static inline void +fill_in_sockifa(sockaddr *sa, struct iface *ifa) +{ +} + void get_sockaddr(struct sockaddr_in *sa, ip_addr *a, unsigned *port, int check) { @@ -874,10 +885,8 @@ sk_open(sock *s) { case SK_UDP: case SK_IP: +#ifndef IPV6 if (s->iface) /* It's a broadcast socket */ -#ifdef IPV6 - bug("IPv6 has no broadcasts"); -#else if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &one, sizeof(one)) < 0) ERR("SO_BROADCAST"); #endif @@ -911,7 +920,7 @@ sk_open(sock *s) if (setsockopt(fd, SOL_IPV6, IPV6_ADD_MEMBERSHIP, &mreq, sizeof(mreq)) < 0) ERR("IPV6_ADD_MEMBERSHIP"); } -#else +#else /* IPv4 */ /* With IPv4 there are zillions of different socket interface variants. Ugh. */ ASSERT(s->iface && s->iface->addr); if (err = sysio_mcast_join(s)) @@ -933,6 +942,7 @@ sk_open(sock *s) ERR("SO_REUSEADDR"); } fill_in_sockaddr(&sa, s->saddr, port); + fill_in_sockifa(&sa, s->iface); #ifdef CONFIG_SKIP_MC_BIND if ((type != SK_UDP_MC) && (type != SK_IP_MC) && bind(fd, (struct sockaddr *) &sa, sizeof(sa)) < 0) @@ -1067,8 +1077,9 @@ sk_maybe_write(sock *s) if (s->tbuf == s->tpos) return 1; - fill_in_sockaddr(&sa, s->faddr, s->fport); + fill_in_sockaddr(&sa, s->faddr, s->fport); + fill_in_sockifa(&sa, s->iface); e = sendto(s->fd, s->tbuf, s->tpos - s->tbuf, 0, (struct sockaddr *) &sa, sizeof(sa)); if (e < 0) { |