That's simply because the number in the first tree node after the MIB OID
is ignored. The macro practically reads "SNMP_CREATE_TREE_NODE(<don't care
number>, private_nodes);" -  but again, only for the FIRST tree node after
a MIB node!

​To avoid confusion, that "don't care number" should be the same as the
last number as in the base MIB.​


Ciao
Dirk

On Sun, Dec 10, 2017 at 11:28 AM, Zahir Lalani <za...@systemz.net> wrote:

> Hi All
>
> Been looking at the examples for MIB setup but one thing in the example
> confused me:
>
> Ref:
> https://github.com/yarrick/lwip-contrib/blob/master/
> examples/snmp/snmp_priva
> te_mib/lwip_prvmib.c
>
>
> Option 1 for the base MIB node is:
> ------------------------------------------------------------
> ----------------
> -
> /* example .1.3.6.1.4.1.26381.1 */
> static const struct snmp_tree_node example_node = SNMP_CREATE_TREE_NODE(1,
> example_nodes);
>
> static const u32_t prvmib_base_oid[] = { 1,3,6,1,4,1,26381,1 };
>
> const struct snmp_mib mib_private = SNMP_MIB_CREATE(prvmib_base_oid,
> &example_node.node);
> ------------------------------------------------------------
> ----------------
> -
>
> In this case the base oid ends in 1, and the tree node create uses 1 as the
> oid node. Makes sense.
>
> The code then gives an alternate example which builds up the base from
> higher up the tree. The base node create is now:
>
> ------------------------------------------------------------
> ----------------
> -
> /* private .1.3.6.1.4 */
> static const struct snmp_node* const private_nodes[] = {
>   &enterprises_node.node
> };
> static const struct snmp_tree_node private_root = SNMP_CREATE_TREE_NODE(0,
> private_nodes);
>
> static const u32_t prvmib_base_oid[] = { 1,3,6,1,4 };
> const struct snmp_mib mib_private = SNMP_MIB_CREATE(prvmib_base_oid,
> &private_root.node);
> ------------------------------------------------------------
> ----------------
> -
>
> Here the base node ends in 4, and I would have expected the tree node
> create
> to use 4 as the node id, but it uses 0.
>
> Which one is correct?
>
> Thx
>
>
> Z
>
>
> _______________________________________________
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>
_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to