Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144522332
D24011.1775186256.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D24011.1775186256.diff
View Options
Index: sbin/ipfw/ipfw2.c
===================================================================
--- sbin/ipfw/ipfw2.c
+++ sbin/ipfw/ipfw2.c
@@ -3996,24 +3996,34 @@
* IPv4 a.b.c.d,port
* IPv4 a.b.c.d:port
* IPv6 w:x:y::z,port
- * The ':' can only be used with hostname and IPv4 address.
- * XXX-BZ Should we also support [w:x:y::z]:port?
+ * IPv6 [w:x:y::z]:port
*/
struct sockaddr_storage result;
struct addrinfo *res;
char *s, *end;
int family;
+ int v6brac = 0;
u_short port_number;
NEED1("missing forward address[:port]");
/*
+ * Are we an brakcet-enclosed IPv6 address?
+ */
+ if (strchr(*av, '['))
+ v6brac = 1;
+
+ /*
* locate the address-port separator (':' or ',')
*/
s = strchr(*av, ',');
if (s == NULL) {
+ char *ptr = *av;
+ /* If we have an starting bracket, get the ending one */
+ if (v6brac)
+ ptr = strchr(*av, ']');
/* Distinguish between IPv4:port and IPv6 cases. */
- s = strchr(*av, ':');
+ s = strchr(ptr, ':');
if (s && strchr(s+1, ':'))
s = NULL; /* no port */
}
@@ -4038,7 +4048,7 @@
* Resolve the host name or address to a family and a
* network representation of the address.
*/
- if (getaddrinfo(*av, NULL, NULL, &res))
+ if (getaddrinfo(*av + v6brac, NULL, NULL, &res))
errx(EX_DATAERR, NULL);
/* Just use the first host in the answer. */
family = res->ai_family;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Apr 3, 3:17 AM (8 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28250874
Default Alt Text
D24011.1775186256.diff (1 KB)
Attached To
Mode
D24011: ipfw: Support [w:x:y::z]:port (bracketed) IPv6 addresses in the fwd command
Attached
Detach File
Event Timeline
Log In to Comment