mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-04-15 23:42:33 +00:00
Work on task #14780: Add debug helper asserts to ensure threading/locking requirements are met
Add LWIP_ASSERT_CORE_LOCKED() to several more places
This commit is contained in:
parent
67ad6e45db
commit
653313cb37
@ -2628,6 +2628,8 @@ httpd_init(void)
|
|||||||
#endif
|
#endif
|
||||||
LWIP_DEBUGF(HTTPD_DEBUG, ("httpd_init\n"));
|
LWIP_DEBUGF(HTTPD_DEBUG, ("httpd_init\n"));
|
||||||
|
|
||||||
|
/* LWIP_ASSERT_CORE_LOCKED(); is checked by udp_new() */
|
||||||
|
|
||||||
pcb = altcp_tcp_new_ip_type(IPADDR_TYPE_ANY);
|
pcb = altcp_tcp_new_ip_type(IPADDR_TYPE_ANY);
|
||||||
LWIP_ASSERT("httpd_init: tcp_new failed", pcb != NULL);
|
LWIP_ASSERT("httpd_init: tcp_new failed", pcb != NULL);
|
||||||
httpd_init_pcb(pcb, HTTPD_SERVER_PORT);
|
httpd_init_pcb(pcb, HTTPD_SERVER_PORT);
|
||||||
|
@ -594,6 +594,8 @@ lwiperf_start_tcp_server(const ip_addr_t *local_addr, u16_t local_port,
|
|||||||
struct tcp_pcb *pcb;
|
struct tcp_pcb *pcb;
|
||||||
lwiperf_state_tcp_t *s;
|
lwiperf_state_tcp_t *s;
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
|
|
||||||
if (local_addr == NULL) {
|
if (local_addr == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -640,6 +642,8 @@ lwiperf_abort(void *lwiperf_session)
|
|||||||
{
|
{
|
||||||
lwiperf_state_base_t *i, *dealloc, *last = NULL;
|
lwiperf_state_base_t *i, *dealloc, *last = NULL;
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
|
|
||||||
for (i = lwiperf_all_connections; i != NULL; ) {
|
for (i = lwiperf_all_connections; i != NULL; ) {
|
||||||
if ((i == lwiperf_session) || (i->related_server_state == lwiperf_session)) {
|
if ((i == lwiperf_session) || (i->related_server_state == lwiperf_session)) {
|
||||||
dealloc = i;
|
dealloc = i;
|
||||||
|
@ -1891,6 +1891,7 @@ mdns_resp_add_netif(struct netif *netif, const char *hostname, u32_t dns_ttl)
|
|||||||
err_t res;
|
err_t res;
|
||||||
struct mdns_host *mdns;
|
struct mdns_host *mdns;
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
LWIP_ERROR("mdns_resp_add_netif: netif != NULL", (netif != NULL), return ERR_VAL);
|
LWIP_ERROR("mdns_resp_add_netif: netif != NULL", (netif != NULL), return ERR_VAL);
|
||||||
LWIP_ERROR("mdns_resp_add_netif: Hostname too long", (strlen(hostname) <= MDNS_LABEL_MAXLEN), return ERR_VAL);
|
LWIP_ERROR("mdns_resp_add_netif: Hostname too long", (strlen(hostname) <= MDNS_LABEL_MAXLEN), return ERR_VAL);
|
||||||
|
|
||||||
@ -1938,6 +1939,7 @@ mdns_resp_remove_netif(struct netif *netif)
|
|||||||
int i;
|
int i;
|
||||||
struct mdns_host *mdns;
|
struct mdns_host *mdns;
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
LWIP_ASSERT("mdns_resp_remove_netif: Null pointer", netif);
|
LWIP_ASSERT("mdns_resp_remove_netif: Null pointer", netif);
|
||||||
mdns = NETIF_TO_HOST(netif);
|
mdns = NETIF_TO_HOST(netif);
|
||||||
LWIP_ERROR("mdns_resp_remove_netif: Not an active netif", (mdns != NULL), return ERR_VAL);
|
LWIP_ERROR("mdns_resp_remove_netif: Not an active netif", (mdns != NULL), return ERR_VAL);
|
||||||
@ -1986,6 +1988,7 @@ mdns_resp_add_service(struct netif *netif, const char *name, const char *service
|
|||||||
struct mdns_service *srv;
|
struct mdns_service *srv;
|
||||||
struct mdns_host *mdns;
|
struct mdns_host *mdns;
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
LWIP_ASSERT("mdns_resp_add_service: netif != NULL", netif);
|
LWIP_ASSERT("mdns_resp_add_service: netif != NULL", netif);
|
||||||
mdns = NETIF_TO_HOST(netif);
|
mdns = NETIF_TO_HOST(netif);
|
||||||
LWIP_ERROR("mdns_resp_add_service: Not an mdns netif", (mdns != NULL), return ERR_VAL);
|
LWIP_ERROR("mdns_resp_add_service: Not an mdns netif", (mdns != NULL), return ERR_VAL);
|
||||||
@ -2054,6 +2057,7 @@ mdns_resp_del_service(struct netif *netif, s8_t slot)
|
|||||||
err_t
|
err_t
|
||||||
mdns_resp_add_service_txtitem(struct mdns_service *service, const char *txt, u8_t txt_len)
|
mdns_resp_add_service_txtitem(struct mdns_service *service, const char *txt, u8_t txt_len)
|
||||||
{
|
{
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
LWIP_ASSERT("mdns_resp_add_service_txtitem: service != NULL", service);
|
LWIP_ASSERT("mdns_resp_add_service_txtitem: service != NULL", service);
|
||||||
|
|
||||||
/* Use a mdns_domain struct to store txt chunks since it is the same encoding */
|
/* Use a mdns_domain struct to store txt chunks since it is the same encoding */
|
||||||
@ -2068,6 +2072,7 @@ mdns_resp_add_service_txtitem(struct mdns_service *service, const char *txt, u8_
|
|||||||
void
|
void
|
||||||
mdns_resp_announce(struct netif *netif)
|
mdns_resp_announce(struct netif *netif)
|
||||||
{
|
{
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
LWIP_ERROR("mdns_resp_announce: netif != NULL", (netif != NULL), return);
|
LWIP_ERROR("mdns_resp_announce: netif != NULL", (netif != NULL), return);
|
||||||
|
|
||||||
if (NETIF_TO_HOST(netif) == NULL) {
|
if (NETIF_TO_HOST(netif) == NULL) {
|
||||||
@ -2094,6 +2099,8 @@ mdns_resp_init(void)
|
|||||||
{
|
{
|
||||||
err_t res;
|
err_t res;
|
||||||
|
|
||||||
|
/* LWIP_ASSERT_CORE_LOCKED(); is checked by udp_new() */
|
||||||
|
|
||||||
mdns_pcb = udp_new_ip_type(IPADDR_TYPE_ANY);
|
mdns_pcb = udp_new_ip_type(IPADDR_TYPE_ANY);
|
||||||
LWIP_ASSERT("Failed to allocate pcb", mdns_pcb != NULL);
|
LWIP_ASSERT("Failed to allocate pcb", mdns_pcb != NULL);
|
||||||
#if LWIP_MULTICAST_TX_OPTIONS
|
#if LWIP_MULTICAST_TX_OPTIONS
|
||||||
|
@ -1064,6 +1064,7 @@ mqtt_publish(mqtt_client_t *client, const char *topic, const void *payload, u16_
|
|||||||
u16_t topic_len;
|
u16_t topic_len;
|
||||||
u16_t remaining_length;
|
u16_t remaining_length;
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
LWIP_ASSERT("mqtt_publish: client != NULL", client);
|
LWIP_ASSERT("mqtt_publish: client != NULL", client);
|
||||||
LWIP_ASSERT("mqtt_publish: topic != NULL", topic);
|
LWIP_ASSERT("mqtt_publish: topic != NULL", topic);
|
||||||
LWIP_ERROR("mqtt_publish: TCP disconnected", (client->conn_state != TCP_DISCONNECTED), return ERR_CONN);
|
LWIP_ERROR("mqtt_publish: TCP disconnected", (client->conn_state != TCP_DISCONNECTED), return ERR_CONN);
|
||||||
@ -1138,6 +1139,7 @@ mqtt_sub_unsub(mqtt_client_t *client, const char *topic, u8_t qos, mqtt_request_
|
|||||||
u16_t pkt_id;
|
u16_t pkt_id;
|
||||||
struct mqtt_request_t *r;
|
struct mqtt_request_t *r;
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
LWIP_ASSERT("mqtt_sub_unsub: client != NULL", client);
|
LWIP_ASSERT("mqtt_sub_unsub: client != NULL", client);
|
||||||
LWIP_ASSERT("mqtt_sub_unsub: topic != NULL", topic);
|
LWIP_ASSERT("mqtt_sub_unsub: topic != NULL", topic);
|
||||||
|
|
||||||
@ -1196,6 +1198,7 @@ void
|
|||||||
mqtt_set_inpub_callback(mqtt_client_t *client, mqtt_incoming_publish_cb_t pub_cb,
|
mqtt_set_inpub_callback(mqtt_client_t *client, mqtt_incoming_publish_cb_t pub_cb,
|
||||||
mqtt_incoming_data_cb_t data_cb, void *arg)
|
mqtt_incoming_data_cb_t data_cb, void *arg)
|
||||||
{
|
{
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
LWIP_ASSERT("mqtt_set_inpub_callback: client != NULL", client != NULL);
|
LWIP_ASSERT("mqtt_set_inpub_callback: client != NULL", client != NULL);
|
||||||
client->data_cb = data_cb;
|
client->data_cb = data_cb;
|
||||||
client->pub_cb = pub_cb;
|
client->pub_cb = pub_cb;
|
||||||
@ -1210,6 +1213,7 @@ mqtt_set_inpub_callback(mqtt_client_t *client, mqtt_incoming_publish_cb_t pub_cb
|
|||||||
mqtt_client_t *
|
mqtt_client_t *
|
||||||
mqtt_client_new(void)
|
mqtt_client_new(void)
|
||||||
{
|
{
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
return (mqtt_client_t *)mem_calloc(1, sizeof(mqtt_client_t));
|
return (mqtt_client_t *)mem_calloc(1, sizeof(mqtt_client_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1247,6 +1251,7 @@ mqtt_client_connect(mqtt_client_t *client, const ip_addr_t *ip_addr, u16_t port,
|
|||||||
u8_t flags = 0, will_topic_len = 0, will_msg_len = 0;
|
u8_t flags = 0, will_topic_len = 0, will_msg_len = 0;
|
||||||
u8_t client_user_len = 0, client_pass_len = 0;
|
u8_t client_user_len = 0, client_pass_len = 0;
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
LWIP_ASSERT("mqtt_client_connect: client != NULL", client != NULL);
|
LWIP_ASSERT("mqtt_client_connect: client != NULL", client != NULL);
|
||||||
LWIP_ASSERT("mqtt_client_connect: ip_addr != NULL", ip_addr != NULL);
|
LWIP_ASSERT("mqtt_client_connect: ip_addr != NULL", ip_addr != NULL);
|
||||||
LWIP_ASSERT("mqtt_client_connect: client_info != NULL", client_info != NULL);
|
LWIP_ASSERT("mqtt_client_connect: client_info != NULL", client_info != NULL);
|
||||||
@ -1394,6 +1399,7 @@ tcp_fail:
|
|||||||
void
|
void
|
||||||
mqtt_disconnect(mqtt_client_t *client)
|
mqtt_disconnect(mqtt_client_t *client)
|
||||||
{
|
{
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
LWIP_ASSERT("mqtt_disconnect: client != NULL", client);
|
LWIP_ASSERT("mqtt_disconnect: client != NULL", client);
|
||||||
/* If connection in not already closed */
|
/* If connection in not already closed */
|
||||||
if (client->conn_state != TCP_DISCONNECTED) {
|
if (client->conn_state != TCP_DISCONNECTED) {
|
||||||
@ -1412,6 +1418,7 @@ mqtt_disconnect(mqtt_client_t *client)
|
|||||||
u8_t
|
u8_t
|
||||||
mqtt_client_is_connected(mqtt_client_t *client)
|
mqtt_client_is_connected(mqtt_client_t *client)
|
||||||
{
|
{
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
LWIP_ASSERT("mqtt_client_is_connected: client != NULL", client);
|
LWIP_ASSERT("mqtt_client_is_connected: client != NULL", client);
|
||||||
return client->conn_state == MQTT_CONNECTED;
|
return client->conn_state == MQTT_CONNECTED;
|
||||||
}
|
}
|
||||||
|
@ -322,6 +322,7 @@ netbiosns_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t
|
|||||||
void
|
void
|
||||||
netbiosns_init(void)
|
netbiosns_init(void)
|
||||||
{
|
{
|
||||||
|
/* LWIP_ASSERT_CORE_LOCKED(); is checked by udp_new() */
|
||||||
#ifdef NETBIOS_LWIP_NAME
|
#ifdef NETBIOS_LWIP_NAME
|
||||||
LWIP_ASSERT("NetBIOS name is too long!", strlen(NETBIOS_LWIP_NAME) < NETBIOS_NAME_LEN);
|
LWIP_ASSERT("NetBIOS name is too long!", strlen(NETBIOS_LWIP_NAME) < NETBIOS_NAME_LEN);
|
||||||
#endif
|
#endif
|
||||||
@ -344,6 +345,7 @@ void
|
|||||||
netbiosns_set_name(const char *hostname)
|
netbiosns_set_name(const char *hostname)
|
||||||
{
|
{
|
||||||
size_t copy_len = strlen(hostname);
|
size_t copy_len = strlen(hostname);
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
LWIP_ASSERT("NetBIOS name is too long!", copy_len < NETBIOS_NAME_LEN);
|
LWIP_ASSERT("NetBIOS name is too long!", copy_len < NETBIOS_NAME_LEN);
|
||||||
if (copy_len >= NETBIOS_NAME_LEN) {
|
if (copy_len >= NETBIOS_NAME_LEN) {
|
||||||
copy_len = NETBIOS_NAME_LEN - 1;
|
copy_len = NETBIOS_NAME_LEN - 1;
|
||||||
@ -359,6 +361,7 @@ netbiosns_set_name(const char *hostname)
|
|||||||
void
|
void
|
||||||
netbiosns_stop(void)
|
netbiosns_stop(void)
|
||||||
{
|
{
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
if (netbiosns_pcb != NULL) {
|
if (netbiosns_pcb != NULL) {
|
||||||
udp_remove(netbiosns_pcb);
|
udp_remove(netbiosns_pcb);
|
||||||
netbiosns_pcb = NULL;
|
netbiosns_pcb = NULL;
|
||||||
|
@ -345,6 +345,9 @@ err_t
|
|||||||
smtp_set_server_addr(const char* server)
|
smtp_set_server_addr(const char* server)
|
||||||
{
|
{
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
|
|
||||||
if (server != NULL) {
|
if (server != NULL) {
|
||||||
/* strnlen: returns length WITHOUT terminating 0 byte OR
|
/* strnlen: returns length WITHOUT terminating 0 byte OR
|
||||||
* SMTP_MAX_SERVERNAME_LEN+1 when string is too long */
|
* SMTP_MAX_SERVERNAME_LEN+1 when string is too long */
|
||||||
@ -368,6 +371,7 @@ smtp_set_server_addr(const char* server)
|
|||||||
void
|
void
|
||||||
smtp_set_server_port(u16_t port)
|
smtp_set_server_port(u16_t port)
|
||||||
{
|
{
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
smtp_server_port = port;
|
smtp_server_port = port;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,6 +384,7 @@ smtp_set_server_port(u16_t port)
|
|||||||
void
|
void
|
||||||
smtp_set_tls_config(struct altcp_tls_config *tls_config)
|
smtp_set_tls_config(struct altcp_tls_config *tls_config)
|
||||||
{
|
{
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
smtp_server_tls_config = tls_config;
|
smtp_server_tls_config = tls_config;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -396,6 +401,8 @@ smtp_set_auth(const char* username, const char* pass)
|
|||||||
size_t uname_len = 0;
|
size_t uname_len = 0;
|
||||||
size_t pass_len = 0;
|
size_t pass_len = 0;
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
|
|
||||||
memset(smtp_auth_plain, 0xfa, 64);
|
memset(smtp_auth_plain, 0xfa, 64);
|
||||||
if (username != NULL) {
|
if (username != NULL) {
|
||||||
uname_len = strlen(username);
|
uname_len = strlen(username);
|
||||||
@ -586,6 +593,8 @@ smtp_send_mail(const char* from, const char* to, const char* subject, const char
|
|||||||
size_t mem_len = sizeof(struct smtp_session);
|
size_t mem_len = sizeof(struct smtp_session);
|
||||||
char *sfrom, *sto, *ssubject, *sbody;
|
char *sfrom, *sto, *ssubject, *sbody;
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
|
|
||||||
mem_len += from_len + to_len + subject_len + body_len + 4;
|
mem_len += from_len + to_len + subject_len + body_len + 4;
|
||||||
if (mem_len > 0xffff) {
|
if (mem_len > 0xffff) {
|
||||||
/* too long! */
|
/* too long! */
|
||||||
@ -634,6 +643,8 @@ smtp_send_mail_static(const char *from, const char* to, const char* subject,
|
|||||||
struct smtp_session* s;
|
struct smtp_session* s;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
|
|
||||||
s = (struct smtp_session*)SMTP_STATE_MALLOC(sizeof(struct smtp_session));
|
s = (struct smtp_session*)SMTP_STATE_MALLOC(sizeof(struct smtp_session));
|
||||||
if (s == NULL) {
|
if (s == NULL) {
|
||||||
return ERR_MEM;
|
return ERR_MEM;
|
||||||
@ -686,6 +697,7 @@ smtp_send_mail_int(void *arg)
|
|||||||
struct smtp_send_request *req = (struct smtp_send_request*)arg;
|
struct smtp_send_request *req = (struct smtp_send_request*)arg;
|
||||||
err_t err;
|
err_t err;
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
LWIP_ASSERT("smtp_send_mail_int: no argument given", arg != NULL);
|
LWIP_ASSERT("smtp_send_mail_int: no argument given", arg != NULL);
|
||||||
|
|
||||||
if (req->static_data) {
|
if (req->static_data) {
|
||||||
@ -1459,6 +1471,8 @@ smtp_send_mail_bodycback(const char *from, const char* to, const char* subject,
|
|||||||
struct smtp_session* s;
|
struct smtp_session* s;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
|
|
||||||
s = (struct smtp_session*)SMTP_STATE_MALLOC(sizeof(struct smtp_session));
|
s = (struct smtp_session*)SMTP_STATE_MALLOC(sizeof(struct smtp_session));
|
||||||
if (s == NULL) {
|
if (s == NULL) {
|
||||||
return ERR_MEM;
|
return ERR_MEM;
|
||||||
|
@ -235,6 +235,7 @@ static struct snmp_mib const *const *snmp_mibs = default_mibs;
|
|||||||
void
|
void
|
||||||
snmp_set_mibs(const struct snmp_mib **mibs, u8_t num_mibs)
|
snmp_set_mibs(const struct snmp_mib **mibs, u8_t num_mibs)
|
||||||
{
|
{
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
LWIP_ASSERT("mibs pointer must be != NULL", (mibs != NULL));
|
LWIP_ASSERT("mibs pointer must be != NULL", (mibs != NULL));
|
||||||
LWIP_ASSERT("num_mibs pointer must be != 0", (num_mibs != 0));
|
LWIP_ASSERT("num_mibs pointer must be != 0", (num_mibs != 0));
|
||||||
snmp_mibs = mibs;
|
snmp_mibs = mibs;
|
||||||
@ -257,6 +258,7 @@ snmp_set_mibs(const struct snmp_mib **mibs, u8_t num_mibs)
|
|||||||
*/
|
*/
|
||||||
void snmp_set_device_enterprise_oid(const struct snmp_obj_id *device_enterprise_oid)
|
void snmp_set_device_enterprise_oid(const struct snmp_obj_id *device_enterprise_oid)
|
||||||
{
|
{
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
if (device_enterprise_oid == NULL) {
|
if (device_enterprise_oid == NULL) {
|
||||||
snmp_device_enterprise_oid = &snmp_device_enterprise_oid_default;
|
snmp_device_enterprise_oid = &snmp_device_enterprise_oid_default;
|
||||||
} else {
|
} else {
|
||||||
@ -270,6 +272,7 @@ void snmp_set_device_enterprise_oid(const struct snmp_obj_id *device_enterprise_
|
|||||||
*/
|
*/
|
||||||
const struct snmp_obj_id *snmp_get_device_enterprise_oid(void)
|
const struct snmp_obj_id *snmp_get_device_enterprise_oid(void)
|
||||||
{
|
{
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
return snmp_device_enterprise_oid;
|
return snmp_device_enterprise_oid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,6 +177,7 @@ snmp_get_community(void)
|
|||||||
void
|
void
|
||||||
snmp_set_community(const char *const community)
|
snmp_set_community(const char *const community)
|
||||||
{
|
{
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
LWIP_ASSERT("community string is too long!", strlen(community) <= SNMP_MAX_COMMUNITY_STR_LEN);
|
LWIP_ASSERT("community string is too long!", strlen(community) <= SNMP_MAX_COMMUNITY_STR_LEN);
|
||||||
snmp_community = community;
|
snmp_community = community;
|
||||||
}
|
}
|
||||||
@ -214,6 +215,7 @@ snmp_get_community_trap(void)
|
|||||||
void
|
void
|
||||||
snmp_set_community_write(const char *const community)
|
snmp_set_community_write(const char *const community)
|
||||||
{
|
{
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
LWIP_ASSERT("community string must not be NULL", community != NULL);
|
LWIP_ASSERT("community string must not be NULL", community != NULL);
|
||||||
LWIP_ASSERT("community string is too long!", strlen(community) <= SNMP_MAX_COMMUNITY_STR_LEN);
|
LWIP_ASSERT("community string is too long!", strlen(community) <= SNMP_MAX_COMMUNITY_STR_LEN);
|
||||||
snmp_community_write = community;
|
snmp_community_write = community;
|
||||||
@ -230,6 +232,7 @@ snmp_set_community_write(const char *const community)
|
|||||||
void
|
void
|
||||||
snmp_set_community_trap(const char *const community)
|
snmp_set_community_trap(const char *const community)
|
||||||
{
|
{
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
LWIP_ASSERT("community string is too long!", strlen(community) <= SNMP_MAX_COMMUNITY_STR_LEN);
|
LWIP_ASSERT("community string is too long!", strlen(community) <= SNMP_MAX_COMMUNITY_STR_LEN);
|
||||||
snmp_community_trap = community;
|
snmp_community_trap = community;
|
||||||
}
|
}
|
||||||
@ -241,6 +244,7 @@ snmp_set_community_trap(const char *const community)
|
|||||||
void
|
void
|
||||||
snmp_set_write_callback(snmp_write_callback_fct write_callback, void *callback_arg)
|
snmp_set_write_callback(snmp_write_callback_fct write_callback, void *callback_arg)
|
||||||
{
|
{
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
snmp_write_callback = write_callback;
|
snmp_write_callback = write_callback;
|
||||||
snmp_write_callback_arg = callback_arg;
|
snmp_write_callback_arg = callback_arg;
|
||||||
}
|
}
|
||||||
|
@ -116,6 +116,7 @@ snmp_get_local_ip_for_dst(void *handle, const ip_addr_t *dst, ip_addr_t *result)
|
|||||||
void
|
void
|
||||||
snmp_init(void)
|
snmp_init(void)
|
||||||
{
|
{
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
sys_thread_new("snmp_netconn", snmp_netconn_thread, NULL, SNMP_STACK_SIZE, SNMP_THREAD_PRIO);
|
sys_thread_new("snmp_netconn", snmp_netconn_thread, NULL, SNMP_STACK_SIZE, SNMP_THREAD_PRIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,6 +91,8 @@ snmp_init(void)
|
|||||||
struct udp_pcb *snmp_pcb = udp_new_ip_type(IPADDR_TYPE_ANY);
|
struct udp_pcb *snmp_pcb = udp_new_ip_type(IPADDR_TYPE_ANY);
|
||||||
LWIP_ERROR("snmp_raw: no PCB", (snmp_pcb != NULL), return;);
|
LWIP_ERROR("snmp_raw: no PCB", (snmp_pcb != NULL), return;);
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
|
|
||||||
snmp_traps_handle = snmp_pcb;
|
snmp_traps_handle = snmp_pcb;
|
||||||
|
|
||||||
udp_recv(snmp_pcb, snmp_recv, NULL);
|
udp_recv(snmp_pcb, snmp_recv, NULL);
|
||||||
|
@ -111,6 +111,7 @@ static u8_t snmp_auth_traps_enabled = 0;
|
|||||||
void
|
void
|
||||||
snmp_trap_dst_enable(u8_t dst_idx, u8_t enable)
|
snmp_trap_dst_enable(u8_t dst_idx, u8_t enable)
|
||||||
{
|
{
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
if (dst_idx < SNMP_TRAP_DESTINATIONS) {
|
if (dst_idx < SNMP_TRAP_DESTINATIONS) {
|
||||||
trap_dst[dst_idx].enable = enable;
|
trap_dst[dst_idx].enable = enable;
|
||||||
}
|
}
|
||||||
@ -125,6 +126,7 @@ snmp_trap_dst_enable(u8_t dst_idx, u8_t enable)
|
|||||||
void
|
void
|
||||||
snmp_trap_dst_ip_set(u8_t dst_idx, const ip_addr_t *dst)
|
snmp_trap_dst_ip_set(u8_t dst_idx, const ip_addr_t *dst)
|
||||||
{
|
{
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
if (dst_idx < SNMP_TRAP_DESTINATIONS) {
|
if (dst_idx < SNMP_TRAP_DESTINATIONS) {
|
||||||
ip_addr_set(&trap_dst[dst_idx].dip, dst);
|
ip_addr_set(&trap_dst[dst_idx].dip, dst);
|
||||||
}
|
}
|
||||||
@ -176,6 +178,8 @@ snmp_send_trap(const struct snmp_obj_id *eoid, s32_t generic_trap, s32_t specifi
|
|||||||
u16_t i, tot_len;
|
u16_t i, tot_len;
|
||||||
err_t err = ERR_OK;
|
err_t err = ERR_OK;
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
|
|
||||||
trap_msg.snmp_version = 0;
|
trap_msg.snmp_version = 0;
|
||||||
|
|
||||||
for (i = 0, td = &trap_dst[0]; i < SNMP_TRAP_DESTINATIONS; i++, td++) {
|
for (i = 0, td = &trap_dst[0]; i < SNMP_TRAP_DESTINATIONS; i++, td++) {
|
||||||
|
@ -634,6 +634,8 @@ sntp_request(void *arg)
|
|||||||
void
|
void
|
||||||
sntp_init(void)
|
sntp_init(void)
|
||||||
{
|
{
|
||||||
|
/* LWIP_ASSERT_CORE_LOCKED(); is checked by udp_new() */
|
||||||
|
|
||||||
#ifdef SNTP_SERVER_ADDRESS
|
#ifdef SNTP_SERVER_ADDRESS
|
||||||
#if SNTP_SERVER_DNS
|
#if SNTP_SERVER_DNS
|
||||||
sntp_setservername(0, SNTP_SERVER_ADDRESS);
|
sntp_setservername(0, SNTP_SERVER_ADDRESS);
|
||||||
@ -670,6 +672,7 @@ sntp_init(void)
|
|||||||
void
|
void
|
||||||
sntp_stop(void)
|
sntp_stop(void)
|
||||||
{
|
{
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
if (sntp_pcb != NULL) {
|
if (sntp_pcb != NULL) {
|
||||||
sys_untimeout(sntp_request, NULL);
|
sys_untimeout(sntp_request, NULL);
|
||||||
sys_untimeout(sntp_try_next_server, NULL);
|
sys_untimeout(sntp_try_next_server, NULL);
|
||||||
@ -695,6 +698,7 @@ u8_t sntp_enabled(void)
|
|||||||
void
|
void
|
||||||
sntp_setoperatingmode(u8_t operating_mode)
|
sntp_setoperatingmode(u8_t operating_mode)
|
||||||
{
|
{
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
LWIP_ASSERT("Invalid operating mode", operating_mode <= SNTP_OPMODE_LISTENONLY);
|
LWIP_ASSERT("Invalid operating mode", operating_mode <= SNTP_OPMODE_LISTENONLY);
|
||||||
LWIP_ASSERT("Operating mode must not be set while SNTP client is running", sntp_pcb == NULL);
|
LWIP_ASSERT("Operating mode must not be set while SNTP client is running", sntp_pcb == NULL);
|
||||||
sntp_opmode = operating_mode;
|
sntp_opmode = operating_mode;
|
||||||
@ -718,6 +722,7 @@ sntp_getoperatingmode(void)
|
|||||||
void
|
void
|
||||||
sntp_servermode_dhcp(int set_servers_from_dhcp)
|
sntp_servermode_dhcp(int set_servers_from_dhcp)
|
||||||
{
|
{
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
u8_t new_mode = set_servers_from_dhcp ? 1 : 0;
|
u8_t new_mode = set_servers_from_dhcp ? 1 : 0;
|
||||||
if (sntp_set_servers_from_dhcp != new_mode) {
|
if (sntp_set_servers_from_dhcp != new_mode) {
|
||||||
sntp_set_servers_from_dhcp = new_mode;
|
sntp_set_servers_from_dhcp = new_mode;
|
||||||
@ -735,6 +740,7 @@ sntp_servermode_dhcp(int set_servers_from_dhcp)
|
|||||||
void
|
void
|
||||||
sntp_setserver(u8_t idx, const ip_addr_t *server)
|
sntp_setserver(u8_t idx, const ip_addr_t *server)
|
||||||
{
|
{
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
if (idx < SNTP_MAX_SERVERS) {
|
if (idx < SNTP_MAX_SERVERS) {
|
||||||
if (server != NULL) {
|
if (server != NULL) {
|
||||||
sntp_servers[idx].addr = (*server);
|
sntp_servers[idx].addr = (*server);
|
||||||
@ -801,6 +807,7 @@ sntp_getserver(u8_t idx)
|
|||||||
void
|
void
|
||||||
sntp_setservername(u8_t idx, const char *server)
|
sntp_setservername(u8_t idx, const char *server)
|
||||||
{
|
{
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
if (idx < SNTP_MAX_SERVERS) {
|
if (idx < SNTP_MAX_SERVERS) {
|
||||||
sntp_servers[idx].name = server;
|
sntp_servers[idx].name = server;
|
||||||
}
|
}
|
||||||
|
@ -388,6 +388,7 @@ tftp_init(const struct tftp_context *ctx)
|
|||||||
{
|
{
|
||||||
err_t ret;
|
err_t ret;
|
||||||
|
|
||||||
|
/* LWIP_ASSERT_CORE_LOCKED(); is checked by udp_new() */
|
||||||
struct udp_pcb *pcb = udp_new_ip_type(IPADDR_TYPE_ANY);
|
struct udp_pcb *pcb = udp_new_ip_type(IPADDR_TYPE_ANY);
|
||||||
if (pcb == NULL) {
|
if (pcb == NULL) {
|
||||||
return ERR_MEM;
|
return ERR_MEM;
|
||||||
|
@ -506,6 +506,7 @@ err_t
|
|||||||
etharp_add_static_entry(const ip4_addr_t *ipaddr, struct eth_addr *ethaddr)
|
etharp_add_static_entry(const ip4_addr_t *ipaddr, struct eth_addr *ethaddr)
|
||||||
{
|
{
|
||||||
struct netif *netif;
|
struct netif *netif;
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_add_static_entry: %"U16_F".%"U16_F".%"U16_F".%"U16_F" - %02"X16_F":%02"X16_F":%02"X16_F":%02"X16_F":%02"X16_F":%02"X16_F"\n",
|
LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_add_static_entry: %"U16_F".%"U16_F".%"U16_F".%"U16_F" - %02"X16_F":%02"X16_F":%02"X16_F":%02"X16_F":%02"X16_F":%02"X16_F"\n",
|
||||||
ip4_addr1_16(ipaddr), ip4_addr2_16(ipaddr), ip4_addr3_16(ipaddr), ip4_addr4_16(ipaddr),
|
ip4_addr1_16(ipaddr), ip4_addr2_16(ipaddr), ip4_addr3_16(ipaddr), ip4_addr4_16(ipaddr),
|
||||||
(u16_t)ethaddr->addr[0], (u16_t)ethaddr->addr[1], (u16_t)ethaddr->addr[2],
|
(u16_t)ethaddr->addr[0], (u16_t)ethaddr->addr[1], (u16_t)ethaddr->addr[2],
|
||||||
@ -531,6 +532,7 @@ err_t
|
|||||||
etharp_remove_static_entry(const ip4_addr_t *ipaddr)
|
etharp_remove_static_entry(const ip4_addr_t *ipaddr)
|
||||||
{
|
{
|
||||||
s8_t i;
|
s8_t i;
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_remove_static_entry: %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n",
|
LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_remove_static_entry: %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n",
|
||||||
ip4_addr1_16(ipaddr), ip4_addr2_16(ipaddr), ip4_addr3_16(ipaddr), ip4_addr4_16(ipaddr)));
|
ip4_addr1_16(ipaddr), ip4_addr2_16(ipaddr), ip4_addr3_16(ipaddr), ip4_addr4_16(ipaddr)));
|
||||||
|
|
||||||
@ -646,6 +648,8 @@ etharp_input(struct pbuf *p, struct netif *netif)
|
|||||||
ip4_addr_t sipaddr, dipaddr;
|
ip4_addr_t sipaddr, dipaddr;
|
||||||
u8_t for_us;
|
u8_t for_us;
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
|
|
||||||
LWIP_ERROR("netif != NULL", (netif != NULL), return;);
|
LWIP_ERROR("netif != NULL", (netif != NULL), return;);
|
||||||
|
|
||||||
hdr = (struct etharp_hdr *)p->payload;
|
hdr = (struct etharp_hdr *)p->payload;
|
||||||
@ -793,6 +797,7 @@ etharp_output(struct netif *netif, struct pbuf *q, const ip4_addr_t *ipaddr)
|
|||||||
struct eth_addr mcastaddr;
|
struct eth_addr mcastaddr;
|
||||||
const ip4_addr_t *dst_addr = ipaddr;
|
const ip4_addr_t *dst_addr = ipaddr;
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
LWIP_ASSERT("netif != NULL", netif != NULL);
|
LWIP_ASSERT("netif != NULL", netif != NULL);
|
||||||
LWIP_ASSERT("q != NULL", q != NULL);
|
LWIP_ASSERT("q != NULL", q != NULL);
|
||||||
LWIP_ASSERT("ipaddr != NULL", ipaddr != NULL);
|
LWIP_ASSERT("ipaddr != NULL", ipaddr != NULL);
|
||||||
|
@ -451,6 +451,8 @@ igmp_joingroup(const ip4_addr_t *ifaddr, const ip4_addr_t *groupaddr)
|
|||||||
err_t err = ERR_VAL; /* no matching interface */
|
err_t err = ERR_VAL; /* no matching interface */
|
||||||
struct netif *netif;
|
struct netif *netif;
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
|
|
||||||
/* make sure it is multicast address */
|
/* make sure it is multicast address */
|
||||||
LWIP_ERROR("igmp_joingroup: attempt to join non-multicast address", ip4_addr_ismulticast(groupaddr), return ERR_VAL;);
|
LWIP_ERROR("igmp_joingroup: attempt to join non-multicast address", ip4_addr_ismulticast(groupaddr), return ERR_VAL;);
|
||||||
LWIP_ERROR("igmp_joingroup: attempt to join allsystems address", (!ip4_addr_cmp(groupaddr, &allsystems)), return ERR_VAL;);
|
LWIP_ERROR("igmp_joingroup: attempt to join allsystems address", (!ip4_addr_cmp(groupaddr, &allsystems)), return ERR_VAL;);
|
||||||
@ -484,6 +486,8 @@ igmp_joingroup_netif(struct netif *netif, const ip4_addr_t *groupaddr)
|
|||||||
{
|
{
|
||||||
struct igmp_group *group;
|
struct igmp_group *group;
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
|
|
||||||
/* make sure it is multicast address */
|
/* make sure it is multicast address */
|
||||||
LWIP_ERROR("igmp_joingroup_netif: attempt to join non-multicast address", ip4_addr_ismulticast(groupaddr), return ERR_VAL;);
|
LWIP_ERROR("igmp_joingroup_netif: attempt to join non-multicast address", ip4_addr_ismulticast(groupaddr), return ERR_VAL;);
|
||||||
LWIP_ERROR("igmp_joingroup_netif: attempt to join allsystems address", (!ip4_addr_cmp(groupaddr, &allsystems)), return ERR_VAL;);
|
LWIP_ERROR("igmp_joingroup_netif: attempt to join allsystems address", (!ip4_addr_cmp(groupaddr, &allsystems)), return ERR_VAL;);
|
||||||
@ -544,6 +548,8 @@ igmp_leavegroup(const ip4_addr_t *ifaddr, const ip4_addr_t *groupaddr)
|
|||||||
err_t err = ERR_VAL; /* no matching interface */
|
err_t err = ERR_VAL; /* no matching interface */
|
||||||
struct netif *netif;
|
struct netif *netif;
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
|
|
||||||
/* make sure it is multicast address */
|
/* make sure it is multicast address */
|
||||||
LWIP_ERROR("igmp_leavegroup: attempt to leave non-multicast address", ip4_addr_ismulticast(groupaddr), return ERR_VAL;);
|
LWIP_ERROR("igmp_leavegroup: attempt to leave non-multicast address", ip4_addr_ismulticast(groupaddr), return ERR_VAL;);
|
||||||
LWIP_ERROR("igmp_leavegroup: attempt to leave allsystems address", (!ip4_addr_cmp(groupaddr, &allsystems)), return ERR_VAL;);
|
LWIP_ERROR("igmp_leavegroup: attempt to leave allsystems address", (!ip4_addr_cmp(groupaddr, &allsystems)), return ERR_VAL;);
|
||||||
@ -576,6 +582,8 @@ igmp_leavegroup_netif(struct netif *netif, const ip4_addr_t *groupaddr)
|
|||||||
{
|
{
|
||||||
struct igmp_group *group;
|
struct igmp_group *group;
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
|
|
||||||
/* make sure it is multicast address */
|
/* make sure it is multicast address */
|
||||||
LWIP_ERROR("igmp_leavegroup_netif: attempt to leave non-multicast address", ip4_addr_ismulticast(groupaddr), return ERR_VAL;);
|
LWIP_ERROR("igmp_leavegroup_netif: attempt to leave non-multicast address", ip4_addr_ismulticast(groupaddr), return ERR_VAL;);
|
||||||
LWIP_ERROR("igmp_leavegroup_netif: attempt to leave allsystems address", (!ip4_addr_cmp(groupaddr, &allsystems)), return ERR_VAL;);
|
LWIP_ERROR("igmp_leavegroup_netif: attempt to leave allsystems address", (!ip4_addr_cmp(groupaddr, &allsystems)), return ERR_VAL;);
|
||||||
|
@ -154,6 +154,8 @@ ip4_route(const ip4_addr_t *dest)
|
|||||||
#if !LWIP_SINGLE_NETIF
|
#if !LWIP_SINGLE_NETIF
|
||||||
struct netif *netif;
|
struct netif *netif;
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
|
|
||||||
#if LWIP_MULTICAST_TX_OPTIONS
|
#if LWIP_MULTICAST_TX_OPTIONS
|
||||||
/* Use administratively selected interface for multicast by default */
|
/* Use administratively selected interface for multicast by default */
|
||||||
if (ip4_addr_ismulticast(dest) && ip4_default_multicast_netif) {
|
if (ip4_addr_ismulticast(dest) && ip4_default_multicast_netif) {
|
||||||
@ -825,6 +827,7 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d
|
|||||||
u32_t chk_sum = 0;
|
u32_t chk_sum = 0;
|
||||||
#endif /* CHECKSUM_GEN_IP_INLINE */
|
#endif /* CHECKSUM_GEN_IP_INLINE */
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
LWIP_IP_CHECK_PBUF_REF_COUNT_FOR_TX(p);
|
LWIP_IP_CHECK_PBUF_REF_COUNT_FOR_TX(p);
|
||||||
|
|
||||||
MIB2_STATS_INC(mib2.ipoutrequests);
|
MIB2_STATS_INC(mib2.ipoutrequests);
|
||||||
|
@ -82,6 +82,8 @@ ethip6_output(struct netif *netif, struct pbuf *q, const ip6_addr_t *ip6addr)
|
|||||||
const u8_t *hwaddr;
|
const u8_t *hwaddr;
|
||||||
err_t result;
|
err_t result;
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
|
|
||||||
/* The destination IP address must be properly zoned from here on down. */
|
/* The destination IP address must be properly zoned from here on down. */
|
||||||
IP6_ADDR_ZONECHECK_NETIF(ip6addr, netif);
|
IP6_ADDR_ZONECHECK_NETIF(ip6addr, netif);
|
||||||
|
|
||||||
|
@ -92,6 +92,8 @@ ip6_route(const ip6_addr_t *src, const ip6_addr_t *dest)
|
|||||||
struct netif *netif;
|
struct netif *netif;
|
||||||
s8_t i;
|
s8_t i;
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
|
|
||||||
/* If single netif configuration, fast return. */
|
/* If single netif configuration, fast return. */
|
||||||
if ((netif_list != NULL) && (netif_list->next == NULL)) {
|
if ((netif_list != NULL) && (netif_list->next == NULL)) {
|
||||||
if (!netif_is_up(netif_list) || !netif_is_link_up(netif_list) ||
|
if (!netif_is_up(netif_list) || !netif_is_link_up(netif_list) ||
|
||||||
@ -1170,6 +1172,7 @@ ip6_output_if_src(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
|
|||||||
struct ip6_hdr *ip6hdr;
|
struct ip6_hdr *ip6hdr;
|
||||||
ip6_addr_t dest_addr;
|
ip6_addr_t dest_addr;
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
LWIP_IP_CHECK_PBUF_REF_COUNT_FOR_TX(p);
|
LWIP_IP_CHECK_PBUF_REF_COUNT_FOR_TX(p);
|
||||||
|
|
||||||
/* Should the IPv6 header be generated or is it already included in p? */
|
/* Should the IPv6 header be generated or is it already included in p? */
|
||||||
|
@ -312,6 +312,8 @@ mld6_joingroup(const ip6_addr_t *srcaddr, const ip6_addr_t *groupaddr)
|
|||||||
err_t err = ERR_VAL; /* no matching interface */
|
err_t err = ERR_VAL; /* no matching interface */
|
||||||
struct netif *netif;
|
struct netif *netif;
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
|
|
||||||
/* loop through netif's */
|
/* loop through netif's */
|
||||||
NETIF_FOREACH(netif) {
|
NETIF_FOREACH(netif) {
|
||||||
/* Should we join this interface ? */
|
/* Should we join this interface ? */
|
||||||
@ -353,6 +355,8 @@ mld6_joingroup_netif(struct netif *netif, const ip6_addr_t *groupaddr)
|
|||||||
IP6_ADDR_ZONECHECK_NETIF(groupaddr, netif);
|
IP6_ADDR_ZONECHECK_NETIF(groupaddr, netif);
|
||||||
#endif /* LWIP_IPV6_SCOPES */
|
#endif /* LWIP_IPV6_SCOPES */
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
|
|
||||||
/* find group or create a new one if not found */
|
/* find group or create a new one if not found */
|
||||||
group = mld6_lookfor_group(netif, groupaddr);
|
group = mld6_lookfor_group(netif, groupaddr);
|
||||||
|
|
||||||
@ -397,6 +401,8 @@ mld6_leavegroup(const ip6_addr_t *srcaddr, const ip6_addr_t *groupaddr)
|
|||||||
err_t err = ERR_VAL; /* no matching interface */
|
err_t err = ERR_VAL; /* no matching interface */
|
||||||
struct netif *netif;
|
struct netif *netif;
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
|
|
||||||
/* loop through netif's */
|
/* loop through netif's */
|
||||||
NETIF_FOREACH(netif) {
|
NETIF_FOREACH(netif) {
|
||||||
/* Should we leave this interface ? */
|
/* Should we leave this interface ? */
|
||||||
@ -437,6 +443,8 @@ mld6_leavegroup_netif(struct netif *netif, const ip6_addr_t *groupaddr)
|
|||||||
IP6_ADDR_ZONECHECK_NETIF(groupaddr, netif);
|
IP6_ADDR_ZONECHECK_NETIF(groupaddr, netif);
|
||||||
#endif /* LWIP_IPV6_SCOPES */
|
#endif /* LWIP_IPV6_SCOPES */
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
|
|
||||||
/* find group */
|
/* find group */
|
||||||
group = mld6_lookfor_group(netif, groupaddr);
|
group = mld6_lookfor_group(netif, groupaddr);
|
||||||
|
|
||||||
|
@ -173,24 +173,19 @@ typedef void (*mqtt_incoming_publish_cb_t)(void *arg, const char *topic, u32_t t
|
|||||||
typedef void (*mqtt_request_cb_t)(void *arg, err_t err);
|
typedef void (*mqtt_request_cb_t)(void *arg, err_t err);
|
||||||
|
|
||||||
|
|
||||||
/** Connect to server */
|
|
||||||
err_t mqtt_client_connect(mqtt_client_t *client, const ip_addr_t *ipaddr, u16_t port, mqtt_connection_cb_t cb, void *arg,
|
err_t mqtt_client_connect(mqtt_client_t *client, const ip_addr_t *ipaddr, u16_t port, mqtt_connection_cb_t cb, void *arg,
|
||||||
const struct mqtt_connect_client_info_t *client_info);
|
const struct mqtt_connect_client_info_t *client_info);
|
||||||
|
|
||||||
/** Disconnect from server */
|
|
||||||
void mqtt_disconnect(mqtt_client_t *client);
|
void mqtt_disconnect(mqtt_client_t *client);
|
||||||
|
|
||||||
mqtt_client_t *mqtt_client_new(void);
|
mqtt_client_t *mqtt_client_new(void);
|
||||||
void mqtt_client_free(mqtt_client_t* client);
|
void mqtt_client_free(mqtt_client_t* client);
|
||||||
|
|
||||||
/** Check connection status */
|
|
||||||
u8_t mqtt_client_is_connected(mqtt_client_t *client);
|
u8_t mqtt_client_is_connected(mqtt_client_t *client);
|
||||||
|
|
||||||
/** Set callback to call for incoming publish */
|
|
||||||
void mqtt_set_inpub_callback(mqtt_client_t *client, mqtt_incoming_publish_cb_t,
|
void mqtt_set_inpub_callback(mqtt_client_t *client, mqtt_incoming_publish_cb_t,
|
||||||
mqtt_incoming_data_cb_t data_cb, void *arg);
|
mqtt_incoming_data_cb_t data_cb, void *arg);
|
||||||
|
|
||||||
/** Common function for subscribe and unsubscribe */
|
|
||||||
err_t mqtt_sub_unsub(mqtt_client_t *client, const char *topic, u8_t qos, mqtt_request_cb_t cb, void *arg, u8_t sub);
|
err_t mqtt_sub_unsub(mqtt_client_t *client, const char *topic, u8_t qos, mqtt_request_cb_t cb, void *arg, u8_t sub);
|
||||||
|
|
||||||
/** @ingroup mqtt
|
/** @ingroup mqtt
|
||||||
@ -200,8 +195,6 @@ err_t mqtt_sub_unsub(mqtt_client_t *client, const char *topic, u8_t qos, mqtt_re
|
|||||||
* Unsubscribe to topic */
|
* Unsubscribe to topic */
|
||||||
#define mqtt_unsubscribe(client, topic, cb, arg) mqtt_sub_unsub(client, topic, 0, cb, arg, 0)
|
#define mqtt_unsubscribe(client, topic, cb, arg) mqtt_sub_unsub(client, topic, 0, cb, arg, 0)
|
||||||
|
|
||||||
|
|
||||||
/** Publish data to topic */
|
|
||||||
err_t mqtt_publish(mqtt_client_t *client, const char *topic, const void *payload, u16_t payload_length, u8_t qos, u8_t retain,
|
err_t mqtt_publish(mqtt_client_t *client, const char *topic, const void *payload, u16_t payload_length, u8_t qos, u8_t retain,
|
||||||
mqtt_request_cb_t cb, void *arg);
|
mqtt_request_cb_t cb, void *arg);
|
||||||
|
|
||||||
|
@ -86,6 +86,8 @@ ethernet_input(struct pbuf *p, struct netif *netif)
|
|||||||
u16_t next_hdr_offset = SIZEOF_ETH_HDR;
|
u16_t next_hdr_offset = SIZEOF_ETH_HDR;
|
||||||
#endif /* LWIP_ARP || ETHARP_SUPPORT_VLAN */
|
#endif /* LWIP_ARP || ETHARP_SUPPORT_VLAN */
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
|
|
||||||
if (p->len <= SIZEOF_ETH_HDR) {
|
if (p->len <= SIZEOF_ETH_HDR) {
|
||||||
/* a packet with only an ethernet header (or less) is not valid for us */
|
/* a packet with only an ethernet header (or less) is not valid for us */
|
||||||
ETHARP_STATS_INC(etharp.proterr);
|
ETHARP_STATS_INC(etharp.proterr);
|
||||||
@ -271,6 +273,8 @@ ethernet_output(struct netif * netif, struct pbuf * p,
|
|||||||
struct eth_hdr *ethhdr;
|
struct eth_hdr *ethhdr;
|
||||||
u16_t eth_type_be = lwip_htons(eth_type);
|
u16_t eth_type_be = lwip_htons(eth_type);
|
||||||
|
|
||||||
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
|
|
||||||
#if ETHARP_SUPPORT_VLAN && defined(LWIP_HOOK_VLAN_SET)
|
#if ETHARP_SUPPORT_VLAN && defined(LWIP_HOOK_VLAN_SET)
|
||||||
s32_t vlan_prio_vid = LWIP_HOOK_VLAN_SET(netif, p, src, dst, eth_type);
|
s32_t vlan_prio_vid = LWIP_HOOK_VLAN_SET(netif, p, src, dst, eth_type);
|
||||||
if (vlan_prio_vid >= 0) {
|
if (vlan_prio_vid >= 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user