Rewrite sctp_create_new_listener() to handle DNS, IPv6
Rewrite sctp_create_new_listener() to use getaddrinfo() to look up IPv4/IPv6 addresses via a common interface. This allows to use e.g. DNS, and enables the SCTP library to listen on IPv6 ports. To support the above, the corresponding message is changed to not take an IPv4 address on 4 bytes (and separate IPv6), but a single name that will be resolved via getaddrinfo() The previous init message used to allow multiple IPv4/IPv6 addresses; since this is not used anywhere, remove the corresponding functionality. Modify all uses of this ITTI message to copy te SCTP init bind addr into ITTI message.
This commit is contained in:
+9
-15
@@ -1873,21 +1873,15 @@ void cuup_init_n3(instance_t instance)
|
||||
|
||||
void cucp_task_send_sctp_init_req(instance_t instance, char *my_addr)
|
||||
{
|
||||
LOG_I(E1AP, "E1AP_CUCP_SCTP_REQ(create socket)\n");
|
||||
MessageDef *message_p = NULL;
|
||||
message_p = itti_alloc_new_message (TASK_CUCP_E1, 0, SCTP_INIT_MSG);
|
||||
message_p->ittiMsg.sctp_init.port = E1AP_PORT_NUMBER;
|
||||
message_p->ittiMsg.sctp_init.ppid = E1AP_SCTP_PPID;
|
||||
message_p->ittiMsg.sctp_init.ipv4 = 1;
|
||||
message_p->ittiMsg.sctp_init.ipv6 = 0;
|
||||
message_p->ittiMsg.sctp_init.nb_ipv4_addr = 1;
|
||||
message_p->ittiMsg.sctp_init.ipv4_address[0] = inet_addr(my_addr);
|
||||
/*
|
||||
* SR WARNING: ipv6 multi-homing fails sometimes for localhost.
|
||||
* * * * Disable it for now.
|
||||
*/
|
||||
message_p->ittiMsg.sctp_init.nb_ipv6_addr = 0;
|
||||
message_p->ittiMsg.sctp_init.ipv6_address[0] = "0:0:0:0:0:0:0:1";
|
||||
size_t addr_len = strlen(my_addr) + 1;
|
||||
LOG_I(E1AP, "E1AP_CUCP_SCTP_REQ(create socket) for %s len %ld\n", my_addr, addr_len);
|
||||
MessageDef *message_p = itti_alloc_new_message_sized(TASK_CUCP_E1, 0, SCTP_INIT_MSG, sizeof(sctp_init_t) + addr_len);
|
||||
sctp_init_t *init = &SCTP_INIT_MSG(message_p);
|
||||
init->port = E1AP_PORT_NUMBER;
|
||||
init->ppid = E1AP_SCTP_PPID;
|
||||
char *addr_buf = (char *) (init + 1); // address after sctp_init ITTI message end, allocated above
|
||||
init->bind_address = addr_buf;
|
||||
memcpy(addr_buf, my_addr, addr_len);
|
||||
itti_send_msg_to_task(TASK_SCTP, instance, message_p);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user