git: wg: Destroy newly created peers on failure

Aaron LI aly at crater.dragonflybsd.org
Wed Jul 29 18:11:45 PDT 2026


commit 2e3d5fe8b716027e80e19a7fba3886372418a247
Author: Aaron LI <aly at aaronly.me>
Date:   Fri Jul 24 10:22:08 2026 +0800

    wg: Destroy newly created peers on failure
    
    Previously, a newly created peer was not destroyed even if there were
    errors in configuring it, e.g., invalid AllowedIPs.  The rationale was
    that the user could correct the error by issuing another 'ifconfig'
    command with the fixed arguments.
    
    Now destroy the new peer if an error occurs, making a complex 'ifconfig'
    command that adds a peer atomic.  This matches the behavior of FreeBSD.
    
    As part of this change, refactor wg_ioctl_set() by extracting
    wg_ioctl_set_peer() to handle a single peer, and add  'const' qualifiers
    where appropriate.

Summary of changes:
 sys/net/wg/if_wg.c | 165 +++++++++++++++++++++++++++++------------------------
 1 file changed, 92 insertions(+), 73 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/2e3d5fe8b716027e80e19a7fba3886372418a247


-- 
DragonFly BSD source repository


More information about the Commits mailing list