Bring interfaces down when an error is encountered
Modify src/server.c to bring interfaces down when an I/O error is encountered
This commit is contained in:
parent
8e118a3b56
commit
5b59b163d2
4 changed files with 15 additions and 2 deletions
2
bin/if.c
2
bin/if.c
|
@ -125,6 +125,8 @@ static patty_ax25_if *create_kiss(struct context *ctx, int argc, char **argv) {
|
||||||
goto error_if_addr_set;
|
goto error_if_addr_set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
patty_ax25_if_up(iface);
|
||||||
|
|
||||||
return iface;
|
return iface;
|
||||||
|
|
||||||
error_if_addr_set:
|
error_if_addr_set:
|
||||||
|
|
|
@ -127,6 +127,8 @@ static int handle_if(struct context *ctx,
|
||||||
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
patty_ax25_if_up(iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (patty_daemon_if_add(ctx->daemon, iface, ifname) < 0) {
|
if (patty_daemon_if_add(ctx->daemon, iface, ifname) < 0) {
|
||||||
|
@ -323,6 +325,8 @@ static int handle_standalone(patty_daemon *daemon,
|
||||||
if (isatty(fd) && (pty = ptsname(fd)) != NULL) {
|
if (isatty(fd) && (pty = ptsname(fd)) != NULL) {
|
||||||
printf("if %s pty %s\n", DEFAULT_IFNAME, pty);
|
printf("if %s pty %s\n", DEFAULT_IFNAME, pty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
patty_ax25_if_up(iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (patty_daemon_if_add(daemon, iface, DEFAULT_IFNAME) < 0) {
|
if (patty_daemon_if_add(daemon, iface, DEFAULT_IFNAME) < 0) {
|
||||||
|
|
3
src/if.c
3
src/if.c
|
@ -282,7 +282,8 @@ int patty_ax25_if_fd(patty_ax25_if *iface) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int patty_ax25_if_ready(patty_ax25_if *iface, fd_set *fds) {
|
int patty_ax25_if_ready(patty_ax25_if *iface, fd_set *fds) {
|
||||||
return iface->driver->ready(iface->phy, fds);
|
return iface->status == PATTY_AX25_IF_UP?
|
||||||
|
iface->driver->ready(iface->phy, fds): 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t patty_ax25_if_fill(patty_ax25_if *iface) {
|
ssize_t patty_ax25_if_fill(patty_ax25_if *iface) {
|
||||||
|
|
|
@ -2087,7 +2087,13 @@ static int handle_ifaces(patty_ax25_server *server) {
|
||||||
struct if_entry *entry = item->value;
|
struct if_entry *entry = item->value;
|
||||||
|
|
||||||
if (handle_iface(server, entry) < 0) {
|
if (handle_iface(server, entry) < 0) {
|
||||||
goto error_io;
|
if (errno == EIO) {
|
||||||
|
patty_ax25_if_down(entry->iface);
|
||||||
|
|
||||||
|
fd_clear(server, entry->fd);
|
||||||
|
} else {
|
||||||
|
goto error_io;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
item = item->next;
|
item = item->next;
|
||||||
|
|
Loading…
Add table
Reference in a new issue