|
|
|
@ -1478,11 +1478,13 @@ inline int encode_avp_value(char *value, unsigned int gw_index, uri_type scheme,
|
|
|
|
|
string = int2str(ip_addr->u.addr32[0], &len);
|
|
|
|
|
append_str(at, string, len);
|
|
|
|
|
}
|
|
|
|
|
#ifdef USE_IPV6
|
|
|
|
|
else if (ip_addr->af == AF_INET6 && !ip_addr_any(ip_addr)) {
|
|
|
|
|
append_chr(at, '[');
|
|
|
|
|
at += ip6tosbuf(ip_addr->u.addr, at, MAX_URI_LEN - (at - value));
|
|
|
|
|
append_chr(at, ']');
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
append_chr(at, '|');
|
|
|
|
|
/* hostname */
|
|
|
|
|
append_str(at, hostname, hostname_len);
|
|
|
|
@ -1569,8 +1571,10 @@ inline int decode_avp_value(char *value, unsigned int *gw_index, str *scheme,
|
|
|
|
|
if (s.len > 0) {
|
|
|
|
|
if ((ip = str2ip(&s)) != NULL)
|
|
|
|
|
*addr = *ip;
|
|
|
|
|
#ifdef USE_IPV6
|
|
|
|
|
else if ((ip = str2ip6(&s)) != NULL)
|
|
|
|
|
*addr = *ip;
|
|
|
|
|
#endif
|
|
|
|
|
else {
|
|
|
|
|
str2int(&s, &u);
|
|
|
|
|
addr->af = AF_INET;
|
|
|
|
@ -2199,8 +2203,10 @@ static int from_gw_2(struct sip_msg* _m, char* _lcr_id, char* _addr)
|
|
|
|
|
} else if (pv_val.flags & PV_VAL_STR) {
|
|
|
|
|
if ((ip = str2ip(&pv_val.rs)) != NULL)
|
|
|
|
|
src_addr = *ip;
|
|
|
|
|
#ifdef USE_IPV6
|
|
|
|
|
else if ((ip = str2ip6(&pv_val.rs)) != NULL)
|
|
|
|
|
src_addr = *ip;
|
|
|
|
|
#endif
|
|
|
|
|
else {
|
|
|
|
|
LM_DBG("request did not come from gw "
|
|
|
|
|
"(addr param value is not an IP address)\n");
|
|
|
|
@ -2256,8 +2262,10 @@ static int from_any_gw_1(struct sip_msg* _m, char* _addr, char* _s2)
|
|
|
|
|
} else if (pv_val.flags & PV_VAL_STR) {
|
|
|
|
|
if ((ip = str2ip(&pv_val.rs)) != NULL)
|
|
|
|
|
src_addr = *ip;
|
|
|
|
|
#ifdef USE_IPV6
|
|
|
|
|
else if ((ip = str2ip6(&pv_val.rs)) != NULL)
|
|
|
|
|
src_addr = *ip;
|
|
|
|
|
#endif
|
|
|
|
|
else {
|
|
|
|
|
LM_DBG("request did not come from gw "
|
|
|
|
|
"(addr param value is not an IP address)\n");
|
|
|
|
@ -2345,8 +2353,10 @@ static int to_gw_1(struct sip_msg* _m, char* _lcr_id, char* _s2)
|
|
|
|
|
}
|
|
|
|
|
if ((ip = str2ip(&(_m->parsed_uri.host))) != NULL)
|
|
|
|
|
dst_addr = *ip;
|
|
|
|
|
#ifdef USE_IPV6
|
|
|
|
|
else if ((ip = str2ip6(&(_m->parsed_uri.host))) != NULL)
|
|
|
|
|
dst_addr = *ip;
|
|
|
|
|
#endif
|
|
|
|
|
else {
|
|
|
|
|
LM_DBG("request is not going to gw "
|
|
|
|
|
"(Request-URI host is not an IP address)\n");
|
|
|
|
@ -2386,8 +2396,10 @@ static int to_gw_2(struct sip_msg* _m, char* _lcr_id, char* _addr)
|
|
|
|
|
} else if (pv_val.flags & PV_VAL_STR) {
|
|
|
|
|
if ((ip = str2ip(&pv_val.rs)) != NULL)
|
|
|
|
|
dst_addr = *ip;
|
|
|
|
|
#ifdef USE_IPV6
|
|
|
|
|
else if ((ip = str2ip6(&pv_val.rs)) != NULL)
|
|
|
|
|
dst_addr = *ip;
|
|
|
|
|
#endif
|
|
|
|
|
else {
|
|
|
|
|
LM_DBG("request is not going to gw "
|
|
|
|
|
"(addr param value is not an IP address)\n");
|
|
|
|
@ -2428,8 +2440,10 @@ static int to_any_gw_0(struct sip_msg* _m, char* _s1, char* _s2)
|
|
|
|
|
}
|
|
|
|
|
if ((ip = str2ip(&(_m->parsed_uri.host))) != NULL)
|
|
|
|
|
dst_addr = *ip;
|
|
|
|
|
#ifdef USE_IPV6
|
|
|
|
|
else if ((ip = str2ip6(&(_m->parsed_uri.host))) != NULL)
|
|
|
|
|
dst_addr = *ip;
|
|
|
|
|
#endif
|
|
|
|
|
else {
|
|
|
|
|
LM_DBG("request is not going to gw "
|
|
|
|
|
"(Request-URI host is not an IP address)\n");
|
|
|
|
@ -2465,8 +2479,10 @@ static int to_any_gw_1(struct sip_msg* _m, char* _addr, char* _s2)
|
|
|
|
|
} else if (pv_val.flags & PV_VAL_STR) {
|
|
|
|
|
if ((ip = str2ip(&pv_val.rs)) != NULL)
|
|
|
|
|
dst_addr = *ip;
|
|
|
|
|
#ifdef USE_IPV6
|
|
|
|
|
else if ((ip = str2ip6(&pv_val.rs)) != NULL)
|
|
|
|
|
dst_addr = *ip;
|
|
|
|
|
#endif
|
|
|
|
|
else {
|
|
|
|
|
LM_DBG("request did go to any gw "
|
|
|
|
|
"(addr param value is not an IP address)\n");
|
|
|
|
|