Adhere to proper P/F procedure
Adhere to proper P/F procedure for SABM, I, and DISC frames
This commit is contained in:
parent
1265108efd
commit
566f302a1f
1 changed files with 22 additions and 5 deletions
27
src/server.c
27
src/server.c
|
@ -1095,8 +1095,10 @@ static int handle_sabm(patty_ax25_server *server,
|
|||
goto error_sock_delete_by_addr;
|
||||
}
|
||||
|
||||
if (reply_ua(iface, frame, PATTY_AX25_FRAME_FINAL) < 0) {
|
||||
goto error_reply_ua;
|
||||
if (frame->pf) {
|
||||
if (reply_ua(iface, frame, PATTY_AX25_FRAME_FINAL) < 0) {
|
||||
goto error_reply_ua;
|
||||
}
|
||||
}
|
||||
|
||||
memset(&response, '\0', sizeof(response));
|
||||
|
@ -1231,7 +1233,7 @@ static int handle_i(patty_ax25_server *server,
|
|||
patty_ax25_sock *sock,
|
||||
patty_ax25_frame *frame) {
|
||||
if (sock == NULL || sock->status != PATTY_AX25_SOCK_ESTABLISHED) {
|
||||
return reply_dm(iface, frame, PATTY_AX25_FRAME_FINAL);
|
||||
return frame->pf? reply_dm(iface, frame, PATTY_AX25_FRAME_FINAL): 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1243,7 +1245,18 @@ static int handle_i(patty_ax25_server *server,
|
|||
return patty_ax25_sock_send_rej(sock);
|
||||
}
|
||||
|
||||
return write(sock->fd, frame->info, frame->infolen);
|
||||
if (write(sock->fd, frame->info, frame->infolen) < 0) {
|
||||
goto error_write;
|
||||
}
|
||||
|
||||
if (frame->pf) {
|
||||
return patty_ax25_sock_send_rr(sock);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
error_write:
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int handle_disc(patty_ax25_server *server,
|
||||
|
@ -1261,7 +1274,11 @@ static int handle_disc(patty_ax25_server *server,
|
|||
goto error_sock_delete;
|
||||
}
|
||||
|
||||
return reply_dm(iface, frame, PATTY_AX25_FRAME_FINAL);
|
||||
if (frame->pf) {
|
||||
return reply_dm(iface, frame, PATTY_AX25_FRAME_FINAL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
error_sock_delete:
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Reference in a new issue