Remove netlink/PDCP_USE_NETLINK: it's not used
Remove netlink code, and the PDCP_USE_NETLINK macro, as there is no known use, it makes the code more complicated, and is simply "technical debt". In 4G PDCP, a subtle change has been introduced, in pdcp_module_init() of pdcp.c. Looking at the diff of this commit, it can be seen that there is now a new "else-if (ENB_NAS_USE_TUN_W_MBMS_BIT)" branch that is under what was the "if (PDCP_USE_NETLINK)" branch, while the code fragment was actually inside the "else" branch of PDCP_USE_NETLINK. This seems to be necessary: previously, if we did not use noS1 mode and we don't use any TUN (i.e., the eNB), the else block would set up this interface. It is important that this interface is brought up, because if we omit it, RFsim will not work. It seems to me that this interface will regularly create some traffic; without it, RFsim will be blocked, and the UE cannot connect. In short, it seems to be important to have the MBMS interface, which injects traffic in the RFsim side, which will unblock RFsim. The change in pdcp_module_init() preserves the total changes of the if-else (PDCP_USE_NETLINK).
This commit is contained in:
@@ -51,10 +51,6 @@
|
||||
char nl_rx_buf[NL_MAX_PAYLOAD];
|
||||
|
||||
struct sockaddr_nl nas_src_addr, nas_dest_addr;
|
||||
struct nlmsghdr *nas_nlh_tx = NULL;
|
||||
struct nlmsghdr *nas_nlh_rx = NULL;
|
||||
struct iovec nas_iov_tx;
|
||||
struct iovec nas_iov_rx = {nl_rx_buf, sizeof(nl_rx_buf)};
|
||||
|
||||
int nas_sock_fd[MAX_MOBILES_PER_ENB*2]; //Allocated for both LTE UE and NR UE.
|
||||
|
||||
@@ -63,8 +59,6 @@ int nas_sock_mbms_fd;
|
||||
struct msghdr nas_msg_tx;
|
||||
struct msghdr nas_msg_rx;
|
||||
|
||||
#define GRAAL_NETLINK_ID 31
|
||||
|
||||
static int tun_alloc(char *dev) {
|
||||
struct ifreq ifr;
|
||||
int fd, err;
|
||||
@@ -162,66 +156,3 @@ int netlink_init_tun(char *ifprefix, int num_if, int id) {//for UE, id = 1, 2, .
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int netlink_init(void) {
|
||||
int ret;
|
||||
nas_sock_fd[0] = socket(PF_NETLINK, SOCK_RAW,GRAAL_NETLINK_ID);
|
||||
|
||||
if (nas_sock_fd[0] == -1) {
|
||||
printf("[NETLINK] Error opening GRAAL_NETLINK_ID socket %d (%d:%s)\n",nas_sock_fd[0],errno, strerror(errno));
|
||||
|
||||
if (LINK_ENB_PDCP_TO_IP_DRIVER) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
printf("[NETLINK] Opened socket with fd %d\n",nas_sock_fd[0]);
|
||||
ret = fcntl(nas_sock_fd[0],F_SETFL,O_NONBLOCK);
|
||||
|
||||
if (ret == -1) {
|
||||
printf("[NETLINK] Error fcntl (%d:%s)\n",errno, strerror(errno));
|
||||
|
||||
if (LINK_ENB_PDCP_TO_IP_DRIVER) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
memset(&nas_src_addr, 0, sizeof(nas_src_addr));
|
||||
nas_src_addr.nl_family = AF_NETLINK;
|
||||
nas_src_addr.nl_pid = 1;//getpid(); /* self pid */
|
||||
nas_src_addr.nl_groups = 0; /* not in mcast groups */
|
||||
ret = bind(nas_sock_fd[0], (struct sockaddr *)&nas_src_addr, sizeof(nas_src_addr));
|
||||
memset(&nas_dest_addr, 0, sizeof(nas_dest_addr));
|
||||
nas_dest_addr.nl_family = AF_NETLINK;
|
||||
nas_dest_addr.nl_pid = 0; /* For Linux Kernel */
|
||||
nas_dest_addr.nl_groups = 0; /* unicast */
|
||||
// TX PART
|
||||
free(nas_nlh_tx);
|
||||
nas_nlh_tx=(struct nlmsghdr *)malloc(NLMSG_SPACE(NL_MAX_PAYLOAD));
|
||||
memset(nas_nlh_tx, 0, NLMSG_SPACE(NL_MAX_PAYLOAD));
|
||||
/* Fill the netlink message header */
|
||||
nas_nlh_tx->nlmsg_len = NLMSG_SPACE(NL_MAX_PAYLOAD);
|
||||
nas_nlh_tx->nlmsg_pid = 1;//getpid(); /* self pid */
|
||||
nas_nlh_tx->nlmsg_flags = 0;
|
||||
nas_iov_tx.iov_base = (void *)nas_nlh_tx;
|
||||
nas_iov_tx.iov_len = nas_nlh_tx->nlmsg_len;
|
||||
memset(&nas_msg_tx,0,sizeof(nas_msg_tx));
|
||||
nas_msg_tx.msg_name = (void *)&nas_dest_addr;
|
||||
nas_msg_tx.msg_namelen = sizeof(nas_dest_addr);
|
||||
nas_msg_tx.msg_iov = &nas_iov_tx;
|
||||
nas_msg_tx.msg_iovlen = 1;
|
||||
// RX PART
|
||||
memset(&nas_msg_rx,0,sizeof(nas_msg_rx));
|
||||
nas_msg_rx.msg_name = (void *)&nas_src_addr;
|
||||
nas_msg_rx.msg_namelen = sizeof(nas_src_addr);
|
||||
nas_msg_rx.msg_iov = &nas_iov_rx;
|
||||
nas_msg_rx.msg_iovlen = 1;
|
||||
return(nas_sock_fd[0]);
|
||||
}
|
||||
|
||||
void netlink_cleanup(void)
|
||||
{
|
||||
free(nas_nlh_tx);
|
||||
nas_nlh_tx = NULL;
|
||||
}
|
||||
|
||||
@@ -31,9 +31,7 @@
|
||||
#ifndef EMU_PROTO_H_
|
||||
#define EMU_PROTO_H_
|
||||
|
||||
int netlink_init(void);
|
||||
int netlink_init_tun(char *ifsuffix, int num_if, int id);
|
||||
int netlink_init_mbms_tun(char *ifsuffix, int id);
|
||||
void netlink_cleanup(void);
|
||||
|
||||
#endif /* EMU_PROTO_H_ */
|
||||
|
||||
Reference in New Issue
Block a user