diff options
author | Russ White <russ@riw.us> | 2021-01-12 17:23:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-12 17:23:03 +0100 |
commit | 50e091e4ad77ce4851b6c457bfa7c4e2d32d090f (patch) | |
tree | f021ea487d409148c90544c78f501fac63a8057a /ospfd | |
parent | Merge pull request #7841 from volta-networks/fix_isis_mstyle_routes (diff) | |
parent | ospfd: Adding authentication details to ospf interafce command o/p (diff) | |
download | frr-50e091e4ad77ce4851b6c457bfa7c4e2d32d090f.tar.xz frr-50e091e4ad77ce4851b6c457bfa7c4e2d32d090f.zip |
Merge pull request #7733 from rgirada/ospf_json
ospfd: Adding authentication details to ospf interafce command o/p
Diffstat (limited to 'ospfd')
-rw-r--r-- | ospfd/ospf_vty.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 6052d48e8..c58073c52 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -3365,6 +3365,54 @@ DEFUN (show_ip_ospf_instance, return ret; } +static void ospf_interface_auth_show(struct vty *vty, struct ospf_interface *oi, + json_object *json, bool use_json) +{ + int auth_type; + + auth_type = OSPF_IF_PARAM(oi, auth_type); + + switch (auth_type) { + case OSPF_AUTH_NULL: + if (use_json) + json_object_string_add(json, "authentication", + "authenticationNone"); + else + vty_out(vty, " Authentication NULL is enabled\n"); + break; + case OSPF_AUTH_SIMPLE: { + if (use_json) + json_object_string_add(json, "authentication", + "authenticationSimplePassword"); + else + vty_out(vty, + " Simple password authentication enabled\n"); + break; + } + case OSPF_AUTH_CRYPTOGRAPHIC: { + struct crypt_key *ckey; + + if (list_isempty(OSPF_IF_PARAM(oi, auth_crypt))) + return; + + ckey = listgetdata(listtail(OSPF_IF_PARAM(oi, auth_crypt))); + if (ckey) { + if (use_json) { + json_object_string_add(json, "authentication", + "authenticationMessageDigest"); + } else { + vty_out(vty, + " Cryptographic authentication enabled\n"); + vty_out(vty, " Algorithm:MD5\n"); + } + } + break; + } + default: + break; + } +} + static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf, struct interface *ifp, json_object *json_interface_sub, @@ -3686,6 +3734,9 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf, ospf_nbr_count(oi, 0), ospf_nbr_count(oi, NSM_Full)); ospf_bfd_interface_show(vty, ifp, json_interface_sub, use_json); + + /* OSPF Authentication information */ + ospf_interface_auth_show(vty, oi, json_interface_sub, use_json); } } |