Commit 5ddc8a43 authored by Chenyu's avatar Chenyu

udp bind nic and ping 192.168.199.1 ,gnb receive reply, One more thing is gnb send data to uetun

parent a2bb236b
...@@ -1343,7 +1343,7 @@ void *gtpv1u_eNB_process_itti_msg(void *notUsed) { ...@@ -1343,7 +1343,7 @@ void *gtpv1u_eNB_process_itti_msg(void *notUsed) {
sgw_s1u_teid = 0x01; sgw_s1u_teid = 0x01;
stack_req.apiType = NW_GTPV1U_ULP_API_SEND_TPDU; stack_req.apiType = NW_GTPV1U_ULP_API_SEND_TPDU;
stack_req.apiInfo.sendtoInfo.teid = sgw_s1u_teid; stack_req.apiInfo.sendtoInfo.teid = sgw_s1u_teid;
in_addr_t upf_addr=0xc0a8c7DF; in_addr_t upf_addr=0xc0a80a0a;//0xc0a8c7DF;
//stack_req.apiInfo.sendtoInfo.ipAddr = gtpv1u_ue_data_p->bearers[data_req_p->rab_id - GTPV1U_BEARER_OFFSET].sgw_ip_addr; //stack_req.apiInfo.sendtoInfo.ipAddr = gtpv1u_ue_data_p->bearers[data_req_p->rab_id - GTPV1U_BEARER_OFFSET].sgw_ip_addr;
stack_req.apiInfo.sendtoInfo.ipAddr = upf_addr; stack_req.apiInfo.sendtoInfo.ipAddr = upf_addr;
rc = nwGtpv1uGpduMsgNew( rc = nwGtpv1uGpduMsgNew(
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <net/if.h>
#include <pthread.h> #include <pthread.h>
...@@ -166,7 +167,11 @@ int udp_eNB_create_socket(int port, char *ip_addr, task_id_t task_id) ...@@ -166,7 +167,11 @@ int udp_eNB_create_socket(int port, char *ip_addr, task_id_t task_id)
} else { } else {
sin.sin_addr.s_addr = inet_addr(ip_addr); sin.sin_addr.s_addr = inet_addr(ip_addr);
} }
struct ifreq interface;
strncpy(interface.ifr_ifrn.ifrn_name, "enx000ec6c0a3ac", sizeof("enx000ec6c0a3ac"));
if (setsockopt(sd, SOL_SOCKET, SO_BINDTODEVICE, (char *)&interface, sizeof(interface)) < 0) {
perror("SO_BINDTODEVICE failed");
}
if ((rc = bind(sd, (struct sockaddr *)&sin, sizeof(struct sockaddr_in))) < 0) { if ((rc = bind(sd, (struct sockaddr *)&sin, sizeof(struct sockaddr_in))) < 0) {
close(sd); close(sd);
AssertFatal(rc >= 0, "UDP: Failed to bind socket: (%s:%d) address %s port %d\n", AssertFatal(rc >= 0, "UDP: Failed to bind socket: (%s:%d) address %s port %d\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment