Skip to content

Commit

Permalink
Merge pull request #210 from robbat2/setup_iface_debug
Browse files Browse the repository at this point in the history
feat: make it easier to debug why setup_ifaces skipped an interface
  • Loading branch information
robbat2 authored Nov 13, 2023
2 parents 3fe94d2 + d087edf commit 2615f9a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
12 changes: 6 additions & 6 deletions interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,35 +73,35 @@ int setup_iface(int sock, struct Interface *iface)

/* Check IFF_UP, IFF_RUNNING and IFF_MULTICAST */
if (check_device(sock, iface) < 0) {
return -1;
return -2;
}

/* Set iface->max_mtu and iface hardware address */
if (update_device_info(sock, iface) < 0) {
return -1;
return -3;
}

/* Make sure the settings in the config file for this interface are ok (this depends
* on iface->max_mtu already being set). */
if (check_iface(iface) < 0) {
return -1;
return -4;
}

/* Save the first link local address seen on the specified interface to
* iface->props.if_addr and keep a list off all addrs in iface->props.if_addrs */
if (setup_iface_addrs(iface) < 0) {
return -1;
return -5;
}

/* Check if we a usable RA source address */
if (iface->props.if_addr_rasrc == NULL) {
dlog(LOG_DEBUG, 5, "no configured AdvRASrcAddress present, skipping send");
return -1;
return -6;
}

/* join the allrouters multicast group so we get the solicitations */
if (setup_allrouters_membership(sock, iface) < 0) {
return -1;
return -7;
}

iface->state_info.ready = 1;
Expand Down
16 changes: 12 additions & 4 deletions radvd.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,13 +766,21 @@ static void setup_iface_foo(struct Interface *iface, void *data)
{
int sock = *(int *)data;

if (setup_iface(sock, iface) < 0) {
int setup_iface_result = setup_iface(sock, iface);
if (setup_iface_result < 0) {
if (iface->IgnoreIfMissing) {
dlog(LOG_DEBUG, 4, "interface %s does not exist or is not set up properly, ignoring the interface",
iface->props.name);
dlog(LOG_DEBUG, 4,
"interface %s does not exist or is not set up properly, ignoring the interface (setup_iface=%d)",
iface->props.name,
setup_iface_result
);
return;
} else {
flog(LOG_ERR, "interface %s does not exist or is not set up properly", iface->props.name);
flog(LOG_ERR,
"interface %s does not exist or is not set up properly (setup_iface=%d)",
iface->props.name,
setup_iface_result
);
exit(1);
}
}
Expand Down

0 comments on commit 2615f9a

Please sign in to comment.