diff options
author | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-10-18 01:36:21 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-10-18 01:36:21 +0200 |
commit | e52702f29d003585dcfbb4914b2a52d77a177739 (patch) | |
tree | 3e130ded38c48316796bfb602dc6fe6d119129d2 /lib/keychain.c | |
parent | ospf6d: fix a few vty help strings (diff) | |
parent | vtysh: fix build failure in vtysh_writeconfig_integrated() (diff) | |
download | frr-e52702f29d003585dcfbb4914b2a52d77a177739.tar.xz frr-e52702f29d003585dcfbb4914b2a52d77a177739.zip |
Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Conflicts:
bgpd/bgp_route.c
bgpd/bgp_routemap.c
bgpd/bgp_vty.c
isisd/isis_redist.c
isisd/isis_routemap.c
isisd/isis_vty.c
isisd/isisd.c
lib/command.c
lib/distribute.c
lib/if.c
lib/keychain.c
lib/routemap.c
lib/routemap.h
ospf6d/ospf6_asbr.c
ospf6d/ospf6_interface.c
ospf6d/ospf6_neighbor.c
ospf6d/ospf6_top.c
ospf6d/ospf6_zebra.c
ospf6d/ospf6d.c
ospfd/ospf_routemap.c
ospfd/ospf_vty.c
ripd/rip_routemap.c
ripngd/ripng_routemap.c
vtysh/extract.pl.in
vtysh/vtysh.c
zebra/interface.c
zebra/irdp_interface.c
zebra/rt_netlink.c
zebra/rtadv.c
zebra/test_main.c
zebra/zebra_routemap.c
zebra/zebra_vty.c
Diffstat (limited to 'lib/keychain.c')
-rw-r--r-- | lib/keychain.c | 100 |
1 files changed, 34 insertions, 66 deletions
diff --git a/lib/keychain.c b/lib/keychain.c index c2d6e4571..f8a3ffc01 100644 --- a/lib/keychain.c +++ b/lib/keychain.c @@ -28,30 +28,40 @@ Boston, MA 02111-1307, USA. */ DEFINE_MTYPE_STATIC(LIB, KEY, "Key") DEFINE_MTYPE_STATIC(LIB, KEYCHAIN, "Key chain") +DEFINE_QOBJ_TYPE(keychain) +DEFINE_QOBJ_TYPE(key) + /* Master list of key chain. */ struct list *keychain_list; static struct keychain * keychain_new (void) { - return XCALLOC (MTYPE_KEYCHAIN, sizeof (struct keychain)); + struct keychain *keychain; + keychain = XCALLOC (MTYPE_KEYCHAIN, sizeof (struct keychain)); + QOBJ_REG (keychain, keychain); + return keychain; } static void keychain_free (struct keychain *keychain) { + QOBJ_UNREG (keychain); XFREE (MTYPE_KEYCHAIN, keychain); } static struct key * key_new (void) { - return XCALLOC (MTYPE_KEY, sizeof (struct key)); + struct key *key = XCALLOC (MTYPE_KEY, sizeof (struct key)); + QOBJ_REG (key, key); + return key; } static void key_free (struct key *key) { + QOBJ_UNREG (key); XFREE (MTYPE_KEY, key); } @@ -241,8 +251,7 @@ DEFUN (key_chain, struct keychain *keychain; keychain = keychain_get (argv[idx_word]->arg); - vty->index = keychain; - vty->node = KEYCHAIN_NODE; + VTY_PUSH_CONTEXT_COMPAT (KEYCHAIN_NODE, keychain); return CMD_SUCCESS; } @@ -278,16 +287,13 @@ DEFUN (key, "Key identifier number\n") { int idx_number = 1; - struct keychain *keychain; + VTY_DECLVAR_CONTEXT (keychain, keychain); struct key *key; u_int32_t index; - keychain = vty->index; - VTY_GET_INTEGER ("key identifier", index, argv[idx_number]->arg); key = key_get (keychain, index); - vty->index_sub = key; - vty->node = KEYCHAIN_KEY_NODE; + VTY_PUSH_CONTEXT_SUB (KEYCHAIN_KEY_NODE, key); return CMD_SUCCESS; } @@ -300,12 +306,10 @@ DEFUN (no_key, "Key identifier number\n") { int idx_number = 2; - struct keychain *keychain; + VTY_DECLVAR_CONTEXT (keychain, keychain); struct key *key; u_int32_t index; - keychain = vty->index; - VTY_GET_INTEGER ("key identifier", index, argv[idx_number]->arg); key = key_lookup (keychain, index); if (! key) @@ -328,9 +332,7 @@ DEFUN (key_string, "The key\n") { int idx_line = 1; - struct key *key; - - key = vty->index_sub; + VTY_DECLVAR_CONTEXT_SUB (key, key); if (key->string) XFREE(MTYPE_KEY, key->string); @@ -346,9 +348,7 @@ DEFUN (no_key_string, "Unset key string\n" "The key\n") { - struct key *key; - - key = vty->index_sub; + VTY_DECLVAR_CONTEXT_SUB (key, key); if (key->string) { @@ -565,9 +565,7 @@ DEFUN (accept_lifetime_day_month_day_month, int idx_number_3 = 6; int idx_month_2 = 7; int idx_number_4 = 8; - struct key *key; - - key = vty->index_sub; + VTY_DECLVAR_CONTEXT_SUB (key, key); return key_lifetime_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, argv[idx_number_2]->arg, argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); @@ -594,9 +592,7 @@ DEFUN (accept_lifetime_day_month_month_day, int idx_month_2 = 6; int idx_number_3 = 7; int idx_number_4 = 8; - struct key *key; - - key = vty->index_sub; + VTY_DECLVAR_CONTEXT_SUB (key, key); return key_lifetime_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, argv[idx_number_2]->arg, argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); @@ -623,9 +619,7 @@ DEFUN (accept_lifetime_month_day_day_month, int idx_number_3 = 6; int idx_month_2 = 7; int idx_number_4 = 8; - struct key *key; - - key = vty->index_sub; + VTY_DECLVAR_CONTEXT_SUB (key, key); return key_lifetime_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, argv[idx_number_2]->arg, argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); @@ -652,9 +646,7 @@ DEFUN (accept_lifetime_month_day_month_day, int idx_month_2 = 6; int idx_number_3 = 7; int idx_number_4 = 8; - struct key *key; - - key = vty->index_sub; + VTY_DECLVAR_CONTEXT_SUB (key, key); return key_lifetime_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, argv[idx_number_2]->arg, argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); @@ -674,9 +666,7 @@ DEFUN (accept_lifetime_infinite_day_month, int idx_number = 2; int idx_month = 3; int idx_number_2 = 4; - struct key *key; - - key = vty->index_sub; + VTY_DECLVAR_CONTEXT_SUB (key, key); return key_lifetime_infinite_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, argv[idx_number_2]->arg); @@ -696,9 +686,7 @@ DEFUN (accept_lifetime_infinite_month_day, int idx_month = 2; int idx_number = 3; int idx_number_2 = 4; - struct key *key; - - key = vty->index_sub; + VTY_DECLVAR_CONTEXT_SUB (key, key); return key_lifetime_infinite_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, argv[idx_number_2]->arg); @@ -720,9 +708,7 @@ DEFUN (accept_lifetime_duration_day_month, int idx_month = 3; int idx_number_2 = 4; int idx_number_3 = 6; - struct key *key; - - key = vty->index_sub; + VTY_DECLVAR_CONTEXT_SUB (key, key); return key_lifetime_duration_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg); @@ -744,9 +730,7 @@ DEFUN (accept_lifetime_duration_month_day, int idx_number = 3; int idx_number_2 = 4; int idx_number_3 = 6; - struct key *key; - - key = vty->index_sub; + VTY_DECLVAR_CONTEXT_SUB (key, key); return key_lifetime_duration_set (vty, &key->accept, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg); @@ -773,9 +757,7 @@ DEFUN (send_lifetime_day_month_day_month, int idx_number_3 = 6; int idx_month_2 = 7; int idx_number_4 = 8; - struct key *key; - - key = vty->index_sub; + VTY_DECLVAR_CONTEXT_SUB (key, key); return key_lifetime_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, argv[idx_number_2]->arg, argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); @@ -802,9 +784,7 @@ DEFUN (send_lifetime_day_month_month_day, int idx_month_2 = 6; int idx_number_3 = 7; int idx_number_4 = 8; - struct key *key; - - key = vty->index_sub; + VTY_DECLVAR_CONTEXT_SUB (key, key); return key_lifetime_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, argv[idx_number_2]->arg, argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); @@ -831,9 +811,7 @@ DEFUN (send_lifetime_month_day_day_month, int idx_number_3 = 6; int idx_month_2 = 7; int idx_number_4 = 8; - struct key *key; - - key = vty->index_sub; + VTY_DECLVAR_CONTEXT_SUB (key, key); return key_lifetime_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, argv[idx_number_2]->arg, argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); @@ -860,9 +838,7 @@ DEFUN (send_lifetime_month_day_month_day, int idx_month_2 = 6; int idx_number_3 = 7; int idx_number_4 = 8; - struct key *key; - - key = vty->index_sub; + VTY_DECLVAR_CONTEXT_SUB (key, key); return key_lifetime_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, argv[idx_number_2]->arg, argv[idx_hhmmss_2]->arg, argv[idx_number_3]->arg, argv[idx_month_2]->arg, argv[idx_number_4]->arg); @@ -882,9 +858,7 @@ DEFUN (send_lifetime_infinite_day_month, int idx_number = 2; int idx_month = 3; int idx_number_2 = 4; - struct key *key; - - key = vty->index_sub; + VTY_DECLVAR_CONTEXT_SUB (key, key); return key_lifetime_infinite_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, argv[idx_number_2]->arg); @@ -904,9 +878,7 @@ DEFUN (send_lifetime_infinite_month_day, int idx_month = 2; int idx_number = 3; int idx_number_2 = 4; - struct key *key; - - key = vty->index_sub; + VTY_DECLVAR_CONTEXT_SUB (key, key); return key_lifetime_infinite_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, argv[idx_number_2]->arg); @@ -928,9 +900,7 @@ DEFUN (send_lifetime_duration_day_month, int idx_month = 3; int idx_number_2 = 4; int idx_number_3 = 6; - struct key *key; - - key = vty->index_sub; + VTY_DECLVAR_CONTEXT_SUB (key, key); return key_lifetime_duration_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg); @@ -952,9 +922,7 @@ DEFUN (send_lifetime_duration_month_day, int idx_number = 3; int idx_number_2 = 4; int idx_number_3 = 6; - struct key *key; - - key = vty->index_sub; + VTY_DECLVAR_CONTEXT_SUB (key, key); return key_lifetime_duration_set (vty, &key->send, argv[idx_hhmmss]->arg, argv[idx_number]->arg, argv[idx_month]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg); |