HomeFreeBSD

kern: wg: refactor out some repetitive bits in allowed-ip config

Description

kern: wg: refactor out some repetitive bits in allowed-ip config

The only difference in the wg_aip_add() call after IP validation is the
address family. Just pull that out into a variable and avoid the two
different callsites for wg_aip_add(). A future change will add a new
call for each case to remove an address from the peer, so it's nice to
avoid needing to repeat the logic for two different branches.

Reviewed by: Aaron LI, Jason A. Donenfeld, ivy, jhb, markj
Differential Revision: https://reviews.freebsd.org/D50446

Details

Provenance
kevansAuthored on Jun 26 2025, 2:57 AM
Reviewer
ivy
Differential Revision
D50446: kern: wg: refactor out some repetitive bits in allowed-ip config
Parents
rGdca2ab32e831: pf.4/pfsync.4: Separate sysctl/tunables >> SYNOPSIS
Branches
Unknown
Tags
Unknown