Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F150925763
D30164.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D30164.id.diff
View Options
diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c
--- a/sbin/ipfw/ipfw2.c
+++ b/sbin/ipfw/ipfw2.c
@@ -4021,57 +4021,54 @@
NEED1("missing forward address[:port]");
- if (_substrcmp(*av, "tablearg") == 0) {
- family = PF_INET;
- ((struct sockaddr_in*)&result)->sin_addr.s_addr =
- INADDR_ANY;
- } else {
- /*
- * Are we an bracket-enclosed IPv6 address?
- */
- if (strchr(*av, '['))
- (*av)++;
+ if (strncmp(*av, "tablearg", 8) == 0)
+ memcpy(++(*av), "0.0.0.0", 7);
- /*
- * locate the address-port separator (':' or ',')
- */
- s = strchr(*av, ',');
- if (s == NULL) {
- s = strchr(*av, ']');
- /* Prevent erroneous parsing on brackets. */
- if (s != NULL)
- *(s++) = '\0';
- else
- s = *av;
-
- /* Distinguish between IPv4:port and IPv6 cases. */
- s = strchr(s, ':');
- if (s && strchr(s+1, ':'))
- s = NULL; /* no port */
- }
+ /*
+ * Are we an bracket-enclosed IPv6 address?
+ */
+ if (strchr(*av, '['))
+ (*av)++;
- if (s != NULL) {
- /* Terminate host portion and set s to start of port. */
+ /*
+ * locate the address-port separator (':' or ',')
+ */
+ s = strchr(*av, ',');
+ if (s == NULL) {
+ s = strchr(*av, ']');
+ /* Prevent erroneous parsing on brackets. */
+ if (s != NULL)
*(s++) = '\0';
- i = strtoport(s, &end, 0 /* base */, 0 /* proto */);
- if (s == end)
- errx(EX_DATAERR,
- "illegal forwarding port ``%s''", s);
- port_number = (u_short)i;
- }
+ else
+ s = *av;
- /*
- * Resolve the host name or address to a family and a
- * network representation of the address.
- */
- if (getaddrinfo(*av, NULL, NULL, &res))
- errx(EX_DATAERR, NULL);
- /* Just use the first host in the answer. */
- family = res->ai_family;
- memcpy(&result, res->ai_addr, res->ai_addrlen);
- freeaddrinfo(res);
+ /* Distinguish between IPv4:port and IPv6 cases. */
+ s = strchr(s, ':');
+ if (s && strchr(s+1, ':'))
+ s = NULL; /* no port */
}
+ if (s != NULL) {
+ /* Terminate host portion and set s to start of port. */
+ *(s++) = '\0';
+ i = strtoport(s, &end, 0 /* base */, 0 /* proto */);
+ if (s == end)
+ errx(EX_DATAERR,
+ "illegal forwarding port ``%s''", s);
+ port_number = (u_short)i;
+ }
+
+ /*
+ * Resolve the host name or address to a family and a
+ * network representation of the address.
+ */
+ if (getaddrinfo(*av, NULL, NULL, &res))
+ errx(EX_DATAERR, NULL);
+ /* Just use the first host in the answer. */
+ family = res->ai_family;
+ memcpy(&result, res->ai_addr, res->ai_addrlen);
+ freeaddrinfo(res);
+
if (family == PF_INET) {
ipfw_insn_sa *p = (ipfw_insn_sa *)action;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Apr 6, 12:06 AM (2 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30923856
Default Alt Text
D30164.id.diff (2 KB)
Attached To
Mode
D30164: sbin/ipfw: Fix parsing error in table based forward
Attached
Detach File
Event Timeline
Log In to Comment