Merge pull request #27726 from yuwata/network-wireguard-doc

network: update doc
This commit is contained in:
Yu Watanabe
2023-05-22 16:46:38 +09:00
committed by GitHub
2 changed files with 21 additions and 8 deletions
+4 -3
View File
@@ -1700,9 +1700,10 @@
<varlistentry>
<term><varname>AllowedIPs=</varname></term>
<listitem>
<para>Sets a comma-separated list of IP (v4 or v6) addresses with CIDR masks
from which this peer is allowed to send incoming traffic and to
which outgoing traffic for this peer is directed.</para>
<para>Sets a comma-separated list of IP (v4 or v6) addresses with CIDR masks from which this peer
is allowed to send incoming traffic and to which outgoing traffic for this peer is directed. This
setting can be specified multiple times. If an empty string is assigned, then the all previous
assignments are cleared.</para>
<para>The catch-all 0.0.0.0/0 may be specified for matching all IPv4 addresses,
and ::/0 may be specified for matching all IPv6 addresses.</para>
+17 -5
View File
@@ -34,9 +34,18 @@
static void wireguard_resolve_endpoints(NetDev *netdev);
static int peer_resolve_endpoint(WireguardPeer *peer);
static WireguardPeer* wireguard_peer_free(WireguardPeer *peer) {
static void wireguard_peer_clear_ipmasks(WireguardPeer *peer) {
WireguardIPmask *mask;
assert(peer);
while ((mask = peer->ipmasks)) {
LIST_REMOVE(ipmasks, peer->ipmasks, mask);
free(mask);
}
}
static WireguardPeer* wireguard_peer_free(WireguardPeer *peer) {
if (!peer)
return NULL;
@@ -49,10 +58,7 @@ static WireguardPeer* wireguard_peer_free(WireguardPeer *peer) {
config_section_free(peer->section);
while ((mask = peer->ipmasks)) {
LIST_REMOVE(ipmasks, peer->ipmasks, mask);
free(mask);
}
wireguard_peer_clear_ipmasks(peer);
free(peer->endpoint_host);
free(peer->endpoint_port);
@@ -685,6 +691,12 @@ int config_parse_wireguard_allowed_ips(
if (r < 0)
return log_oom();
if (isempty(rvalue)) {
wireguard_peer_clear_ipmasks(peer);
TAKE_PTR(peer);
return 0;
}
for (const char *p = rvalue;;) {
_cleanup_free_ char *word = NULL;
union in_addr_union masked;