0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2025-03-11 17:08:46 +00:00

SNMP: Remove old code

This commit is contained in:
Vojtech Vilimek 2023-10-19 16:08:13 +02:00
parent f2f9810b86
commit 6c59bcdfbb
3 changed files with 11 additions and 28 deletions

View File

@ -134,8 +134,6 @@ snmp_cleanup(struct snmp_proto *p)
rfree(p->lock);
p->lock = NULL;
p->partial_response = NULL;
struct snmp_register *r, *r2;
WALK_LIST_DELSAFE(r, r2, p->register_queue)
{
@ -338,7 +336,6 @@ snmp_start(struct proto *P)
p->to_send = 0;
p->errs = 0;
p->partial_response = NULL;
p->startup_timer = tm_new_init(p->pool, snmp_startup_timeout, p, 0, 0);
p->ping_timer = tm_new_init(p->pool, snmp_ping_timeout, p, 0, 0);

View File

@ -161,12 +161,6 @@ struct snmp_proto {
uint to_send;
uint errs;
/*
* if the packet hasn't been fully recieved, partial_reponse points
* into the TX buffer to the Response-PDU header (needed for packet payload)
*/
struct agentx_response *partial_response;
};
//void snmp_tx(sock *sk);

View File

@ -878,7 +878,7 @@ parse_gets2_pdu(struct snmp_proto *p, byte * const pkt_start, uint size, uint *s
};
}
if (!p->partial_response && c.size < sizeof(struct agentx_response))
if (c.size < sizeof(struct agentx_response))
{
snmp_manage_tbuf(p, &c);
// TODO renew pkt, pkt_start pointers context clen
@ -1033,8 +1033,6 @@ send:;
snmp_log("sk_send error");
// TODO think through the error state
p->partial_response = NULL;
mb_free(o_start);
mb_free(o_end);
@ -1051,7 +1049,6 @@ partial:
(c.byte_ord) ? put_u32(&h->payload, pkt_size) : (h->payload = pkt_size);
//snmp_log("new rx-buffer size %u", h->payload);
*skip = AGENTX_HEADER_SIZE;
p->partial_response = response_header;
/* number of bytes parsed from RX-buffer */
return pkt - pkt_start;
@ -1396,24 +1393,19 @@ prepare_response(struct snmp_proto *p, struct snmp_pdu *c)
{
//snmp_log("prepare_response()");
if (!p->partial_response)
{
struct agentx_response *r = (void *) c->buffer;
struct agentx_header *h = &r->h;
struct agentx_response *r = (void *) c->buffer;
struct agentx_header *h = &r->h;
SNMP_BLANK_HEADER(h, AGENTX_RESPONSE_PDU);
SNMP_SESSION(h, p);
SNMP_BLANK_HEADER(h, AGENTX_RESPONSE_PDU);
SNMP_SESSION(h, p);
/* protocol doesn't care about subagent upTime */
STORE_U32(r->uptime, 0);
STORE_U16(r->error, AGENTX_RES_NO_ERROR);
STORE_U16(r->index, 0);
/* protocol doesn't care about subagent upTime */
STORE_U32(r->uptime, 0);
STORE_U16(r->error, AGENTX_RES_NO_ERROR);
STORE_U16(r->index, 0);
ADVANCE(c->buffer, c->size, sizeof(struct agentx_response));
return r;
}
return p->partial_response;
ADVANCE(c->buffer, c->size, sizeof(struct agentx_response));
return r;
}