diff --git a/src/core/snmp/msg_in.c b/src/core/snmp/msg_in.c index 93b95c69..3ce90d7f 100644 --- a/src/core/snmp/msg_in.c +++ b/src/core/snmp/msg_in.c @@ -35,9 +35,11 @@ * Author: Christiaan Simons */ +#include "lwip/opt.h" + +#if LWIP_SNMP #include #include "arch/cc.h" -#include "lwip/opt.h" #include "lwip/ip_addr.h" #include "lwip/mem.h" #include "lwip/udp.h" @@ -48,8 +50,6 @@ #include "lwip/snmp_msg.h" #include "lwip/snmp_structs.h" -#if LWIP_SNMP - #define SNMP_CONCURRENT_REQUESTS 2 /* public (non-static) constants */ @@ -152,6 +152,9 @@ snmp_msg_event(struct snmp_msg_pstat *msg_ps) /* mn == NULL, noSuchName */ snmp_varbind_list_free(&msg_ps->outvb); msg_ps->outvb = msg_ps->invb; + msg_ps->invb.head = NULL; + msg_ps->invb.tail = NULL; + msg_ps->invb.count = 0; msg_ps->error_status = SNMP_ES_NOSUCHNAME; msg_ps->error_index = 1 + msg_ps->vb_idx; snmp_send_response(msg_ps); @@ -302,6 +305,9 @@ snmp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, /* @todo move used names back from outvb to invb */ snmp_varbind_list_free(&msg_ps->outvb); msg_ps->outvb = msg_ps->invb; + msg_ps->invb.head = NULL; + msg_ps->invb.tail = NULL; + msg_ps->invb.count = 0; msg_ps->error_status = SNMP_ES_NOSUCHNAME; msg_ps->error_index = 1 + msg_ps->vb_idx; } @@ -353,6 +359,9 @@ snmp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, /* mn == NULL, noSuchName */ snmp_varbind_list_free(&msg_ps->outvb); msg_ps->outvb = msg_ps->invb; + msg_ps->invb.head = NULL; + msg_ps->invb.tail = NULL; + msg_ps->invb.count = 0; msg_ps->error_status = SNMP_ES_NOSUCHNAME; msg_ps->error_index = 1 + msg_ps->vb_idx; } @@ -949,4 +958,4 @@ snmp_varbind_tail_remove(struct snmp_varbind_root *root) return vb; } -#endif /* LWIP_SNMP */ \ No newline at end of file +#endif /* LWIP_SNMP */