software/drivers/sd8887/src/wlan/mapp/mlan2040coex/mlan2040coex.c
/**
 *  @brief opens netlink socket to receive NETLINK events
 *  @return  socket id --success, otherwise--MLAN_STATUS_FAILURE
 */
@brief opens netlink socket to receive NETLINK events
@return  socket id --success, otherwise--MLAN_STATUS_FAILURE
@brief opens netlink socket to receive NETLINK events @return socket id -- success otherwise -- MLAN_STATUS_FAILURE
int
open_netlink(int dev_index)
{
	int sk = -1;
	struct sockaddr_nl src_addr;
	int netlink_num = 0;
	netlink_num = get_netlink_num(dev_index);
	if (netlink_num < 0) {
		printf("ERR:Could not get netlink socket. Invalid device number.\n");
		return sk;
	}
	sk = socket(PF_NETLINK, SOCK_RAW, netlink_num);
	if (sk < 0) {
		printf("ERR:Could not open netlink socket.\n");
		return sk;
	}
	memset(&src_addr, 0, sizeof(src_addr));
	src_addr.nl_family = AF_NETLINK;
	src_addr.nl_pid = getpid();
	src_addr.nl_groups = NL_MULTICAST_GROUP;
	if (bind(sk, (struct sockaddr *)&src_addr, sizeof(src_addr)) < 0) {
		printf("ERR:Could not bind socket!\n");
		close(sk);
		return -1;
	}
	return sk;
}
int open_netlink ( int dev_index ) { int sk = -1 ; struct sockaddr_nl src_addr ; int netlink_num = 0 ; netlink_num = get_netlink_num ( dev_index ) ; if ( netlink_num < 0 ) { printf ( " \n " ) ; return sk ; } sk = socket ( PF_NETLINK , SOCK_RAW , netlink_num ) ; if ( sk < 0 ) { printf ( " \n " ) ; return sk ; } memset ( & src_addr , 0 , sizeof ( src_addr ) ) ; src_addr . nl_family = AF_NETLINK ; src_addr . nl_pid = getpid ( ) ; src_addr . nl_groups = NL_MULTICAST_GROUP ; if ( bind ( sk , ( struct sockaddr * ) & src_addr , sizeof ( src_addr ) ) < 0 ) { printf ( " \n " ) ; close ( sk ) ; return -1 ; } return sk ; }
@brief opens netlink socket to receive NETLINK events
  @return  socket id --success, otherwise--MLAN_STATUS_FAILURE
@brief opens netlink socket to receive NETLINK events @return socket id -- success otherwise -- MLAN_STATUS_FAILURE
/* Open netlink socket */ /* Set source address */ /* Bind socket with source address */