| 527 | } |
| 528 | |
| 529 | static int fixup_f_send_sock(void** param) |
| 530 | { |
| 531 | str *s = (str*)*param; |
| 532 | str host, host_nt; |
| 533 | int proto=PROTO_NONE, port; |
| 534 | struct hostent* he; |
| 535 | const struct socket_info* si; |
| 536 | struct ip_addr ip; |
| 537 | |
| 538 | if (parse_phostport(s->s, s->len, &host.s, &host.len, &port, &proto) != 0) { |
| 539 | LM_ERR("Failed to parse socket\n"); |
| 540 | return E_CFG; |
| 541 | } |
| 542 | if (pkg_nt_str_dup(&host_nt, &host) < 0) { |
| 543 | LM_ERR("oom\n"); |
| 544 | return E_OUT_OF_MEM; |
| 545 | } |
| 546 | |
| 547 | he=resolvehost(host_nt.s,0); |
| 548 | if (he==0){ |
| 549 | LM_ERR(" could not resolve %s\n", host_nt.s); |
| 550 | goto error; |
| 551 | } |
| 552 | hostent2ip_addr(&ip, he, 0); |
| 553 | si=find_si(&ip, port, proto); |
| 554 | if (si==0){ |
| 555 | LM_ERR("bad force_send_socket" |
| 556 | " argument: %s:%d (opensips doesn't listen on it)\n", |
| 557 | host_nt.s, port); |
| 558 | goto error; |
| 559 | } |
| 560 | |
| 561 | pkg_free(host_nt.s); |
| 562 | |
| 563 | const void **_param = (const void **)param; |
| 564 | *_param = si; |
| 565 | return 0; |
| 566 | |
| 567 | error: |
| 568 | pkg_free(host_nt.s); |
| 569 | return E_BAD_ADDRESS; |
| 570 | } |
| 571 | |
| 572 | static int fixup_bond_sock(void** param) |
| 573 | { |
nothing calls this directly
no test coverage detected