Fix address writing
This commit is contained in:
parent
cec916a44a
commit
d983672619
2 changed files with 4 additions and 5 deletions
|
@ -1041,6 +1041,7 @@ static int handle_packet_rx(patty_ax25_server *server,
|
||||||
if (PATTY_AX25_CONTROL_UNNUMBERED_SABM(frame.control)) {
|
if (PATTY_AX25_CONTROL_UNNUMBERED_SABM(frame.control)) {
|
||||||
fprintf(stderr, "Got SABM packet\n");
|
fprintf(stderr, "Got SABM packet\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO: Handle inbound packet
|
* TODO: Handle inbound packet
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -41,12 +41,10 @@ static size_t copy_addr_to_buf(patty_ax25_sock *sock, uint8_t *buf, size_t offse
|
||||||
for (i=0; i<sock->hops; i++) {
|
for (i=0; i<sock->hops; i++) {
|
||||||
memcpy(&buf[offset], &sock->repeaters[i], sizeof(patty_ax25_addr));
|
memcpy(&buf[offset], &sock->repeaters[i], sizeof(patty_ax25_addr));
|
||||||
offset += sizeof(patty_ax25_addr);
|
offset += sizeof(patty_ax25_addr);
|
||||||
|
|
||||||
if (i == sock->hops - 1) {
|
|
||||||
buf[offset - 1] |= 0x01;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buf[offset - 1] |= 0x01;
|
||||||
|
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,8 +54,8 @@ int patty_ax25_sock_send_sabm(patty_ax25_sock *sock) {
|
||||||
|
|
||||||
offset = copy_addr_to_buf(sock, buf, offset);
|
offset = copy_addr_to_buf(sock, buf, offset);
|
||||||
|
|
||||||
buf[offset++] = PATTY_AX25_PROTO_NONE;
|
|
||||||
buf[offset++] = 0x3f;
|
buf[offset++] = 0x3f;
|
||||||
|
buf[offset++] = PATTY_AX25_PROTO_NONE;
|
||||||
|
|
||||||
return patty_ax25_if_send(sock->iface,
|
return patty_ax25_if_send(sock->iface,
|
||||||
buf,
|
buf,
|
||||||
|
|
Loading…
Add table
Reference in a new issue