We'll re-use these in a future wg_aip_del() to perfectly reconstruct
what we expect to find in a_addr/a_mask.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
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. |