|
|
|
@ -628,7 +628,7 @@ static int wg_set_peer_allowed_ips(char *iface, char *pubkey, char *allowed_ips,
|
|
|
|
|
return wg_route_peer_allowed_ips(iface, allowed_ips, fwmark);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int wg_add_peer(char *iface, char *pubkey, char *allowed_ips, const char *presharedkey, char *keepalive, const char *endpoint, const char *fwmark, const char *port)
|
|
|
|
|
static void wg_add_peer(char *iface, char *pubkey, char *allowed_ips, const char *presharedkey, char *keepalive, const char *endpoint, const char *fwmark, const char *port)
|
|
|
|
|
{
|
|
|
|
|
/* set allowed ips / create peer */
|
|
|
|
|
wg_set_peer_allowed_ips(iface, pubkey, allowed_ips, fwmark);
|
|
|
|
@ -644,8 +644,6 @@ static int wg_add_peer(char *iface, char *pubkey, char *allowed_ips, const char
|
|
|
|
|
/* set peer endpoint */
|
|
|
|
|
if (endpoint[0] != '\0')
|
|
|
|
|
wg_set_peer_endpoint(iface, pubkey, endpoint, port);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int decode_base64(const char src[static 4])
|
|
|
|
@ -722,14 +720,14 @@ static void wg_pubkey(const char *privkey, char *pubkey)
|
|
|
|
|
key_to_base64(pubkey, key);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int wg_add_peer_privkey(char *iface, const char *privkey, char *allowed_ips, const char *presharedkey, char *keepalive, const char *endpoint, const char *fwmark)
|
|
|
|
|
static void wg_add_peer_privkey(char *iface, const char *privkey, char *allowed_ips, const char *presharedkey, char *keepalive, const char *endpoint, const char *fwmark)
|
|
|
|
|
{
|
|
|
|
|
char pubkey[64];
|
|
|
|
|
|
|
|
|
|
memset(pubkey, 0, sizeof(pubkey));
|
|
|
|
|
wg_pubkey(privkey, pubkey);
|
|
|
|
|
|
|
|
|
|
return wg_add_peer(iface, pubkey, allowed_ips, presharedkey, keepalive, endpoint, fwmark, port);
|
|
|
|
|
wg_add_peer(iface, pubkey, allowed_ips, presharedkey, keepalive, endpoint, fwmark, port);
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
static int wg_remove_peer(char *iface, char *pubkey)
|
|
|
|
|