Commit f451742e authored by Adam Wujek's avatar Adam Wujek 💬

Kconfig: add SNMP_VERBOSE

Move SNMP just after syslog.
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 3f6bbea0
......@@ -136,6 +136,11 @@ config SYSLOG
The user (or init script) must use "syslog <ipaddr> <macaddr>"
to enable it. The special "off" ipaddr disables syslog.
config SNMP
depends on IP
default y
boolean "Mini SNMP responder"
config BUILD_INIT
depends on WR_NODE
default n
......@@ -360,6 +365,12 @@ config WRC_VERBOSE
help
This enables some more diagnostic messages. Normally off.
config SNMP_VERBOSE
depends on DEVELOPER && SNMP
boolean "More verbose messages in SNMP"
help
This enables some more diagnostic messages. Normally off.
config FAKE_TEMPERATURES
depends on DEVELOPER
boolean "Offer an array of 3 fake temperatures, for testing"
......@@ -367,11 +378,6 @@ config FAKE_TEMPERATURES
The option adds also a "faketemp" command, used to set
the fake temperatures: e.g. "faketemp 120 -10 50"
config SNMP
depends on IP
default y
boolean "Mini SNMP responder"
config VLAN
depends on DEVELOPER
boolean "Filter and rx/tx frames in a VLAN (as opposed to untagged)"
......
......@@ -25,6 +25,12 @@
#define WRC_IS_VERBOSE 0
#endif
#ifdef CONFIG_SNMP_VERBOSE
#define SNMP_IS_VERBOSE 1
#else
#define SNMP_IS_VERBOSE 0
#endif
#define pll_verbose(...) \
({if (PLL_IS_VERBOSE) __debug_printf(__VA_ARGS__);})
......@@ -37,6 +43,9 @@
#define net_verbose(...) \
({if (NET_IS_VERBOSE) __debug_printf(__VA_ARGS__);})
#define snmp_verbose(...) \
({if (SNMP_IS_VERBOSE) __debug_printf(__VA_ARGS__);})
#ifdef CONFIG_HOST_PROCESS
#define IS_HOST_PROCESS 1
......
......@@ -100,8 +100,8 @@ static int fill_struct_asn(uint8_t *buf, struct snmp_oid *obj)
tmp = htonl(*(uint32_t*)(*(obj->p) + obj->offset));
memcpy(buf + 2, &tmp, sizeof(tmp));
buf[1] = sizeof(tmp);
pp_printf("fill_struct_asn 0x%x\n",
*(uint32_t*)(*(obj->p) + obj->offset));
snmp_verbose("fill_struct_asn 0x%x\n",
*(uint32_t*)(*(obj->p) + obj->offset));
break;
default:
break;
......@@ -225,7 +225,7 @@ static int snmp_respond(uint8_t *buf)
return -1;
}
}
net_verbose("%s: match ok\n", __func__);
snmp_verbose("%s: match ok\n", __func__);
newbuf = buf + i;
for (oid = oid_array; oid->oid_len; oid++)
......@@ -233,7 +233,7 @@ static int snmp_respond(uint8_t *buf)
break;
if (!oid->oid_len)
return -1;
net_verbose("%s: oid found: calling %p\n", __func__, oid->fill);
snmp_verbose("%s: oid found: calling %p\n", __func__, oid->fill);
/* Phew.... we matched the OID, so let's call the filler */
newbuf += oid->oid_len;
......@@ -246,11 +246,11 @@ static int snmp_respond(uint8_t *buf)
buf[i] = 0xA2; /* get response */
if (match_array[i] != BYTE_SIZE)
continue;
net_verbose("offset %i 0x%02x is len %i\n", i, i,
snmp_verbose("offset %i 0x%02x is len %i\n", i, i,
remain + oid->oid_len + len);
buf[i] = remain + oid->oid_len + len;
}
net_verbose("%s: returning %i bytes\n", __func__, len + (newbuf - buf));
snmp_verbose("%s: returning %i bytes\n", __func__, len + (newbuf - buf));
return len + (newbuf - buf);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment