Issue 35989: ipaddress.IPv4Network allows prefix > 32 (original) (raw)

Created on 2019-02-13 16:13 by John Florian, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 11844 open matrixise,2019-02-13 20:45
Messages (5)
msg335460 - (view) Author: John Florian (John Florian) Date: 2019-02-13 16:13
I wanted a simple is_valid_ipv4_network() function, so I wrote one and a bunch of unit tests where I discovered that I can legally: >>> n = IPv4Network(('192.168.123.234', 12345678)) >>> n IPv4Network('192.168.123.234/12345678') >>> n.prefixlen 12345678 >>> n.max_prefixlen 32 I assume this is a bug.
msg335475 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2019-02-13 20:47
I proposed my PR but I prefer a review because in the code of ipaddress, there is a function for the validation of an address with the netmask. Maybe we could use this function and try to refactor/improve the current code.
msg337228 - (view) Author: Rémi Lapeyre (remi.lapeyre) * Date: 2019-03-05 16:44
Hi @maxtrixise, thanks for PR, > there is a function for the validation of an address with the netmask Which one do you want to use?
msg337230 - (view) Author: James Edwards (jedwards) * Date: 2019-03-05 16:59
It may be worth also addressing the fact that IPv6Network makes no restriction on it's netmask (when specified as a tuple).
msg342795 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-05-18 12:19
See also that seems to have fixed this.
History
Date User Action Args
2022-04-11 14:59:11 admin set github: 80170
2019-05-18 12:19:37 xtreak set nosy: + xtreakmessages: +
2019-03-05 16:59:48 jedwards set nosy: + jedwardsmessages: +
2019-03-05 16:44:02 remi.lapeyre set messages: +
2019-02-13 20:47:15 matrixise set nosy: + matrixisemessages: +
2019-02-13 20:45:06 matrixise set keywords: + patchstage: test needed -> patch reviewpull_requests: + <pull%5Frequest11875>
2019-02-13 17:06:13 SilentGhost set nosy: + pitroutype: behaviorcomponents: + Library (Lib)stage: test needed
2019-02-13 16:14:52 remi.lapeyre set nosy: + remi.lapeyre
2019-02-13 16:13:55 John Florian create