Commit graph

78 commits

Author SHA1 Message Date
Donatas Abraitis 8e1231d061
Merge pull request #16700 from louis-6wind/fix-nhrp-output
nhrpd: fix show ip nhrp output
2024-11-28 17:16:24 +02:00
Joshua Muthii 5718ee37c7 nhrpd: Modify NHRP authentication feature logging
Modified nhrp_connection_authorized(). Initially, when writing debug
information about incoming NHRP packets with authentication enabled,
the nhrp_connection_authorized() function would print the
passphrase of the incoming packet as if it were a null terminated
string. This meant that if the passphrase on the incoming packet
had non ASCII-complient bytes in it, it would attempt to print those
bytes anyway. There was also no check that the size of the passphrase in
the incoming packet matched the size of the passphrase on the interface.
The changes in this commit log the passphrase on the incoming packet as
well as the passphrase on interface in HEX to avoid issues with ASCII.
It also performs a check that accounts for the sizes of the two different
passphrases

Moved CISCO_PASS_LENGTH_LEN from nhrp_vty.c to nhrp_protocol.h
for easier access  to the macro in other files

Signed-off-by: Joshua Muthii <jmuthii@labn.net>
2024-10-29 13:15:43 -04:00
Louis Scalbert e2db455c01 nhrpd: normalize sh ip nhrp opennhrp output
The command outputs too much "\n". Normalize it.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-10-17 11:24:50 +02:00
Louis Scalbert 65d62d982e nhrpd: fix sh ip nhrp opennhrp json counter
"show ip nhrp opennhrp json" counter is incorrect.

> root@nhs1:/# vtysh -c 'sh ip nhrp opennhrp json' | jq .
> {
>   "attr": {
>     "status": "ok",
>     "entriesCount": 1 <=== NOK
>   },
>   "table": [
>     {
>       "type": "dynamic",
>       "up": true,
>       "used": false,
>       "protocolAddress": "172.16.1.4",
>       "protocolAddressSize": 32,
>       "nbmaAddress": "192.168.2.4"
>     },
>     {
>       "type": "dynamic",
>       "up": true,
>       "used": false,
>       "protocolAddress": "172.16.1.5",
>       "protocolAddressSize": 32,
>       "nbmaAddress": "192.168.2.5"
>     }
>   ]
> }
>

Fixes: 87b9e98203 ("nhrpd: add json support to show nhrp vty commands")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-10-17 11:24:50 +02:00
aapostoliuk be21818313 nhrpd: Added a command "no tunnel protection vici profile PROFILE"
For compatibility with frr-reload, a command
"no tunnel protection [vici profile PROFILE [fallback-profile FALLBACK]]"
was added.

Signed-off-by: aapostoliuk <a.apostoliuk@vyos.io>
2024-09-10 14:37:24 +03:00
Louis Scalbert cdd9dee9b8 nhrpd: fix show nhrp shortcut json
Fix show nhrp shortcut json

Fixes: 87b9e98203 ("nhrpd: add json support to show nhrp vty commands")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-08-30 14:59:22 +02:00
Dave LeRoy 55de91d853 nhrpd: Fixes auth config change bug
Freeing auth-token does not set nifp->auth_token to NULL.
Explicitly set auth_token to NULL when deleting auth config in order
for write config logic to succeed.

Fix bug #16359

Signed-off-by: Dave LeRoy <dleroy@labn.net>
2024-07-17 10:37:44 -07:00
Dave LeRoy b5540d326b nhrpd: add cisco-authentication password support
Taking over this development from https://github.com/FRRouting/frr/pull/14788

This commit addresses 4 issues found in the previous PR

1) FRR would accept messages from a spoke without authentication when FRR NHRP had auth configured.
2) The error indication was not being sent in network byte order
3) The debug print in nhrp_connection_authorized was not correctly printing the received password
4) The addresses portion of the mandatory part of the error indication was invalid on the wire (confirmed in wireshark)

Signed-off-by: Dave LeRoy <dleroy@labn.net>
Co-authored-by: Volodymyr Huti <volodymyr.huti@gmail.com>
2024-06-10 16:39:21 -07:00
Volodymyr Huti 51f0700286 nhrp: add cisco-authentication password support
Implemented:
- handling 8 char long password, aka Cisco style.
- minimal error inidication routine
- test case, password change affects conection

Signed-off-by: Volodymyr Huti <v.huti@vyos.io>
2024-06-10 16:39:21 -07:00
David Lamparter acddc0ed3c *: auto-convert to SPDX License IDs
Done with a combination of regex'ing and banging my head against a wall.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-09 14:09:11 +01:00
Donald Sharp cf00164b69 *: Create and use infrastructure to show debugs in lib
There are lib debugs being set but never show up in
`show debug` commands because there was no way to show
that they were being used.  Add a bit of infrastructure
to allow this and then use it for `debug route-map`

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-10-07 12:39:05 -04:00
Donatas Abraitis 47e1288431 *: Replace sockunion2str => %pSU
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-06-21 13:34:56 +03:00
Donatas Abraitis 3757f96485 bgpd,pimd,isisd,nhrpd: Convert to vty_json()
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2022-01-31 21:20:41 +02:00
Igor Ryzhov 788a036fdb *: do not print vrf name for interface config when using vrf-lite
VRF name should not be printed in the config since 574445ec. The update
was done for NB config output but I missed it for regular vty output.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2022-01-24 14:44:05 +03:00
David Lamparter db4db2bbda nhrpd: convert mcast list to DLIST
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-10-19 14:58:47 +02:00
David Lamparter 2ab2a76101 nhrpd: convert nhs list to DLIST
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-10-19 14:55:39 +02:00
David Lamparter 8268be3d16
Merge pull request #9496 from idryzhov/vrf-cmd-init-unused-arg
lib: remove unused argument from vrf_cmd_init
2021-08-27 10:39:45 +02:00
Igor Ryzhov cfc369c43a lib: remove unused argument from vrf_cmd_init
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-08-26 12:01:22 +03:00
Igor Ryzhov 07679ad98a *: explicitly print "exit" at the end of every node config
There is a possibility that the same line can be matched as a command in
some node and its parent node. In this case, when reading the config,
this line is always executed as a command of the child node.

For example, with the following config:
```
router ospf
 network 193.168.0.0/16 area 0
!
mpls ldp
 discovery hello interval 111
!
```
Line `mpls ldp` is processed as command `mpls ldp-sync` inside the
`router ospf` node. This leads to a complete loss of `mpls ldp` node
configuration.

To eliminate this issue and all possible similar issues, let's print an
explicit "exit" at the end of every node config.

This commit also changes indentation for a couple of existing exit
commands so that all existing commands are on the same level as their
corresponding node-entering commands.

Fixes #9206.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-08-23 22:08:20 +03:00
Donald Sharp 2570a9f165
Merge pull request #8262 from reubendowle/fixes/nhrp-misc-fixes
nhrp misc fixes
2021-08-08 07:27:41 -04:00
Dmitrii Turlupov 7a807a20d9 nhrp: fix display of nhs command.
Before:
ip nhrp nhs dynamicnbma 192.168.1.1

After:
ip nhrp nhs dynamic nbma 192.168.1.1

Signed-off-by: Dmitrii Turlupov <dturlupov@factor-ts.ru>
2021-08-03 14:10:54 +03:00
Igor Ryzhov 9da01b0b7b *: cleanup interface node installation
The only difference in daemons' interface node definition is the config
write function. No need to define the node in every daemon, just pass
the callback as an argument to a library function and define the node
there.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-07-29 21:35:25 +03:00
Igor Ryzhov f5eef2d5a8 lib: remove vrf-interface config when removing the VRF
If we have the following configuration:
```
vrf red
 smth
 exit-vrf
!
interface red vrf red
 smth
```
And we delete the VRF using "no vrf red" command, we end up with:
```
interface red
 smth
```
Interface config is preserved but moved to the default VRF.

This is not an expected behavior. We should remove the interface config
when the VRF is deleted.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-06-21 18:04:46 +03:00
Amol Lad 2b55509d6c nhrpd: Clear cache when shortcuts are cleared
This is required because with the cache entry in place traffic will continue
via the shortcut path until the cache entry expires.

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
2021-05-18 14:27:05 +12:00
Reuben Dowle f07757ae1e nhrpd: Fix corrupt address being shown for shortcuts with no cache entry
Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
2021-05-18 14:27:05 +12:00
Reuben Dowle 46d3c1859b nhrpd: Change sockunion2str to %pSU in a few places
Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
2021-04-08 08:45:51 +12:00
Amol Lad 9084e20961 nhrpd: Introduce new - nflog mutlicast-nflog-group (1-65535) - command
Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
2021-04-06 09:23:42 +12:00
Reuben Dowle 0f8595a9f4 nhrpd: Fix style violation issues
Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
2021-04-06 09:23:42 +12:00
Amol Lad fa31fcf2ea nhrpd: Add support for forwarding multicast packets
Forwarding multicast is a pre-requisite for allowing multicast based routing
protocols such as OSPF to work with DMVPN

This code relies on externally adding iptables rule. For example:
iptables -A OUTPUT -d 224.0.0.0/24 -o gre1 -j NFLOG --nflog-group 224

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
2021-04-06 09:22:59 +12:00
Reuben Dowle d0c9d09aa9 nhrpd: Ensure invalid pointer is not used if two NAT extensions received
Also cleanup some minor style issues

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
2021-04-01 14:06:24 +13:00
Philippe Guibert 0551aeadff nhrpd: Make some debug prints more informative
Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
2021-03-29 10:21:16 +13:00
Amold Lad bcf5673d61 nhrpd: Display post-nat NBMA for local addresses
Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
2021-03-29 10:17:19 +13:00
Reuben Dowle 00683a1479 nhrpd: Fix some style issues
Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
2021-03-19 09:31:45 +13:00
Amol Lad 85365e51f0 nhrpd: Add Claimed NBMA field in sh ip nhrp cache output
Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
2021-03-18 16:35:41 +13:00
Philippe Guibert fef2ed139d nhrpd: cache config may disappear if iface not present at startup
When interface not present at config time, store separately the list of
config parameters. Then, when interface is ready and an address has been configured, the nbma setting is done. Reversely, when interface disappears,
there is no need to keep the maps present, then keep only the configuration.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2020-11-23 17:16:35 +00:00
Igor Ryzhov dd73744d8c *: move "show debugging ..." commands to enable node
Use the same node for "show debugging" commands in all daemons.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-10-02 15:06:05 +03:00
David Lamparter f4b8291fcb *: move CLI node names to cmd_node->name
And again for the name.  Why on earth would we centralize this, just so
people can forget to update it?

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:59 +02:00
David Lamparter 243895805a *: move CLI parent data to cmd_node->parent_node
Same as before, instead of shoving this into a big central list we can
just put the parent node in cmd_node.

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
David Lamparter 612c2c15d8 *: remove second parameter on install_node()
There is really no reason to not put this in the cmd_node.

And while we're add it, rename from pointless ".func" to ".config_write".

[v2: fix forgotten ldpd config_write]

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
David Lamparter 249a771b63 *: remove cmd_node->vtysh
The only nodes that have this as 0 don't have a "->func" anyway, so the
entire thing is really just pointless.

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
Donald Sharp e0a1fb2235 nhrpd: Actually allow json output
Add the correct pointer check to see if we should
be doing json output.

Discovered by SA.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-04-15 09:25:54 -04:00
Donatas Abraitis d03e644c2b
Merge pull request #5825 from pguibert6WIND/nhrp_vty
nhrpd: add json support to show nhrp vty commands
2020-03-22 14:21:42 +02:00
Philippe Guibert db89e514c7 nhrpd: fix clear nhrp cache dynamic entries
as the helper said, the dynamic cache entries should be flushed once the
vty command 'clear ip/ipv6 nhrp cache' mentions. This was not the case.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2020-03-19 12:09:06 +01:00
Philippe Guibert 87b9e98203 nhrpd: add json support to show nhrp vty commands
- add json support for show nhrp vty commands.
- support for 'show dmvpn [json]' format.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2020-03-13 16:58:14 +01:00
Donatas Abraitis 0d6f7fd6fd *: Replace sizeof something to sizeof(something)
Satisfy checkpatch.pl requirements (check for sizeof without parenthesis)

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-08 21:44:53 +02:00
Jafar Al-Gharaibeh 29ff6b5cb6 nhrpd: allow no nhrp map cmd to match the configured cmd
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2020-02-14 11:49:58 -06:00
Donatas Abraitis b550350618 nhrp: Make sure no ip nhrp map <something> works as expected
We passed peer as NULL and nothing happened.

exit2-debian-9# conf
exit2-debian-9(config)# int gre1
exit2-debian-9(config-if)# ip nhrp map 1.1.1.1 local
exit2-debian-9(config-if)# ip nhrp map 2.2.2.2 3.3.3.3
exit2-debian-9(config-if)# do sh run
...
!
interface gre1
 ip nhrp map 1.1.1.1 local
 ip nhrp map 2.2.2.2 3.3.3.3
!
...
exit2-debian-9(config-if)# no ip nhrp map 1.1.1.1
exit2-debian-9(config-if)# do sh run
...
!
interface gre1
 ip nhrp map 2.2.2.2 3.3.3.3
!

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-10-25 13:05:49 +03:00
Lou Berger 996c93142d *: conform with COMMUNITY.md formatting rules, via 'make indent'
Signed-off-by: Lou Berger <lberger@labn.net>
2018-03-06 14:04:32 -05:00
Renato Westphal efd7904eab *: add missing \n in some help strings
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-24 19:30:30 -02:00
Renato Westphal 451fda4f9a *: use the FOR_ALL_INTERFACES abstraction from babeld
This improves code readability and also future-proofs our codebase
against new changes in the data structure used to store interfaces.

The FOR_ALL_INTERFACES_ADDRESSES macro was also moved to lib/ but
for now only babeld is using it.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-10 09:05:46 -03:00