Merge pull request #15757 from maribu/sock-aux-cleanup

sys/net/gnrc/sock: cleanup & fix aux handling
This commit is contained in:
Marian Buschsieweke 2021-01-12 22:57:21 +01:00 committed by GitHub
commit 9029d6f7c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 17 deletions

View File

@ -158,18 +158,13 @@ ssize_t sock_ip_recv_buf_aux(sock_ip_t *sock, void **data, void **buf_ctx,
return -EPROTO; return -EPROTO;
} }
#if IS_USED(MODULE_SOCK_AUX_LOCAL) #if IS_USED(MODULE_SOCK_AUX_LOCAL)
if ((aux != NULL) && (aux->flags & SOCK_AUX_GET_LOCAL)) { if (aux != NULL) {
aux->flags &= ~(SOCK_AUX_GET_LOCAL); aux->flags &= ~(SOCK_AUX_GET_LOCAL);
} }
#endif #endif
#if IS_USED(MODULE_SOCK_AUX_TIMESTAMP) #if IS_USED(MODULE_SOCK_AUX_TIMESTAMP)
if ((aux != NULL) && (aux->flags & SOCK_AUX_GET_TIMESTAMP)) { if ((aux != NULL) && (_aux.flags & GNRC_SOCK_RECV_AUX_FLAG_TIMESTAMP)) {
/* check if network interface did provide a timestamp; this depends on aux->flags &= ~(SOCK_AUX_GET_TIMESTAMP);
* hardware support. A timestamp of zero is used to indicate a missing
* timestamp */
if (aux->timestamp > 0) {
aux->flags &= ~SOCK_AUX_GET_TIMESTAMP;
}
} }
#endif #endif
*data = pkt->data; *data = pkt->data;

View File

@ -258,13 +258,8 @@ ssize_t sock_udp_recv_buf_aux(sock_udp_t *sock, void **data, void **buf_ctx,
} }
#endif #endif
#if IS_USED(MODULE_SOCK_AUX_TIMESTAMP) #if IS_USED(MODULE_SOCK_AUX_TIMESTAMP)
if ((aux != NULL) && (aux->flags & SOCK_AUX_GET_TIMESTAMP)) { if ((aux != NULL) && (_aux.flags & GNRC_SOCK_RECV_AUX_FLAG_TIMESTAMP)) {
/* check if network interface did provide a timestamp; this depends on aux->flags &= ~SOCK_AUX_GET_TIMESTAMP;
* hardware support. A timestamp of zero is used to indicate a missing
* timestamp */
if (_aux.flags & GNRC_SOCK_RECV_AUX_FLAG_TIMESTAMP) {
aux->flags &= ~SOCK_AUX_GET_TIMESTAMP;
}
} }
#endif #endif
*data = pkt->data; *data = pkt->data;

View File

@ -7,7 +7,7 @@ ifeq (1, $(AUX_LOCAL))
USEMODULE += sock_aux_local USEMODULE += sock_aux_local
endif endif
ifeq (1, $(AUX_LOCAL)) ifeq (1, $(AUX_TIMESTAMP))
USEMODULE += sock_aux_timestamp USEMODULE += sock_aux_timestamp
endif endif

View File

@ -7,7 +7,7 @@ ifeq (1, $(AUX_LOCAL))
USEMODULE += sock_aux_local USEMODULE += sock_aux_local
endif endif
ifeq (1, $(AUX_LOCAL)) ifeq (1, $(AUX_TIMESTAMP))
USEMODULE += sock_aux_timestamp USEMODULE += sock_aux_timestamp
endif endif