Page MenuHomeFreeBSD

kern: wg: split address/mask construction out of wg_aip_add()
ClosedPublic

Authored by kevans on May 21 2025, 4:00 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 20, 9:06 PM
Unknown Object (File)
Fri, Nov 14, 4:21 AM
Unknown Object (File)
Nov 8 2025, 11:59 AM
Unknown Object (File)
Nov 6 2025, 9:19 PM
Unknown Object (File)
Nov 5 2025, 6:35 AM
Unknown Object (File)
Nov 5 2025, 6:32 AM
Unknown Object (File)
Nov 5 2025, 6:24 AM
Unknown Object (File)
Nov 5 2025, 6:23 AM
Subscribers

Details

Summary

We'll re-use these in a future wg_aip_del() to perfectly reconstruct
what we expect to find in a_addr/a_mask.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 64779
Build 61663: arc lint + arc unit

Event Timeline

This revision is now accepted and ready to land.May 23 2025, 7:31 PM
sys/dev/wg/if_wg.c
533

This function has quite a few parameters. Why not use something like:

static int
wg_aip_addrinfo(struct wg_aip *aip, const void *addr, uint8_t cidr)
{
    switch (aip->af) {
    ...
    }
}

static int
wg_aip_add(...)
{
    ...
    ret = wg_aip_addrinfo(...);
    if (ret != 0) { ... };

    MPASS(af == AF_INET4 || af == AF_INET6);
    root = af == AF_INET ? sc->sc_aip4 : sc->sc_aip6;
    ...
}
sys/dev/wg/if_wg.c
533

Generally because of the next review, where we have to construct an addr/mask before we can find the existing entry.

sys/dev/wg/if_wg.c
533

I had a rough look at the next review as well, and I think it's okay to simplify this function by using an on-stack struct wg_aip aip instead of struct aip_addr a_addr, a_mask.

kevans marked 2 inline comments as done.

Simplify wg_aip_addrinfo() a bit more based on feedback

This revision now requires review to proceed.Jun 12 2025, 12:32 AM
This revision is now accepted and ready to land.Jun 17 2025, 5:02 PM