- Update for kernel versions > 3.5.0
pre-ci ok git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4505 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
@@ -34,6 +34,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//#include <linux/config.h>
|
//#include <linux/config.h>
|
||||||
|
#include <linux/version.h>
|
||||||
#include <linux/socket.h>
|
#include <linux/socket.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
@@ -57,7 +58,9 @@
|
|||||||
static struct sock *nas_nl_sk = NULL;
|
static struct sock *nas_nl_sk = NULL;
|
||||||
static int exit_netlink_thread=0;
|
static int exit_netlink_thread=0;
|
||||||
static int nas_netlink_rx_thread(void *);
|
static int nas_netlink_rx_thread(void *);
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)
|
||||||
|
struct netlink_kernel_cfg oai_netlink_cfg;
|
||||||
|
#endif
|
||||||
|
|
||||||
static DEFINE_MUTEX(nasmesh_mutex);
|
static DEFINE_MUTEX(nasmesh_mutex);
|
||||||
|
|
||||||
@@ -152,20 +155,33 @@ int nas_netlink_init()
|
|||||||
{
|
{
|
||||||
|
|
||||||
printk("[NAS][NETLINK] Running init ...\n");
|
printk("[NAS][NETLINK] Running init ...\n");
|
||||||
|
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)
|
||||||
|
oai_netlink_cfg.groups = 0;
|
||||||
|
oai_netlink_cfg.input = nas_nl_data_ready;
|
||||||
|
oai_netlink_cfg.cb_mutex = &nasmesh_mutex;
|
||||||
|
oai_netlink_cfg.bind = NULL;
|
||||||
|
|
||||||
nas_nl_sk = netlink_kernel_create(
|
nas_nl_sk = netlink_kernel_create(
|
||||||
#ifdef KERNEL_VERSION_GREATER_THAN_2622
|
&init_net,
|
||||||
&init_net,
|
NAS_NETLINK_ID,
|
||||||
#endif
|
# if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
|
||||||
NAS_NETLINK_ID,
|
THIS_MODULE,
|
||||||
0,
|
# endif
|
||||||
nas_nl_data_ready,
|
&oai_netlink_cfg);
|
||||||
#ifdef KERNEL_VERSION_GREATER_THAN_2622
|
#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */
|
||||||
&nasmesh_mutex, // NULL
|
nas_nl_sk = netlink_kernel_create(
|
||||||
#endif
|
# ifdef KERNEL_VERSION_GREATER_THAN_2622
|
||||||
THIS_MODULE);
|
&init_net,
|
||||||
|
# endif
|
||||||
|
NAS_NETLINK_ID,
|
||||||
|
0,
|
||||||
|
nas_nl_data_ready,
|
||||||
|
# ifdef KERNEL_VERSION_GREATER_THAN_2622
|
||||||
|
&nasmesh_mutex, // NULL
|
||||||
|
# endif
|
||||||
|
THIS_MODULE);
|
||||||
|
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */
|
||||||
|
|
||||||
if (nas_nl_sk == NULL) {
|
if (nas_nl_sk == NULL) {
|
||||||
|
|
||||||
@@ -224,7 +240,11 @@ int nas_netlink_send(unsigned char *data,unsigned int len) {
|
|||||||
|
|
||||||
nlh->nlmsg_pid = 0; /* from kernel */
|
nlh->nlmsg_pid = 0; /* from kernel */
|
||||||
|
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
|
||||||
|
NETLINK_CB(nl_skb).portid = 0;
|
||||||
|
#else
|
||||||
NETLINK_CB(nl_skb).pid = 0;
|
NETLINK_CB(nl_skb).pid = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef NETLINK_DEBUG
|
#ifdef NETLINK_DEBUG
|
||||||
printk("[NAS][NETLINK] In nas_netlink_send, nl_skb %p, nl_sk %x, nlh %p, nlh->nlmsg_len %d\n",nl_skb,nas_nl_sk,nlh,nlh->nlmsg_len);
|
printk("[NAS][NETLINK] In nas_netlink_send, nl_skb %p, nl_sk %x, nlh %p, nlh->nlmsg_len %d\n",nl_skb,nas_nl_sk,nlh,nlh->nlmsg_len);
|
||||||
|
|||||||
Reference in New Issue
Block a user