Commit Graph

28532 Commits

Author SHA1 Message Date
anlan_cs
b0b9a2fe52 bgpd,zebra: correct one debug log for evpn-mh
Correct one debug log in evpn-mh.
BTW, correct one misspelled word in comment.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-05-12 02:19:51 -04:00
Francois Dumontet
4ab8edec25 BGPD: fix invalid bmp POST POLICY flag
description:
BMP Per Peer Headers of Route Monitoring messages with UPDATE and
WITHDRAW notificatiosn ( not the sync ones at Initiation) are
all typed as POST POLICY.

fix:
notify Pre policy UPDATES AND WITHDRAWS with  Per Peer Header type set
to PRE POLICY (0)

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
2022-05-11 16:08:56 +02:00
Donatas Abraitis
6006b807b1 *: Properly use memset() when zeroing
Wrong: memset(&a, 0, sizeof(struct ...));
    Good:  memset(&a, 0, sizeof(a));

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-11 14:08:47 +03:00
Donatas Abraitis
f51eeb864b ripd: Use correct usage of memcpy() when zeroing struct
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-11 14:08:46 +03:00
Donatas Abraitis
ab2c896a97 tools: Add coccinelle script to catch memset/memcpy wrong usage
Wrong: memset(&a, 0, sizeof(struct ...));
Good:  memset(&a, 0, sizeof(a));

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-11 13:12:22 +03:00
Donatas Abraitis
b5605493a4 bgpd: Use sizeof() for memset instead of numeric
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-11 13:10:41 +03:00
mobash-rasool
daa97042a2
Merge pull request #11151 from opensourcerouting/pim-various-20220506
pimd, pim6d: fix various smaller issues
2022-05-11 10:04:18 +05:30
anlan_cs
cabddbf5f6 bgpd: remove unncessary check for evpn
In current code, `build_evpn_type2_prefix()` doesn't distinguish ARP
according to the `ip` parameter. The `ip` parameter from caller is
always non-NULL.

Be consistent and not confused, just remove the unnecessary check.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-05-10 22:21:32 -04:00
Mark Stapp
00358e444e
Merge pull request #11155 from LabNConsulting/ziemba/link-delay-min-max
zebra bugfix interface link-param: allow delay min <= avg <= max (was: min<avg<max)
2022-05-10 11:31:52 -04:00
Russ White
c9fd558358
Merge pull request #11160 from opensourcerouting/feature/BGP_NOTIFY_CEASE_ADMIN_RESET_hard_reset
bgpd: Send Hard Reset Notification for BGP_NOTIFY_CEASE_ADMIN_RESET
2022-05-10 11:25:13 -04:00
anlan_cs
905b12b263 ospf6d: add header size check for LSA
Add header size check for safe. If the check fails, just jump out of current
function.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-05-10 10:03:57 -04:00
Donatas Abraitis
b7a367318c debian: Require librtr >= 0.8.0
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-10 09:52:21 +03:00
Donatas Abraitis
0ad713488e redhat: Require librtr >= 0.8.0
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-10 09:48:30 +03:00
Donatas Abraitis
f82dd1938f snap: Use librtr >= 0.8.0 for snap packages
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-10 09:48:30 +03:00
Donatas Abraitis
f6823d912e snap: Drop trailing whitespaces in snapcraft.yaml.in
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-10 09:48:30 +03:00
Donatas Abraitis
124bd0e1b2 configure: Require librtr >= 0.8.0
We ship 0.8.0 in our repos.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-10 09:48:30 +03:00
Donatas Abraitis
d6a4be826e configure: Drop trailing whitespaces
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-10 09:48:30 +03:00
Donatas Abraitis
e7ce634f31 bgpd: Reset bgp_notify.hard_reset on receive to avoid stale data
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-10 09:25:59 +03:00
Donatas Abraitis
1ae314be4f bgpd: Send Hard Reset Notification for BGP_NOTIFY_CEASE_ADMIN_RESET
`clear bgp neighbor` should send Hard Reset and graceful restart should be
activated. Let's make this adjustable.

https://datatracker.ietf.org/doc/html/rfc8538#section-5.1

   +-------+------------------------------------+----------------------+
   | Value |                Name                |  Suggested Behavior  |
   +-------+------------------------------------+----------------------+
   |   1   | Maximum Number of Prefixes Reached |      Hard Reset      |
   |   2   |      Administrative Shutdown       |      Hard Reset      |
   |   3   |         Peer De-configured         |      Hard Reset      |
   |   4   |        Administrative Reset        | Provide user control |
   |   5   |        Connection Rejected         |    Graceful Cease    |
   |   6   |     Other Configuration Change     |    Graceful Cease    |
   |   7   |  Connection Collision Resolution   |    Graceful Cease    |
   |   8   |          Out of Resources          |    Graceful Cease    |
   |   9   |             Hard Reset             |      Hard Reset      |
   +-------+------------------------------------+----------------------+

Enabled by default.

Co-authored-by: Biswajit Sadhu <biswajit.sadhu@gmail.com>
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-10 09:04:25 +03:00
Russ White
026f28e8ca
Merge pull request #11138 from opensourcerouting/fix/rpki
bgpd: RPKI reverts, nits...
2022-05-09 19:36:02 -04:00
Russ White
2cf70f4ee0
Merge pull request #11147 from opensourcerouting/feature/gr_n-bit_cli_knob
bgpd: Add CLI knob to enable graceful restart for BGP notifications
2022-05-09 19:35:14 -04:00
Igor Ryzhov
286320b09f
Merge pull request #11148 from anlancs/fix/bfdd-wrong-discriminator-mismatch
bfdd: fix override between sessions
2022-05-10 00:32:08 +03:00
Igor Ryzhov
2a3807c3ce
Merge pull request #11163 from opensourcerouting/fix/same_type_casting
*: Avoid casting to the same type as on the left
2022-05-10 00:16:30 +03:00
Russ White
0c8d3bd3c3
Merge pull request #11154 from opensourcerouting/fix/increase_bgp_flags
bgpd: Use uint64_t for bgp->flags
2022-05-09 14:50:29 -04:00
Russ White
45fa90cca4
Merge pull request #11161 from opensourcerouting/fix/no_need_to_check_for_xcalloc
zebra, ospf6d: Do not check if NULL for XCALLOC()
2022-05-09 14:44:36 -04:00
Russ White
fb10a9479b
Merge pull request #11162 from anlancs/fix/bgpd-cleanup-5
bgpd: remove unnecessary check for evpn
2022-05-09 14:43:03 -04:00
mobash-rasool
d4caf64ef7
Merge pull request #11170 from anlancs/fix/bgpd-cleanup-8
bgpd: remove one unnecessary parameter for evpn-mh
2022-05-09 22:42:22 +05:30
Russ White
22d9780f3e
Merge pull request #11096 from anlancs/fix/bgpd-unlock
bgpd: clear misleading mismatched check
2022-05-09 10:46:50 -04:00
anlan_cs
e0a798819b bgpd: remove one unnecessary parameter for evpn-mh
The "add" parameter of `bgp_evpn_mh_route_update()` makes no sense.
Just remove it to clarify this function, and remove the relevant check
with "add" as well.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-05-09 08:27:20 -04:00
anlan_cs
879e43a550 bgpd: remove unnecessary check for evpn
When `bgp_evpn_new()` is called, the `bgp` parameter MUST be non-NULL,
remove this unnecessary check and remove the NULL check for returned
`struct bgpevpn *`, which should be non-NULL.

And modify `import_rt_new()` in the same way.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-05-08 09:25:12 -04:00
Donatas Abraitis
8998807f69 *: Avoid casting to the same type as on the left
Just not necessary.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-08 16:07:42 +03:00
Donatas Abraitis
432ee88c21 zebra, ospf6d: Do not check if NULL for XCALLOC()
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-08 15:43:21 +03:00
anlan_cs
17151ae94b bgpd: clear misleading mismatched check
Two changes for `delete_global_type2_routes()`:

1) Remove check of `bgp_dest_has_bgp_path_info_data(rddest)`.
It is unnecessary(`dest->info` should not be NULL) and misleading.
`if (rddest && bgp_dest_has_bgp_path_info_data(rddest))`
Use (locked) node with this check, but unlock with `if (rddest)`,
The mismatched condition is misleading, there seems to be a
mistake to extra unlock.
Just make it clear, immediately exit with `(!rddest)`.

2) Remove checking returned value for it, and use `void` as return type.
It is unnecessary and wrong. Even the check failed, it should continue
to delete other types of routes.
Just remove the check and go through.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-05-07 22:20:15 -04:00
Donatas Abraitis
0ef5ec616b
Merge pull request #11156 from donaldsharp/spelling_three
valgrind issues and general cleanup
2022-05-07 18:44:59 +03:00
Donald Sharp
14678bfa0d isisd: Prevent direct copy of different size prefix'es
Memory is allocated for a `struct prefix_ipv6` but
it was directly copied into a `struct prefix` via
direct pointer copy, which leads to a read past
end of memory.  Fix by using prefix_copy

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-05-06 21:24:56 -04:00
Donald Sharp
ae6ca0e643 isisd: Remove unneeded pre-declarations
I don't know what was going on.  Removing the weird c structures.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-05-06 21:19:07 -04:00
Donald Sharp
a976aa3cea isisd: Fix read past end of string
using a memcpy for a strdup'ed string.  bad mojo

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-05-06 21:05:38 -04:00
Donald Sharp
4c98b89e5c *: Fix doesnt spelling mistakes
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-05-06 20:38:40 -04:00
G. Paul Ziemba
d029fe275c zebra/interface.c: allow link-param delay min <= avg <= max
RFC 7471 Section 4.2.7:
	It is possible for min delay and max delay to be the same value.

    Prior to this change, the code required min < avg < max. This
    change allows min == avg and avg == max.

    test case:

    interface eth-rt1
      link-params
        delay 8000 min 8000 max 8000

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2022-05-06 14:48:31 -07:00
Donatas Abraitis
fd6b4f065a bgpd: Use uint64_t for bgp->flags
We will hit this soon because uint32_t will be not enough.

Two more flags gonna be added for rfc8538.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-06 22:12:41 +03:00
David Lamparter
9299cea5dc pim6d: docs for MLD show commands
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-05-06 16:02:02 +02:00
David Lamparter
df655593a2 pim6d: change MLD socket to be per VRF
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-05-06 16:02:02 +02:00
David Lamparter
d2951219a1 pim6d: add some show commands for MLD
Just some basic show commands to get going.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-05-06 16:02:02 +02:00
David Lamparter
5afe22f5bc pim6d: show MLD in running-config
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-05-06 16:02:02 +02:00
David Lamparter
aa2f934929 pim6d: count stats for MLD
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-05-06 16:02:02 +02:00
David Lamparter
5e5034b0a2 pim6d: add fresh MLD implementation
Fresh ground-up MLD implementation with subscriber-tracking for MLDv2.
Intended to be adapted for IPv4 and replace the IGMP implementation at a
later point.

Tested in ANVL, currently at 94/116.  Some issues/TODOs are left in the
code as CPP_NOTICE markers, but the code is very much good enough to
proceed since otherwise we're blocked on overall PIM v6 progress.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-05-06 16:01:59 +02:00
David Lamparter
993e3d8e13 pimd: un-dependency-hell pim_instance.h
This is causing build issues on BSD by including (transitively)
`linux/mroute6.h` - try to address by disentangling the headers a bunch.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-05-06 15:10:57 +02:00
David Lamparter
1b00ed5f65 pimd: pass down length for register messages
The IPv6 `mrt6msg` kernel pseudo-header does not have a length field;
accessing what would be the IPv6 payload length reads zeroes.

Pass down the proper length and use that instead.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-05-06 12:42:29 +02:00
David Lamparter
beb016c8fa pim6d: fix Linux kernel header macro
__KERNEL_DIV_ROUND_UP isn't in older versions of linux/const.h.  Rather
than pull in more headers, just inline the definition.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-05-06 12:06:27 +02:00
anlan_cs
7ffd0b80aa bfdd: fix override between sessions
After two single-hop sessions (*no local address are configured*) on two
interfaces are UP, remove one address of one interface, both of them
(actually, quite independent sessions) come to be DOWN, not just one.

Consider two boxes: A with `a1` and `a2` adddress on two interfaces,
and B with `b1` and `b2`.
Two sessions are set up and ok: `s1` with <a1,b1> and `s2` with <a2,b2>.
After `a1` of A is removed, there is an unhappy coincidence:
1) On A: `s1` changes local address, and sends <a2,b1> packets with help
of route.
2) On B: wrongly regarded <a2,b1> packets with non-zero remote descriminator
as part of `s2`, and are dropped for mismatched remote remote descriminator.
3) On A: `s1` sends <a2,b1> packets with zero remote descriminator to
initialize this session.
4) On B: wrongly regarded <a2,b1> packets with zero remote descriminator as
part of `s2`. Then `s2` will vibrate.

So the good sessions are overridden.

In this case, the <a2,b1> packets with zero remote descriminator won't take
effect until the current good sessions become bad.

Since single-hop sessions are allowed to be set without bound inteface in
current code, this commit adds one check in `bfd_recv_cb()` to avoid wrong
override.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-05-06 01:28:21 -04:00