]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
SNMP: Remove old code
authorVojtech Vilimek <vojtech.vilimek@nic.cz>
Thu, 19 Oct 2023 14:08:13 +0000 (16:08 +0200)
committerVojtech Vilimek <vojtech.vilimek@nic.cz>
Thu, 19 Oct 2023 14:15:15 +0000 (16:15 +0200)
proto/snmp/snmp.c
proto/snmp/snmp.h
proto/snmp/subagent.c

index e0e5e59c651b68416963ed6d0877a959ab5d9ccc..bde36779b9d0d84527411033f13129dc483960a6 100644 (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);
index b75050ec60526cbfe262a5e69f20964dee3f687d..34c4e7d609bc6a6956986e6c617353ffbce625be 100644 (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);
index 43510dffb473090564b993fc2ef95f04cf81980d..47ec574d3048dbc5fb6ebb30dc89fd365704aeae 100644 (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;
-
-    SNMP_BLANK_HEADER(h, AGENTX_RESPONSE_PDU);
-    SNMP_SESSION(h, p);
+  struct agentx_response *r = (void *) c->buffer;
+  struct agentx_header *h = &r->h;
 
-    /* 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);
+  SNMP_BLANK_HEADER(h, AGENTX_RESPONSE_PDU);
+  SNMP_SESSION(h, p);
 
-    ADVANCE(c->buffer, c->size, sizeof(struct agentx_response));
-    return r;
-  }
+  /* 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);
 
-  return p->partial_response;
+  ADVANCE(c->buffer, c->size, sizeof(struct agentx_response));
+  return r;
 }