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
F133293338: D50447.id155802.diff
Fri, Oct 24, 5:05 PM
Unknown Object (File)
Sun, Oct 19, 1:42 AM
Unknown Object (File)
Sat, Oct 18, 1:12 PM
Unknown Object (File)
Thu, Oct 9, 11:29 PM
Unknown Object (File)
Sun, Oct 5, 12:57 PM
Unknown Object (File)
Sun, Sep 28, 9:15 PM
Unknown Object (File)
Fri, Sep 26, 4:14 PM
Unknown Object (File)
Sep 24 2025, 1:43 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 64333
Build 61217: 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
532

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
532

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
532

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