diff mbox series

[rpld,2/6] send: make sure we check on scope id usage

Message ID 20190918195819.7492-3-stefan@datenfreihafen.org (mailing list archive)
State Not Applicable
Headers show
Series Mixed bag of rpld patches | expand

Commit Message

Stefan Schmidt Sept. 18, 2019, 7:58 p.m. UTC
It fails on my machine and likely fails on others, better
check for it.
---
 send.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Alexander Aring Dec. 20, 2019, 10:52 p.m. UTC | #1
Hi Stefan,,

On Wed, 18 Sep 2019 at 15:58, Stefan Schmidt <stefan@datenfreihafen.org> wrote:
>
> It fails on my machine and likely fails on others, better
> check for it.
> ---
>  send.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/send.c b/send.c
> index 97c566d..d026f6a 100644
> --- a/send.c
> +++ b/send.c
> @@ -53,11 +53,9 @@ static int really_send(int sock, const struct iface *iface,
>         pkt_info->ipi6_ifindex = iface->ifindex;
>         memcpy(&pkt_info->ipi6_addr, iface->ifaddr_src, sizeof(struct in6_addr));
>
> -#if 1
> -//#ifdef HAVE_SIN6_SCOPE_ID
> +#ifdef HAVE_SIN6_SCOPE_ID

This HAVE_ stuff is from autoconf where I took the code (radvd), so
this will mostly end in #ifdef 0 because we use meson now and don't
ask me how to check on this in meson but it's simple I think. :-)
I think we can remove this code and see if we break something. The
point here radvd is ported to BSD, Linux, etc. and this is some system
thing. _Maybe_ it is really not necessary for Linux systems _because_
we set above "pkt_info->ipi6_ifindex = iface->ifindex;" which is maybe
enough on a Linux system... but it could also be to solve some UAPI
messup.... just remove it. In a scope of link-local we must set the
interface somehow, I am not sure how the correct API works here, as I
said... look if it makes problems. Sorry but it means: I am too lazy
too look it up why this is necessary in radvd (git blame is maybe
enough?).

Note: That it compiles on my Linux machine and not on your Linux
machine, means there is something in Linux API headers.

- Alex
diff mbox series

Patch

diff --git a/send.c b/send.c
index 97c566d..d026f6a 100644
--- a/send.c
+++ b/send.c
@@ -53,11 +53,9 @@  static int really_send(int sock, const struct iface *iface,
 	pkt_info->ipi6_ifindex = iface->ifindex;
 	memcpy(&pkt_info->ipi6_addr, iface->ifaddr_src, sizeof(struct in6_addr));
 
-#if 1
-//#ifdef HAVE_SIN6_SCOPE_ID
+#ifdef HAVE_SIN6_SCOPE_ID
 	if (IN6_IS_ADDR_LINKLOCAL(&addr.sin6_addr) || IN6_IS_ADDR_MC_LINKLOCAL(&addr.sin6_addr))
 		addr.sin6_scope_id = iface->ifindex;
-//#endif
 #endif
 
 	struct msghdr mhdr;