jonasschnelli
commented at 8:30 am on May 19, 2015:
contributor
Groundwork for #5866.
If this makes it into master i’d like to add a GUI context menu for the peers table.
A simple disconnect (without banning) would be possible with setban <ip> add 1 (where 1 is the bantime).
At the moment the banned set does not survive a restart (should be added once).
Also currently banning is per IP and not per Node which results in disconnecting all nodes of a given IP (if the nodes uses the same ip but different ports).
Also includes some whitespace fixes for httpbasics.py test.
jonasschnelli force-pushed
on May 19, 2015
jonasschnelli force-pushed
on May 19, 2015
jonasschnelli
commented at 9:01 am on May 19, 2015:
contributor
I’m open to alternatives (naming) for setban and listbanned. I thought adding banning options over the addnode command is a misuse.
I’m also not sure about banning whole IPs instead of only IP:port (node).
Understood, but IMHO a function that doesn’t need it could just be void. Perhaps you can just add a commit for that at the end? At least it could be changed for GetBanned as you just added it :).
jonasschnelli
commented at 12:40 pm on May 19, 2015:
This is only for the rpc client (bitcoin-cli) string to json conversion which is not required for listbanned.
in
src/rpcnet.cpp:
in
ab10e9d0ceoutdated
455+ "setban \"node\" \"add|remove\" (bantime)\n"
456+ "\nAttempts add or remove a IP from the banned list.\n"
457+ "\nArguments:\n"
458+ "1. \"ip\" (string, required) The IP (see getpeerinfo for nodes ip)\n"
459+ "2. \"command\" (string, required) 'add' to add a IP to the list, 'remove' to remove a IP from the list\n"
460+ "1. \"bantime\" (numeric, optional) time in seconds how long the ip is banned\n"
+1 for removeall option to clear the list of banned peers. And if possible, adding a right click -> kick/ban option for GUI, which could also be implemented like this: http://i.imgur.com/K5jifJx.png (but better looking obv.)
Agreed on the remove all feature. But it would be ugly to have a command like setban <IP> removeall ( would then be dummy). And supporting setban removeall will make the help message unreadable (because of parameter mixups).
IMO adding a clearbanned command could make sense.
Any other suggestions?
clearbanned is fine with me, or perhaps setban * remove ;)?
jonasschnelli force-pushed
on May 19, 2015
jonasschnelli force-pushed
on May 19, 2015
jonasschnelli force-pushed
on May 19, 2015
jonasschnelli
commented at 3:09 pm on May 19, 2015:
contributor
Added a clearbanned command (also included in tests).
jonasschnelli force-pushed
on May 19, 2015
jonasschnelli force-pushed
on May 19, 2015
jonasschnelli force-pushed
on May 19, 2015
jonasschnelli force-pushed
on May 19, 2015
laanwj added the label
Feature
on May 20, 2015
laanwj added the label
P2P
on May 20, 2015
laanwj
commented at 10:52 am on May 21, 2015:
member
Concept ACK, did not test or review code yet, this will be after 0.11 release
gmaxwell
commented at 6:46 am on May 22, 2015:
contributor
Great; I had an old bitrotted version of this and had implemented almost exactly the same interface. One thing this can’t accomplish though is banning netgroups. (thats actually what held up my code: I found issues with out netgroup parser that broke my tests)
LeMiner
commented at 10:00 am on May 22, 2015:
none
In light of what gmaxwell said, perhaps allowing for – setban 12. * .12.12 or setban 50.50.50. * would make sense as well. To allow for banning of entire octets.
laanwj
commented at 10:08 am on May 22, 2015:
member
@leminer Good idea, but I’d say the interface should use /n or /x.y.z.w CIDR syntax (as parsed by CSubNet) instead of bringing back 0.9-era wildcards.
jonasschnelli
commented at 11:32 am on May 22, 2015:
contributor
Agreed with @laanwj.
I don’t think there is a use case for 1.x.2.3
LeMiner
commented at 11:39 am on May 22, 2015:
none
Yep, agreed as well.
laanwj
commented at 12:26 pm on May 22, 2015:
member
1.x.2.3 in CIDR would be 1.0.2.3/255.0.255.255. But no, I don’t see a use-case either.
jonasschnelli force-pushed
on May 26, 2015
jonasschnelli
commented at 7:55 am on May 26, 2015:
contributor
Extended this PR to allow subnet banning/unbanning.
This needs testing because it changes the internal ban set from CNetAddr to CSubNet.
jonasschnelli force-pushed
on May 26, 2015
jonasschnelli force-pushed
on May 27, 2015
jonasschnelli
commented at 7:15 am on May 27, 2015:
contributor
jonasschnelli
commented at 4:35 pm on June 12, 2015:
Renamed “bannedtill” to “banned_until”.
in
src/rpcnet.cpp:
in
11b6c2ffa1outdated
455+ "setban \"ip(/netmask)\" \"add|remove\" (bantime)\n"
456+ "\nAttempts add or remove a IP/Subnet from the banned list.\n"
457+ "\nArguments:\n"
458+ "1. \"ip(/netmask)\" (string, required) The IP/Subnet (see getpeerinfo for nodes ip) with a optional netmask (default is /32 = single ip)\n"
459+ "2. \"command\" (string, required) 'add' to add a IP/Subnet to the list, 'remove' to remove a IP/Subnet from the list\n"
460+ "1. \"bantime\" (numeric, optional) time in seconds how long the ip is banned (0 or empty means using the default time of 24h which can also be overwritten by the -bantime startup argument)\n"
Right. An additional method to set the bantime over an absolute value would make sense.
jgarzik
commented at 7:45 pm on June 11, 2015:
contributor
ut ACK
laanwj
commented at 2:53 pm on June 12, 2015:
member
Needs rebase.
I agree with @luke-jr that it should be somehow possible to specify an absolute ban time. Relative times are useful for end-users, but not so much for programmatic use.
jonasschnelli force-pushed
on Jun 12, 2015
jonasschnelli force-pushed
on Jun 12, 2015
jonasschnelli
commented at 4:34 pm on June 12, 2015:
contributor
Rebased and added the possibility of setting an absolute bantime with setban add <ip> <unixtimestamp> true.
in
src/netbase.cpp:
in
83b0cc61f6outdated
1329@@ -1330,6 +1330,11 @@ bool operator!=(const CSubNet& a, const CSubNet& b)
1330 return !(a==b);
1331 }
13321333+bool operator<(const CSubNet& a, const CSubNet& b)
1334+{
1335+ return (a.network < b.network || (a.network == b.network && memcmp(a.netmask, b.netmask, 16)));
This is a metadata mirror of the GitHub repository
bitcoin/bitcoin.
This site is not affiliated with GitHub.
Content is generated from a GitHub metadata backup.
generated: 2025-05-16 18:12 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me