Disregard TEST, UA and XID not addressed to iface
This commit is contained in:
parent
222e51100e
commit
bdbab9c5e7
3 changed files with 40 additions and 0 deletions
|
@ -90,6 +90,9 @@ int patty_ax25_if_addr_add(patty_ax25_if *iface, const char *callsign);
|
||||||
|
|
||||||
int patty_ax25_if_addr_delete(patty_ax25_if *iface, const char *callsign);
|
int patty_ax25_if_addr_delete(patty_ax25_if *iface, const char *callsign);
|
||||||
|
|
||||||
|
int patty_ax25_if_addr_match(patty_ax25_if *iface,
|
||||||
|
const patty_ax25_addr *addr);
|
||||||
|
|
||||||
int patty_ax25_if_promisc_add(patty_ax25_if *iface,
|
int patty_ax25_if_promisc_add(patty_ax25_if *iface,
|
||||||
int fd);
|
int fd);
|
||||||
|
|
||||||
|
|
25
src/if.c
25
src/if.c
|
@ -269,6 +269,31 @@ error_ntop:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int patty_ax25_if_addr_match(patty_ax25_if *iface,
|
||||||
|
const patty_ax25_addr *addr) {
|
||||||
|
patty_list_item *item;
|
||||||
|
|
||||||
|
if (memcmp(&iface->addr.callsign,
|
||||||
|
&addr->callsign,
|
||||||
|
sizeof(addr->callsign)) == 0) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
item = iface->aliases->first;
|
||||||
|
|
||||||
|
while ((item = item->next) != NULL) {
|
||||||
|
patty_ax25_addr *alias = item->value;
|
||||||
|
|
||||||
|
if (memcmp(&alias->callsign,
|
||||||
|
&addr->callsign,
|
||||||
|
sizeof(addr->callsign)) == 0) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int patty_ax25_if_promisc_add(patty_ax25_if *iface,
|
int patty_ax25_if_promisc_add(patty_ax25_if *iface,
|
||||||
int fd) {
|
int fd) {
|
||||||
if (patty_dict_get(iface->promisc_fds, (uint32_t)fd)) {
|
if (patty_dict_get(iface->promisc_fds, (uint32_t)fd)) {
|
||||||
|
|
12
src/server.c
12
src/server.c
|
@ -1417,6 +1417,10 @@ error_client_by_sock:
|
||||||
static int handle_test(patty_ax25_server *server,
|
static int handle_test(patty_ax25_server *server,
|
||||||
patty_ax25_if *iface,
|
patty_ax25_if *iface,
|
||||||
patty_ax25_frame *frame) {
|
patty_ax25_frame *frame) {
|
||||||
|
if (!patty_ax25_if_addr_match(iface, &frame->dest)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return reply_test(iface, frame);
|
return reply_test(iface, frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1426,6 +1430,10 @@ static int handle_ua(patty_ax25_server *server,
|
||||||
patty_ax25_frame *frame) {
|
patty_ax25_frame *frame) {
|
||||||
int client;
|
int client;
|
||||||
|
|
||||||
|
if (!patty_ax25_if_addr_match(iface, &frame->dest)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (sock == NULL) {
|
if (sock == NULL) {
|
||||||
return reply_dm(iface, frame, PATTY_AX25_FRAME_FINAL);
|
return reply_dm(iface, frame, PATTY_AX25_FRAME_FINAL);
|
||||||
}
|
}
|
||||||
|
@ -1783,6 +1791,10 @@ static int handle_xid(patty_ax25_server *server,
|
||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (!patty_ax25_if_addr_match(iface, &frame->dest)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (patty_ax25_frame_decode_xid(¶ms, buf, offset, len) < 0) {
|
if (patty_ax25_frame_decode_xid(¶ms, buf, offset, len) < 0) {
|
||||||
goto error_io;
|
goto error_io;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue