From: Phil Sutter. Fix script environment variables with IPv6 addresses.
This commit is contained in:
parent
81895b4b5d
commit
ee2923bc73
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: isakmp.c,v 1.49 2009/01/23 08:23:51 tteras Exp $ */
|
||||
/* $NetBSD: isakmp.c,v 1.50 2009/02/03 20:21:45 tteras Exp $ */
|
||||
|
||||
/* Id: isakmp.c,v 1.74 2006/05/07 21:32:59 manubsd Exp */
|
||||
|
||||
|
@ -3123,7 +3123,6 @@ script_hook(iph1, script)
|
|||
char portstr[PORT_MAX];
|
||||
char **envp = NULL;
|
||||
int envc = 1;
|
||||
struct sockaddr_in *sin;
|
||||
char **c;
|
||||
|
||||
if (iph1 == NULL ||
|
||||
|
@ -3136,9 +3135,7 @@ script_hook(iph1, script)
|
|||
#endif
|
||||
|
||||
/* local address */
|
||||
sin = (struct sockaddr_in *)iph1->local;
|
||||
inet_ntop(sin->sin_family, &sin->sin_addr, addrstr, IP_MAX);
|
||||
snprintf(portstr, PORT_MAX, "%d", ntohs(sin->sin_port));
|
||||
GETNAMEINFO(iph1->local, addrstr, portstr);
|
||||
|
||||
if (script_env_append(&envp, &envc, "LOCAL_ADDR", addrstr) != 0) {
|
||||
plog(LLV_ERROR, LOCATION, NULL, "Cannot set LOCAL_ADDR\n");
|
||||
|
@ -3152,9 +3149,7 @@ script_hook(iph1, script)
|
|||
|
||||
/* Peer address */
|
||||
if (iph1->remote != NULL) {
|
||||
sin = (struct sockaddr_in *)iph1->remote;
|
||||
inet_ntop(sin->sin_family, &sin->sin_addr, addrstr, IP_MAX);
|
||||
snprintf(portstr, PORT_MAX, "%d", ntohs(sin->sin_port));
|
||||
GETNAMEINFO(iph1->remote, addrstr, portstr);
|
||||
|
||||
if (script_env_append(&envp, &envc,
|
||||
"REMOTE_ADDR", addrstr) != 0) {
|
||||
|
|
Loading…
Reference in New Issue