637256206f
Simplification of final return statement
2023-09-20 12:31:18 -03:00
760852b6dc
isinetaddr4: treat last octet as less of a special case
2023-09-20 12:20:26 -03:00
ae035800d3
Add isinetaddr4.c improvements
2023-09-20 10:59:15 -03:00
eb0b1d3ace
isinetaddr -> isinetaddr4, iscidraddr -> iscidraddr4
2023-09-12 15:38:43 -03:00
f6e29e4756
Add isinetaddr6
...
This change introduces `isinetaddr6`, a function that validates
IPv6 addresses. The interface is identical to isinetaddr, where
0 is returned for an invalid address and 1 is returned for a valid
address.
2023-09-11 22:51:35 -03:00
66cecb0379
Apply whitespace to if statement
2023-08-28 03:39:46 -03:00
82693b4d5e
iscidraddr: return 0 for 127.0.0.1/322
2023-08-28 00:12:08 -03:00
1ab5387ff0
Fix cidr edge cases
2023-08-27 23:07:02 -03:00
97a2f8f42e
Apply a small optimization to iscidraddr.c
2023-08-27 22:58:16 -03:00
4d25b52775
Move 'iscidraddr' to src/iscidraddr.c
2023-08-27 02:03:45 -03:00
f97b5906f4
Add iscidraddr
2023-08-26 23:38:15 -03:00
4118c4b573
Fix edgecase (4...4 is invalid)
2023-08-26 00:32:11 -03:00
14a5728824
Add linebreak
2023-08-26 00:04:54 -03:00
d6595f8cfd
Clarity
2023-08-26 00:01:41 -03:00
8b166a7328
Add register_octet
, register_digit
, and minor improvements
2023-08-25 23:57:10 -03:00
c113259949
Add descriptive variable names
2023-08-25 23:35:38 -03:00
7dcf1f1e47
Move 'inrange' to the bottom of the file.
2023-08-25 23:20:05 -03:00
e3c927ec91
Call inrange when we have an integer above 99
...
Anything below three digits couldn't be out of bounds.
2023-08-25 21:31:04 -03:00
799b301af4
Avoid calling inrange when we don't have any integers in 'buf'
2023-08-25 21:13:06 -03:00
f861716608
Detect "...4" earlier.
2023-08-25 21:05:20 -03:00
e0dcac0c2c
Handle additional edge cases as invalid
...
"192.168.2" is now caught as invalid, along with
"...4".
2023-08-25 21:01:34 -03:00
de2f0d55e1
Handle edge case only when we have to
2023-08-25 20:25:44 -03:00
9baa5f9fe4
Treat "123.45.67.891" as invalid
2023-08-25 20:05:43 -03:00
918d43e4e9
Small tweak
2023-08-25 18:58:59 -03:00
8d71ef6bd4
Avoid buffer overflow
2023-08-25 18:37:53 -03:00
d170a1c1ca
Small tweak
2023-08-25 18:28:14 -03:00
24c3bfb681
Handle 'str' being NULL
2023-08-25 18:26:21 -03:00
59108cc615
Improve portability / performance
...
* `strtonum` is unique to OpenBSD - use `strtol` instead.
* Call `strnlen` once.
* Avoid int cast.
2023-08-25 17:14:33 -03:00
7c02f425c5
First commit
2023-08-25 15:57:09 -03:00