Skip to content

Commit

Permalink
Merge pull request #241 from fichtner/freebsd
Browse files Browse the repository at this point in the history
implement setup_allrouters_membership() et al for FreeBSD #145
  • Loading branch information
stappersg authored Dec 7, 2024
2 parents 5eeabd3 + ea27aae commit 1cab839
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions device-bsd44.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,28 +127,31 @@ int update_device_info(int sock, struct Interface *iface)

int setup_allrouters_membership(int sock, struct Interface *iface)
{
return 0;
struct ipv6_mreq mreq;

/* Quoting:
https://github.com/radvd-project/radvd/issues/145#issuecomment-810466476
memset(&mreq, 0, sizeof(mreq));
mreq.ipv6mr_interface = iface->props.if_index;

OK, it will be up to FreeBSD guys to show up
if they want to upstream their patches.
/* all-routers multicast address */
if (inet_pton(AF_INET6, "ff02::2",
&mreq.ipv6mr_multiaddr.s6_addr) != 1) {
flog(LOG_ERR, "inet_pton failed");
return -1;
}

*/
if (setsockopt(sock, IPPROTO_IPV6, IPV6_JOIN_GROUP,
&mreq, sizeof(mreq)) < 0 && errno != EADDRINUSE) {
flog(LOG_ERR, "can't join ipv6-allrouters on %s", iface->props.name);
return -1;
}

return 0;
}

int cleanup_allrouters_membership(int sock, struct Interface *iface)
{
/* no cleanup necessary */
return 0;

/* Quoting:
https://github.com/radvd-project/radvd/issues/145#issuecomment-810466476
OK, it will be up to FreeBSD guys to show up
if they want to upstream their patches.
*/
}

int set_interface_linkmtu(const char *iface, uint32_t mtu)
Expand Down Expand Up @@ -184,5 +187,5 @@ int check_ip6_forwarding(void)
int check_ip6_iface_forwarding(const char *iface)
{
dlog(LOG_DEBUG, 4, "checking ipv6 forwarding of interface not supported");
return -1;
return 1;
}

0 comments on commit 1cab839

Please sign in to comment.