Compare commits

...

5 Commits

Author SHA1 Message Date
qazmko1029
c87e27109d
Merge e46039adb9 into 1cc1536e6a 2024-04-19 16:52:02 +08:00
Erik Ekman
1cc1536e6a test/unit: fix inconsistent nullness check error
Inside a testcase, but still. Trying to address #160
2024-04-09 20:11:39 +02:00
qazmko1029
e46039adb9 snmp: forgot to change OID length 2023-12-30 23:30:06 +08:00
qazmko1029
5c8a07cd87 LwipMibCompiler: compile read-create object as read-write in generated C code 2023-12-30 23:19:59 +08:00
qazmko1029
53c3e8165a snmp: fix SNMPv2 generic trap ID and special varbinds OID to send according to rfc3584 2023-12-30 23:15:52 +08:00
3 changed files with 28 additions and 16 deletions

View File

@ -353,7 +353,7 @@ namespace LwipMibCompiler
}
else if (ote.Access == MaxAccess.readCreate)
{
result.AccessMode = SnmpAccessMode.ReadOnly;
result.AccessMode = SnmpAccessMode.ReadWrite;
}
else if (ignoreAccessibleFlag && (ote.Access == MaxAccess.notAccessible))
{

View File

@ -256,7 +256,7 @@ snmp_prepare_trap_oid(struct snmp_obj_id *dest_snmp_trap_oid, const struct snmp_
if (sizeof(dest_snmp_trap_oid->id) >= sizeof(snmpTrapOID)) {
MEMCPY(&dest_snmp_trap_oid->id, snmpTrapOID , sizeof(snmpTrapOID));
dest_snmp_trap_oid->len = LWIP_ARRAYSIZE(snmpTrapOID);
dest_snmp_trap_oid->id[dest_snmp_trap_oid->len++] = specific_trap + 1;
dest_snmp_trap_oid->id[dest_snmp_trap_oid->len++] = generic_trap + 1;
} else {
err = ERR_MEM;
}
@ -359,8 +359,8 @@ snmp_send_trap_or_notification_or_inform_generic(struct snmp_msg_trap *trap_msg,
NULL, /* *next */
NULL, /* *prev */
{ /* oid */
8, /* oid len */
{1, 3, 6, 1, 2, 1, 1, 3} /* oid for sysUpTime */
9, /* oid len */
{1, 3, 6, 1, 2, 1, 1, 3, 0} /* oid for sysUpTime.0 */
},
SNMP_ASN1_TYPE_TIMETICKS, /* type */
sizeof(u32_t), /* value_len */
@ -371,8 +371,8 @@ snmp_send_trap_or_notification_or_inform_generic(struct snmp_msg_trap *trap_msg,
NULL, /* *next */
NULL, /* *prev */
{ /* oid */
10, /* oid len */
{1, 3, 6, 1, 6, 3, 1, 1, 4, 1} /* oid for snmpTrapOID */
11, /* oid len */
{1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0} /* oid for snmpTrapOID.0 */
},
SNMP_ASN1_TYPE_OBJECT_ID, /* type */
0, /* value_len */

View File

@ -88,6 +88,7 @@ START_TEST(test_pbuf_copy_zero_pbuf)
fail_unless(p2->ref == 1);
p3 = pbuf_alloc(PBUF_RAW, p1->tot_len, PBUF_POOL);
fail_unless(p3 != NULL);
err = pbuf_copy(p3, p1);
fail_unless(err == ERR_VAL);
@ -161,8 +162,8 @@ START_TEST(test_pbuf_copy_partial_pbuf)
b->payload = packet;
pbuf_cat(a, b);
dest = pbuf_alloc(PBUF_RAW, 14, PBUF_RAM);
memset(dest->payload, 0, dest->len);
fail_unless(dest != NULL);
memset(dest->payload, 0, dest->len);
/* Don't copy if data will not fit */
err = pbuf_copy_partial_pbuf(dest, a, a->tot_len, 4);
@ -198,6 +199,7 @@ START_TEST(test_pbuf_split_64k_on_small_pbufs)
LWIP_UNUSED_ARG(_i);
p = pbuf_alloc(PBUF_RAW, 1, PBUF_POOL);
fail_unless(p != NULL);
pbuf_split_64k(p, &rest);
fail_unless(p->tot_len == 1);
pbuf_free(p);
@ -267,9 +269,14 @@ START_TEST(test_pbuf_take_at_edge)
u8_t *out;
int i;
u8_t testdata[] = { 0x01, 0x08, 0x82, 0x02 };
struct pbuf *p = pbuf_alloc(PBUF_RAW, 1024, PBUF_POOL);
struct pbuf *q = p->next;
struct pbuf *p;
struct pbuf *q;
LWIP_UNUSED_ARG(_i);
p = pbuf_alloc(PBUF_RAW, 1024, PBUF_POOL);
fail_unless(p != NULL);
q = p->next;
/* alloc big enough to get a chain of pbufs */
fail_if(p->tot_len == p->len);
memset(p->payload, 0, p->len);
@ -319,9 +326,14 @@ START_TEST(test_pbuf_get_put_at_edge)
u8_t *out;
u8_t testdata = 0x01;
u8_t getdata;
struct pbuf *p = pbuf_alloc(PBUF_RAW, 1024, PBUF_POOL);
struct pbuf *q = p->next;
struct pbuf *p;
struct pbuf *q;
LWIP_UNUSED_ARG(_i);
p = pbuf_alloc(PBUF_RAW, 1024, PBUF_POOL);
fail_unless(p != NULL);
q = p->next;
/* alloc big enough to get a chain of pbufs */
fail_if(p->tot_len == p->len);
memset(p->payload, 0, p->len);