Skip to content

Commit

Permalink
Pull in upstream kernel_setup_interface
Browse files Browse the repository at this point in the history
This pulls the latest version of the kernel_setup_interface function
in from upstream with the hope that it fixes some obscure issues we're
having.

setsockopt(IPV6_JOIN_GROUP): Out of memory
setsockopt(IPV6_LEAVE_GROUP): Address not available
Warning: cannot restore old configuration for wgA.
Warning: cannot save old configuration for wgB.

We keep seeing these sorts of error messages on long running production
nodes, presumably due to the race condition outlined here

sudomesh/bugs#24

Obviously it would be best if we could recover from these errors in
Babel rather than having to try and reduce them on the side of the
interfacing application.

That being said this isn't a well consdiered change, it may be that we
have to cleanup old_if in this error case in a way upstream has not
considered.
  • Loading branch information
jkilpatr authored and thosmos committed Aug 13, 2021
1 parent 6a96a09 commit c11cbc3
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions kernel_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,7 @@ get_old_if(const char *ifname)
int
kernel_setup_interface(int setup, const char *ifname, int ifindex)
{

char buf[100];
int i, rc;

Expand All @@ -677,14 +678,18 @@ kernel_setup_interface(int setup, const char *ifname, int ifindex)
fprintf(stderr,
"Warning: cannot save old configuration for %s.\n",
ifname);
rc = write_proc(buf, 0);
if(rc < 0)
return -1;
if(old_if[i].rp_filter) {
rc = write_proc(buf, 0);
if(rc < 0)
return -1;
}
} else {
if(i >= 0 && old_if[i].rp_filter >= 0)
if(i >= 0 && old_if[i].rp_filter > 0)
rc = write_proc(buf, old_if[i].rp_filter);
else
else if(i < 0)
rc = -1;
else
rc = 1;

if(rc < 0)
fprintf(stderr,
Expand Down

0 comments on commit c11cbc3

Please sign in to comment.