On Thu, 4 Jun 2015, Nicolas Dichtel wrote:

+/* VRF node. */
+static struct cmd_node vrf_node =
+{
+  VRF_NODE,
+  "",       /* VRF node has no interface. */
+  1
+};
+
+/* VRF configuration write function. */
+static int
+vrf_config_write (struct vty *vty)
+{

+
+#ifdef HAVE_NETNS
+  /* Install VRF commands. */
+  install_node (&vrf_node, vrf_config_write);
+  install_element (CONFIG_NODE, &vrf_netns_cmd);
+  install_element (CONFIG_NODE, &no_vrf_netns_cmd);
+#endif

You're creating a new VRF_NODE and installing it under CONFIG_NODE, but not installing any commands to VRF_NODE - those are going into CONFIG_NODE instead. So this is basically using it as a place to hook a vrf config-write function into the CONFIG_NODE config-write function.

This kind of suggests the command node API would be better having a list of config-write function pointers in the cmd_node? Rather than installing dummy cmd_nodes with no commands (but commands added into the parent)?

(I'm little bit of command.c spring cleaning that made me notice this).

regards,
--
Paul Jakma      p...@jakma.org  @pjakma Key ID: 64A2FF6A
Fortune:
Prizes are for children.
                -- Charles Ives, upon being given, but refusing, the
                   Pulitzer prize

_______________________________________________
Quagga-dev mailing list
Quagga-dev@lists.quagga.net
https://lists.quagga.net/mailman/listinfo/quagga-dev

Reply via email to