summaryrefslogtreecommitdiff
path: root/vrrpd/vrrp_packet.c
AgeCommit message (Collapse)Author
2024-10-07vrrpd: iterate over all ancillary messagesRafael Zalamena
Assign the return of `CMSG_NXTHDR` so we can really iterate over the ancillary data. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2023-02-09*: auto-convert to SPDX License IDsDavid Lamparter
Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-11-25vrrpd: add IPv4 pseudoheader option for VRRPv3Siger Yang
This commit adds a new option to control whether a VRRPv3 group accepts / computes its checksum with a prepended IPv4 pseudoheader. This should improve interoperability with other devices. Signed-off-by: Siger Yang <siger.yang@outlook.com>
2021-03-17*: require semicolon after DEFINE_MTYPE & coDavid Lamparter
Back when I put this together in 2015, ISO C11 was still reasonably new and we couldn't require it just yet. Without ISO C11, there is no "good" way (only bad hacks) to require a semicolon after a macro that ends with a function definition. And if you added one anyway, you'd get "spurious semicolon" warnings on some compilers... With C11, `_Static_assert()` at the end of a macro will make it so that the semicolon is properly required, consumed, and not warned about. Consistently requiring semicolons after "file-level" macros matches Linux kernel coding style and helps some editors against mis-syntax'ing these macros. Signed-off-by: David Lamparter <equinox@diac24.net>
2020-07-26vrrpd: Make clang 11 happyDonald Sharp
Recent changes to remove PRIu... in commit: 6cde4b45528e52819c803de92d10d4be3abddf29 causes clang 11 to be unhappy, with length of field warnings. Modify the offending code to compile properly using that compiler. I've tested against clang 11 and gcc 9.3 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-07-14*: remove PRI[udx](8|16|32)David Lamparter
These are completely pointless and break coccinelle string replacements. Scripted commit, idempotent to running: ``` python3 tools/stringmangle.py --pri8-16-32 `git ls-files | egrep '\.[ch]$'` ``` Signed-off-by: David Lamparter <equinox@diac24.net>
2019-12-02*: generously apply constDavid Lamparter
const const const your boat, merrily down the stream... Signed-off-by: David Lamparter <equinox@diac24.net>
2019-07-08vrrpd: use protocol number constantQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-06-21vrrpd: use MTYPE_STATICDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-05-17vrrpd, lib: style fixesQuentin Young
Fixup: * Blank lines after declarations * Trailing whitespace * Braces and parentheses Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17vrrpd: make useless assert usefulQuentin Young
Assert would always come back true due to improper placement. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17vrrpd: include auth fields in v2 packetQuentin Young
Based on looking at other vendors, seems I misinterpreted the RFC - type 0 auth (no authentication) still requires the authentication fields to be present, just set to all zero. This should fix VRRPv2 interop with other vendors. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17vrrpd: clean up loggingQuentin Young
* Always include address family when available * Log advertisement decodes on one line Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17vrrpd: fix bad fmt specifiers in dgram validatorQuentin Young
They used a %u where they should have used a PRIu16, and a %lu where they wanted a %zu. Shame! Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17vrrpd: properly retrieve pkt src addressQuentin Young
* Fix null dereference when retrieving IPv6 source address * Change IPv4 code path to use system-specified source address instead of the one delivered in the IPv4 raw header Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17vrrpd: use debugging knobsQuentin Young
* Gate all debugging messages with the debugging system * Simplify a bit of debugging where it was easy to do inline Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17vrrpd: allow creation of adverts with no addressesQuentin Young
Fuzz testing revealed a crash in which VRRPD tries to create an advertisement packet with no IP addresses. Should never occur under normal use but might as well patch. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17vrrpd: ingress pkt validation dbg cleanupsQuentin Young
* Use proper format specifiers for some data * Print the correct sizes when reporting IP size errors Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17vrrpd: specify version when parsing vrrp packetQuentin Young
Move a bit more validation into vrrp_packet.c Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17vrrpd: add support for VRRPv2Quentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17vrrpd: use ipaddr size macroQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17vrrpd: check rx'd advertisement checksumQuentin Young
And retrieve source address, since we need it anyway. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17vrrpd: cleanup vrrp packet crafting codeQuentin Young
* Prefix all packet functions with 'vrrp_pkt' * Break out checksum computation into separate function * Accept version field when building advertisements * Update doc comments Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17vrrpd: use correct mtypesQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17vrrpd: fix headersQuentin Young
* Add include guards where missing * Add include guard comments where missing * Fix copyright notices * Sort includes Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17vrrpd: remove bad priority checkQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17vrrpd: compute VRRPv3 checksumQuentin Young
Correctly compute VRRPv3 checksum. Pseudoheaders are used for both IPv4 and IPv6. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17vrrpd: add initial macvlan supportQuentin Young
* Search for macvlan interfaces with the appropriate name and MAC address when starting up a new VRRP instance * Split VRRP socket into two; one for Tx, one for Rx * Bind Tx socket to the macvlan subinterface so our VRRP advertisements go out with the correct MAC address * Send ARP requests from this macvlan subinterface * Improve error messaging Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17vrrpd: read and validate vrrp advertisementsQuentin Young
* Validate IPvX headers and packet contents * Remove filter of non-255 TTL IPv4 packets; better to receive, log and drop them ourselves * Set outgoing packet TTL / hop limit to 255 * Use existing sockopt functions Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17vrrpd: ipv6 supportQuentin Young
Add initial support for IPv6. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17vrrpd: fix packet encodeQuentin Young
* Properly encode VRRP packets * Calculate checksum appropriately * Update signature to provide caller both packet and result length Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17vrrpd: merge keepalived packet headerQuentin Young
Pick up some smartness from keepalived. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17vrrpd: initial commitQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>