[PATCH] Zero out the whole sockaddr_in6 struct when parsing explicit-ipv6
Kevin Cernekee
cernekee at gmail.com
Fri Jun 17 22:06:15 PDT 2016
This initializes sin6_scope_id to 0, so that $IPV6_REMOTE doesn't
get strings that look like: "2001:db8::1234%932152953"
Signed-off-by: Kevin Cernekee <cernekee at gmail.com>
---
src/ip-lease.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/src/ip-lease.c b/src/ip-lease.c
index 7cc4cab..f514669 100644
--- a/src/ip-lease.c
+++ b/src/ip-lease.c
@@ -198,9 +198,6 @@ int get_ipv4_lease(main_server_st* s, struct proc_st* proc)
((struct sockaddr_in*)&network)->sin_port = 0;
if (proc->config->explicit_ipv4) {
- /* if an explicit IP is given for that client, then
- * do implicit IP accounting. Require the address
- * to be odd, so we use the next even address as PtP. */
ret =
inet_pton(AF_INET, proc->config->explicit_ipv4, SA_IN_P(&tmp));
@@ -371,9 +368,7 @@ int get_ipv6_lease(main_server_st* s, struct proc_st* proc)
if (proc->config->explicit_ipv6) {
- /* if an explicit IP is given for that client, then
- * do implicit IP accounting. Require the address
- * to be odd, so we use the next even address as PtP. */
+ memset(&tmp, 0, sizeof(tmp));
ret =
inet_pton(AF_INET6, proc->config->explicit_ipv6, SA_IN6_P(&tmp));
@@ -387,7 +382,6 @@ int get_ipv6_lease(main_server_st* s, struct proc_st* proc)
return ERR_MEM;
((struct sockaddr_in6*)&tmp)->sin6_family = AF_INET6;
- ((struct sockaddr_in6*)&tmp)->sin6_port = 0;
memcpy(&proc->ipv6->rip, &tmp, sizeof(struct sockaddr_in6));
proc->ipv6->rip_len = sizeof(struct sockaddr_in6);
--
2.7.4
More information about the openconnect-devel
mailing list