Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make it easier to debug why setup_ifaces skipped an interface #210

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading