Commit Graph

39 Commits

Author SHA1 Message Date
mobash-rasool
32701c48d8
Merge pull request #12920 from sri-mohan1/sri-mohan-ldp
ldpd: changes for code maintainability
2023-03-02 00:40:26 +05:30
sri-mohan1
2073f92908 ldpd: changes for code maintainability
these changes are for improving the code maintainability and readability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2023-03-01 17:24:54 +05:30
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
Donatas Abraitis
1ce23106eb *: Drop deprecated incorrect JSON fields with wrong naming
Deprecation cycle already passed.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-01-31 10:18:28 +02:00
Donatas Abraitis
77a2f8e592 *: Add camelCase JSON keys in addition to PascalCase
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2022-02-03 10:48:06 +02:00
Donatas Abraitis
038c0a8fcf ldpd: Convert vty_out to vty_json for JSON
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-25 17:50:53 +02:00
Donatas Abraitis
4e9a98636f *: Remove unused variables
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-18 18:45:41 +02:00
Donatas Abraitis
19fee2b7eb ldpd: Replace inet_ntop to %pI4/6 for JSON outputs
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-18 11:35:31 +02:00
Mark Stapp
903a72269a ldpd: replace inet_ntoa
Replace all use of inet_ntoa; use pI4 or inet_ntop instead.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-10-22 15:49:56 -04:00
Karen Schoener
e1894ff70f ldpd: Adding support for LDP IGP Synchronization
Signed-off-by: Lynne Morrison <lynne@voltanet.io>
Signed-off-by: Karen Schoener <karen@voltanet.io>
2020-09-09 10:45:41 -04:00
David Lamparter
3efd0893d0 *: un-split strings across lines
Remove mid-string line breaks, cf. workflow doc:

  .. [#tool_style_conflicts] For example, lines over 80 characters are allowed
     for text strings to make it possible to search the code for them: please
     see `Linux kernel style (breaking long lines and strings)
     <https://www.kernel.org/doc/html/v4.10/process/coding-style.html#breaking-long-lines-and-strings>`_
     and `Issue #1794 <https://github.com/FRRouting/frr/issues/1794>`_.

Scripted commit, idempotent to running:
```
python3 tools/stringmangle.py --unwrap `git ls-files | egrep '\.[ch]$'`
```

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-07-14 10:37:25 +02:00
Karen Schoener
fd563cc7f3 ldpd: Relay data plane pseudowire status in LDP notification
Provide a way for the data plane to indicate pseudowire
status (such as: not forwarding, AC failure).

On a data plane pseudowire install failure, data plane
sets the pseudowire status.
Zebra relays the pseudowire status to LDP.
LDP includes the pseudowire status in the LDP notification
to the LDP peer.

Signed-off-by: Karen Schoener <karen@voltanet.io>
2020-06-01 13:21:37 -04:00
lynne
6bbdd9e979 ldpd and Zebra: Expand existing debug commands.
L2VPN PW are very hard to determine why they do not come up.  The following
fixes expand the existing show commands in ldp and zebra to display a
reason why the PW is in the DOWN state and also display the labeled nexthop
route selected to reach the PW peer.  By adding this information it will
provide the user some guidance on how to debug the PW issue.  Also fixed an
assert if labels were changed for a PW that is between directly connected
peers.

Signed-off-by: Lynne Morrison <lynne@voltanet.io>
2020-05-11 16:22:52 -04:00
Quentin Young
772270f3b6 *: sprintf -> snprintf
Replace sprintf with snprintf where straightforward to do so.

- sprintf's into local scope buffers of known size are replaced with the
  equivalent snprintf call
- snprintf's into local scope buffers of known size that use the buffer
  size expression now use sizeof(buffer)
- sprintf(buf + strlen(buf), ...) replaced with snprintf() into temp
  buffer followed by strlcat

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-04-20 19:14:33 -04:00
Donald Sharp
7f6778408b ldpd: Fix compiler warning about uninitialized rt
Certain compilers cannot recognize that rt is
actually being init'ed, but let's set it to
NULL 'till we get them updated.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-03 21:32:32 -04:00
Renato Westphal
f0722791a0 ldpd: add more filtering options in some "show" commands
Being able to filter the output of some "show" commands is super useful
when troubleshooting large MPLS networks.

Examples:

% show mpls ldp ipv4 binding 10.0.0.48/29 longer-prefixes neighbor 192.168.0.5
AF   Destination          Nexthop         Local Label Remote Label  In Use
ipv4 10.0.0.48/30         192.168.0.5     24          26                no
ipv4 10.0.0.52/30         192.168.0.5     25          27                no

% show mpls ldp ipv4 binding 10.0.0.48/29 longer-prefixes neighbor 192.168.0.5 detail json
{
  "10.0.0.48\/30":{
    "localLabel":"24",
    "advertisedTo":[
      {
        "neighborId":"192.168.0.5"
      }
    ],
    "remoteLabels":[
      {
        "neighborId":"192.168.0.5",
        "label":"26",
        "inUse":0
      }
    ]
  },
  "10.0.0.52\/30":{
    "localLabel":"25",
    "advertisedTo":[
      {
        "neighborId":"192.168.0.5"
      }
    ],
    "remoteLabels":[
      {
        "neighborId":"192.168.0.5",
        "label":"27",
        "inUse":0
      }
    ]
  }
}

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-09-28 21:51:05 -03:00
Renato Westphal
1224e5c434 ldpd: convert CLI code to use DEFPY
Yay :)

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-07-31 08:56:44 -03:00
David Lamparter
625e016d14 *: remove VTYNL, part 6 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:03 +02:00
David Lamparter
61b7d449bd *: remove VTYNL, part 3 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:03 +02:00
David Lamparter
6d3c2ed4ed *: remove VTYNL, part 1 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:02 +02:00
David Lamparter
181039f3d7 *: ditch vty_outln(), part 2 of 2
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:19:58 +02:00
David Lamparter
5c7571d43f *: ditch vty_outln(), part 1 of 2
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-13 20:29:22 +02:00
Quentin Young
e31b6333f4 *: vty_outln (vty, "") --> vty_out (vty, VTYNL)
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29 17:34:56 +00:00
Quentin Young
1318e7c841 *: s/VTY_NEWLINE/VTYNL/g
Should be able to fit more vty_out onto one line now

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29 17:34:54 +00:00
Quentin Young
96ade3ed77 *: use vty_outln
Saves 400 lines

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29 17:31:28 +00:00
Renato Westphal
180fc2cd70 ldpd: update copyright information
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-06-16 14:43:55 -03:00
Renato Westphal
c740f7d367 ldpd: convert cli and get rid of the xml interface
The xml2cli.pl script was useful years ago when the vty code was very
rudimentary. This is not the case anymore, so convert all ldpd CLI
commands to use DEFUNs directly and get rid of the XML interface.

The benefits are:
* Consistency with the other daemons;
* One less build dependency (the LibXML perl module);
* Easier to add new commands.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-06-16 14:43:42 -03:00
David Lamparter
896014f4bc *: make consistent & update GPLv2 file headers
The FSF's address changed, and we had a mixture of comment styles for
the GPL file header.  (The style with * at the beginning won out with
580 to 141 in existing files.)

Note: I've intentionally left intact other "variations" of the copyright
header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15 16:37:41 +02:00
Renato Westphal
465f1f9e96 ldpd: minor changes in the output of some show commands
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-04-26 10:36:33 -03:00
Renato Westphal
f790d62ad1 ldpd: fix harmless maybe-uninitialized warning
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-03-31 11:10:33 -03:00
Renato Westphal
ed3012da23 ldpd: replace all occurrences of '\n' with VTY_NEWLINE
The format of the terse output of several ldpd's show commands was copied
from the OpenBSD's ldpctl(8) control program. In the process of doing
that I forgot to replace the occurrences of '\n' with VTY_NEWLINE.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-03-27 21:50:37 -03:00
Renato Westphal
0f7b5df925 ldpd: provide more detailed information in some show commands
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-03-20 21:42:14 -03:00
Renato Westphal
99cfc17f76 ldpd: add commands to show sent/rcvd capabilities
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-03-20 21:42:14 -03:00
Renato Westphal
bc0eb287fa ldpd: provide both a brief and a detailed version of some show commands
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-03-20 21:42:14 -03:00
Donald Sharp
1a35e2e565 Merge remote-tracking branch 'origin/stable/2.0' 2017-02-02 10:42:51 -05:00
Renato Westphal
372b8bd381 ldpd: add ctl_socket cli option to override the compiled-in location for the control socket
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-01-26 00:44:42 +07:00
Renato Westphal
a5d1051217 ldpd: reorganize json support and fix a few issues
* reorganize code to improve maintainability;
* add json output for the l2vpn show commands as well;
* in "show mpls ldp discovery json", nest the adjacencies inside the
  respective interfaces. Also, fix a segfault when trying to show a
  targeted adjacency;
* in "show mpls ldp neighbor", show the address-family of the adjacencies
  of each neighbor. Also, remove "downstreamUnsolicited":true from
  the output;
* in "show mpls ldp interface json", show all interface/address-family
  combinations;

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-01-13 14:43:44 -02:00
Daniel Walton
e8dbef0420 ldpd: json support for show commands
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2017-01-13 14:43:39 -02:00
Renato Westphal
eac6e3f027 ldpd: adapt the code for Quagga
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-09-23 09:31:09 -04:00