0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-23 02:01:55 +00:00

tmp: minor changes

This commit is contained in:
Vojtech Vilimek 2023-03-14 14:09:45 +01:00
parent 29da25c2d0
commit 908aa67e1c
4 changed files with 24 additions and 21 deletions

View File

@ -859,6 +859,7 @@ UNUSED, uint contid UNUSED, int byte_ord UNUSED, u8 state)
BGP_DATA(vb, AGENTX_OCTET_STRING, pkt); BGP_DATA(vb, AGENTX_OCTET_STRING, pkt);
break; break;
// TODO finish me here
case BGP_INTERNAL_FSM_TRANSITIONS: case BGP_INTERNAL_FSM_TRANSITIONS:
break; break;
case BGP_INTERNAL_FSM_ESTABLISHED_TIME: case BGP_INTERNAL_FSM_ESTABLISHED_TIME:
@ -903,6 +904,7 @@ bgp_fill_static(struct snmp_proto *p, struct agentx_varbind *vb, byte *pkt, uint
UNUSED, uint contid UNUSED, int byte_ord UNUSED, u8 state) UNUSED, uint contid UNUSED, int byte_ord UNUSED, u8 state)
{ {
snmp_log("snmp bgp_fill_static ()\n"); snmp_log("snmp bgp_fill_static ()\n");
byte *temp = pkt;
struct oid *oid = &vb->name; struct oid *oid = &vb->name;
@ -937,7 +939,8 @@ UNUSED, uint contid UNUSED, int byte_ord UNUSED, u8 state)
vb->type = AGENTX_NO_SUCH_OBJECT; vb->type = AGENTX_NO_SUCH_OBJECT;
} }
snmp_log("snmp ended with non empty pkt\n"); snmp_log("snmp ended with non empty pkt %u starting from %p to %p\n", pkt -
temp, temp, pkt);
return pkt; return pkt;
} }

View File

@ -48,6 +48,7 @@ snmp_init(struct proto_config *CF)
p->remote_ip = cf->remote_ip; p->remote_ip = cf->remote_ip;
p->local_port = cf->local_port; p->local_port = cf->local_port;
p->remote_port = cf->remote_port; p->remote_port = cf->remote_port;
p->local_as = cf->local_as;
snmp_log("chaning proto_snmp state to INIT"); snmp_log("chaning proto_snmp state to INIT");
p->state = SNMP_INIT; p->state = SNMP_INIT;

View File

@ -66,8 +66,7 @@ snmp_str_size(const char *str)
uint uint
snmp_oid_size(struct oid *o) snmp_oid_size(struct oid *o)
{ {
//return 4 + o->n_subid * 4; return 4 + (o->n_subid * 4);
return 4 + (o->n_subid << 2);
} }
/** /**
@ -192,10 +191,10 @@ snmp_put_oid(byte *buf, struct oid *oid)
for (uint i = 0; i < oid->n_subid; i++) for (uint i = 0; i < oid->n_subid; i++)
*(((u32 *) buf) + i) = oid->ids[i]; *(((u32 *) buf) + i) = oid->ids[i];
#else #else
put_u32s(buf, oid->ids, oid->n_subid << 2); put_u32s(buf, oid->ids, oid->n_subid * 4);
#endif #endif
return buf + (oid->n_subid << 2); return buf + oid->n_subid * 4;
} }
/** /**
@ -235,7 +234,7 @@ void snmp_oid_dump(struct oid *oid)
{ {
log(L_WARN "is eqaul to NULL"); log(L_WARN "is eqaul to NULL");
log(L_WARN "OID DUMP END ===="); log(L_WARN "OID DUMP END ====");
log(L_WARN); log(L_WARN ".");
return; return;
} }
@ -243,7 +242,7 @@ void snmp_oid_dump(struct oid *oid)
{ {
log(L_WARN "is empty"); log(L_WARN "is empty");
log(L_WARN "OID DUMP END ===="); log(L_WARN "OID DUMP END ====");
log(L_WARN); log(L_WARN ".");
return; return;
} }
@ -380,7 +379,7 @@ void
snmp_dump_packet(byte *pkt, uint size) snmp_dump_packet(byte *pkt, uint size)
{ {
snmp_log("dump"); snmp_log("dump");
for (int i = 0; i < size; i += 4) for (uint i = 0; i < size; i += 4)
snmp_log("pkt [%d] 0x%02x%02x%02x%02x", i, pkt[i],pkt[i+1],pkt[i+2],pkt[i+3]); snmp_log("pkt [%d] 0x%02x%02x%02x%02x", i, pkt[i],pkt[i+1],pkt[i+2],pkt[i+3]);
snmp_log("end dump"); snmp_log("end dump");
} }