Browse Source

modules/pv: Fix $snd(ip) for IPv6

Result was always an empty string surrounded by []. Converted to use ip_addr2a().
This also prevents the surrounding [], which are not part of an IPv6 address.
Alex Hermann 12 years ago
parent
commit
9b3d4e1928
1 changed files with 3 additions and 1 deletions
  1. 3 1
      modules_k/pv/pv_branch.c

+ 3 - 1
modules_k/pv/pv_branch.c

@@ -369,6 +369,7 @@ int pv_get_sndto(struct sip_msg *msg, pv_param_t *param,
 		pv_value_t *res)
 		pv_value_t *res)
 {
 {
 	struct onsend_info* snd_inf;
 	struct onsend_info* snd_inf;
+	struct ip_addr ip;
 	str s;
 	str s;
 
 
 	snd_inf=get_onsend_info();
 	snd_inf=get_onsend_info();
@@ -395,7 +396,8 @@ int pv_get_sndto(struct sip_msg *msg, pv_param_t *param,
 					(int)snd_inf->len);
 					(int)snd_inf->len);
 		default:
 		default:
 			/* 0 - ip */
 			/* 0 - ip */
-			s.s   = suip2a(snd_inf->to, sizeof(*snd_inf->to));
+			su2ip_addr(&ip, snd_inf->to);
+			s.s = ip_addr2a(&ip);
 			s.len = strlen(s.s);
 			s.len = strlen(s.s);
 			return pv_get_strval(msg, param, res, &s);
 			return pv_get_strval(msg, param, res, &s);
 	}
 	}