Ensure XID frame response is encoded as responses

Changes:

    * Modify patty_ax25_sock_send_xid() to require the 'cr' argument,
      which specifies whether the frame address field is to be encoded
      with the 'command' or 'response' bits set as appropriate
This commit is contained in:
XANTRONIX Development 2020-07-21 01:41:32 -04:00 committed by XANTRONIX Industrial
parent 0fa6a29024
commit 6711f37ab9
3 changed files with 7 additions and 5 deletions

View file

@ -130,7 +130,8 @@ ssize_t patty_ax25_sock_send_sabme(patty_ax25_sock *sock, int pf);
ssize_t patty_ax25_sock_send_disc(patty_ax25_sock *sock, int pf); ssize_t patty_ax25_sock_send_disc(patty_ax25_sock *sock, int pf);
ssize_t patty_ax25_sock_send_xid(patty_ax25_sock *sock); ssize_t patty_ax25_sock_send_xid(patty_ax25_sock *sock,
enum patty_ax25_frame_cr cr);
ssize_t patty_ax25_sock_write(patty_ax25_sock *sock, ssize_t patty_ax25_sock_write(patty_ax25_sock *sock,
void *buf, void *buf,

View file

@ -772,7 +772,7 @@ static int server_connect(patty_ax25_server *server,
* Send an XID frame, to attempt to negotiate AX.25 v2.2 and its default * Send an XID frame, to attempt to negotiate AX.25 v2.2 and its default
* parameters. * parameters.
*/ */
if (patty_ax25_sock_send_xid(sock) < 0) { if (patty_ax25_sock_send_xid(sock, PATTY_AX25_FRAME_COMMAND) < 0) {
response.ret = -1; response.ret = -1;
response.eno = errno; response.eno = errno;
@ -1396,7 +1396,7 @@ static int handle_xid(patty_ax25_server *server,
goto error_sock_save_by_fd; goto error_sock_save_by_fd;
} }
return patty_ax25_sock_send_xid(remote); return patty_ax25_sock_send_xid(remote, PATTY_AX25_FRAME_RESPONSE);
} }
return reply_dm(iface, frame, PATTY_AX25_FRAME_FINAL); return reply_dm(iface, frame, PATTY_AX25_FRAME_FINAL);

View file

@ -497,7 +497,8 @@ ssize_t patty_ax25_sock_send_disc(patty_ax25_sock *sock, int pf) {
0); 0);
} }
ssize_t patty_ax25_sock_send_xid(patty_ax25_sock *sock) { ssize_t patty_ax25_sock_send_xid(patty_ax25_sock *sock,
enum patty_ax25_frame_cr cr) {
patty_ax25_params params; patty_ax25_params params;
char buf[256]; char buf[256];
@ -540,7 +541,7 @@ ssize_t patty_ax25_sock_send_xid(patty_ax25_sock *sock) {
} }
return patty_ax25_sock_send(sock, return patty_ax25_sock_send(sock,
PATTY_AX25_FRAME_COMMAND, cr,
control_u(PATTY_AX25_FRAME_XID, 0), control_u(PATTY_AX25_FRAME_XID, 0),
buf, buf,
encoded); encoded);