Skip to content

Commit

Permalink
net_permissions: Include "addr" permission on implicit whitelist entries
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-jr committed May 19, 2022
1 parent ccca520 commit 075c281
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/net.cpp
Expand Up @@ -589,6 +589,7 @@ void CConnman::InitializePermissionFlags(NetPermissionFlags& flags, ServiceFlags
if (gArgs.GetBoolArg("-whitelistrelay", DEFAULT_WHITELISTRELAY)) NetPermissions::AddFlag(flags, NetPermissionFlags::Relay);
NetPermissions::AddFlag(flags, NetPermissionFlags::Mempool);
NetPermissions::AddFlag(flags, NetPermissionFlags::NoBan);
NetPermissions::AddFlag(flags, NetPermissionFlags::Addr);
}

if (NetPermissions::HasFlag(flags, NetPermissionFlags::BloomFilter)) {
Expand Down
6 changes: 3 additions & 3 deletions test/functional/p2p_permissions.py
Expand Up @@ -37,7 +37,7 @@ def run_test(self):
# default permissions (no specific permissions)
["-whitelist=127.0.0.1"],
# Make sure the default values in the command line documentation match the ones here
["relay", "noban", "mempool", "download"])
["addr", "relay", "noban", "mempool", "download"])

self.checkpermission(
# no permission (even with forcerelay)
Expand All @@ -47,14 +47,14 @@ def run_test(self):
self.checkpermission(
# relay permission removed (no specific permissions)
["-whitelist=127.0.0.1", "-whitelistrelay=0"],
["noban", "mempool", "download"])
["addr", "noban", "mempool", "download"])

self.checkpermission(
# forcerelay and relay permission added
# Legacy parameter interaction which set whitelistrelay to true
# if whitelistforcerelay is true
["-whitelist=127.0.0.1", "-whitelistforcerelay"],
["forcerelay", "relay", "noban", "mempool", "download"])
["addr", "forcerelay", "relay", "noban", "mempool", "download"])

# Let's make sure permissions are merged correctly
# For this, we need to use whitebind instead of bind
Expand Down

0 comments on commit 075c281

Please sign in to comment.