How to send a message from a userspace application to a module
Teto
mattator at gmail.com
Wed Mar 27 15:14:18 EDT 2013
Hi there,
I am quite new to kernel development and netlink. I am trying to get a
linux module communicate with an userspace daemon. It is hard to find
up to date documentation or tutorials so I came up (with difficulty)
with the following code but I am not sure if this is the recommanded
way (I've seen people using netlink_kernel_create but I don't use it
for instnace). The problem is that my module should print a message
on dmesg via printk when it receives a netlink packet but nothing
happens.
A lot of code follows but it shouldn't be too hard to read for netlink
specialists such as yourselves since it's mainly copy/paste of
examples on the Internet, that is very classical without any personal
logic.
================================================
==== USER SPACE CODE: lig_daemon.c ===
================================================
#include <netlink/netlink.h>
#include <netlink/genl/genl.h>
#include <netlink/genl/ctrl.h>
#include <netlink/genl/mngt.h>
#include <stdlib.h>
#include <stdio.h>
#include"../lig_module/lig_module.h"
static int parse_cb(struct nl_msg *msg, void *arg)
{
printf("callbacl called\n");
// return genl_handle_msg(msg, NULL);
}
int main()
{
struct nl_sock *sk = 0;
int ret = 0;
int family_id = 0;
// struct sk_buff *skb = 0;
void *msg_head;
struct nl_msg *msg;
struct s_lig_result *user_hdr;
printf("Starting LIG DAEMON\n");
sk = nl_socket_alloc();
if(!sk) {
printf("could not allocate socket\n");
return EXIT_FAILURE;
}
if(nl_connect(sk, NETLINK_GENERIC) != 0)
{
printf("could not connect socket\n");
goto fail_connect;
}
/** 2nd parameter refers to family name defined in gnl_family.name */
family_id = genl_ctrl_resolve (sk, LIG_FAMILY_NAME);
if(family_id < 0 )
{
printf("error obtaining family\n");
goto failure;
}
printf("Family No:\t%d\n", family_id);
if (!(msg = nlmsg_alloc()))
{
printf("Could not allocate a new message");
goto failure;
}
user_hdr = genlmsg_put(msg,
NL_AUTO_PORT, /* port Netlink port
or NL_AUTO_PORT */
NL_AUTO_SEQ, /* Sequence number of
message or NL_AUTO_SEQ*/
family_id, /* Numeric family identifier*/
0,
0, /* flags (optional ) */
ELC_RESULTS, /* command identifier */
VERSION_NR /* version */
);
if (!user_hdr)
{
printf("Could not generate a new message");
goto failure;
}
ret = nla_put_string(msg, ELA_EID, "stuff");
if(ret != 0)
{
printf("Could not add string");
goto skb_failure;
}
// else we fill the struct
// user_hdr->number_of_remote_rlocs = 2;
// user_hdr->number_of_local_rlocs = 1;
/* finalize the message */
ret =nl_send_auto ( sk, msg);
/* send message (skb, pid) */
if(ret < 0)
{
printf("Could not send message");
goto skb_failure;
}
nl_socket_modify_cb( sk, NL_CB_VALID, NL_CB_CUSTOM, parse_cb, NULL);
//returns -10 => NLE_OPNOTSUPP
ret = nl_recvmsgs_default( sk );
printf("After receive %i.\n", ret);
if( ret < 0)
{
printf("Error: %s\n", nl_geterror(ret) );
}
// free allocated struct
nlmsg_free(msg);
nl_socket_free(sk);
printf("End of DAEMON\n");
return EXIT_SUCCESS;
skb_failure:
nlmsg_free(msg);
failure:
fail_connect:
nl_socket_free(sk);
return EXIT_FAILURE;
}
================================================
==== KERNEL MODULE CODE: lig_module.h, just a bunch of definitions ===
================================================
#ifndef LIG_MODULE_H
#define LIG_MODULE_H
/* attributes (variables): the index in this enum is used as a
reference for the type,
* userspace application has to indicate the corresponding type
* the policy is used for security considerations
*/
enum E_LIG_ATTRIBUTE {
ELA_RLOCS_NUMBER,
ELA_EID,
ELA_MAX
};
/* protocol version */
#define VERSION_NR 1
/*the name of this family, used by userspace application */
#define LIG_FAMILY_NAME "LIG_FAMILY"
/* commands: enumeration of all commands (functions),
* used by userspace application to identify command to be ececuted
*/
enum E_LIG_COMMAND {
ELC_REQUEST_RLOCS_FOR_EID,
ELC_RESULTS,
ELC_MAX,
};
struct s_lig_result {
int number_of_remote_rlocs;
int number_of_local_rlocs;
};
struct s_lig_request {
int remote_eid;
int local_eid;
// int number_of_local_rlocs;
};
#endif
================================================
==== KERNEL MODULE CODE: lig_module.c, just a bunch of definitions ===
================================================
#include <linux/genetlink.h>
#include <net/genetlink.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include "lig_module.h"
#define MAX_STRING 16
#define MAX_TAB 16
//static int entier;
static char destinationIP[MAX_STRING];
//! Path towards the lig program
static char programPath[100];
// sock
//static struct sock *nl_sk = NULL;
module_param_string(destinationIP, destinationIP, sizeof(destinationIP), 0644);
module_param_string(programPath, programPath, sizeof(programPath), 0644);
MODULE_PARM_DESC(destinationIP, "EID we want to retrieve the RLOC number for");
MODULE_PARM_DESC(programPath, "Path towards the userspace lig program
this module calls ?");
MODULE_DESCRIPTION("lig_module");
MODULE_LICENSE("GPL");
/* attribute policy: defines which attribute has which type (e.g int,
char * etc)
* possible values defined in net/netlink.h
*/
static struct nla_policy lig_policy[ ELA_MAX ] = {
[ELA_RLOCS_NUMBER] = { .type = NLA_UNSPEC, .len = 120 },
[ELA_EID] = { .type = NLA_UNSPEC , .len = 120}
};
/* family definition */
static struct genl_family lig_gnl_family = {
.id = GENL_ID_GENERATE, /* genetlink should generate an id */
.hdrsize = 0,
.name = LIG_FAMILY_NAME, /*the name of this family, used by
userspace application */
.version = VERSION_NR, //version number
.maxattr = ELA_MAX,
};
/* an echo command, receives a message, prints it and sends another
message back */
int handle_results(struct sk_buff *skb_2, struct genl_info *info)
{
struct nlattr *na;
struct sk_buff *skb;
int rc;
void *msg_head;
char * mydata;
if (info == NULL)
goto out;
printk("call to %s in reaction to %d \n",__func__, info->snd_pid );
/*for each attribute there is an index in info->attrs which points
to a nlattr structure
*in this structure the data is given
*/
na = info->attrs[ELA_RLOCS_NUMBER];
if (na)
{
mydata = (char *)nla_data(na);
if (mydata == NULL)
printk("error while receiving data\n");
else
printk(KERN_NOTICE "received: %s\n", mydata);
}
else
{
printk("no info->attrs %i\n", ELA_RLOCS_NUMBER);
}
/* send a message back*/
/* allocate some memory, since the size is not yet known use
NLMSG_GOODSIZE*/
skb = genlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
if (skb == NULL)
goto out;
/* create the message headers */
/* arguments of genlmsg_put:
struct sk_buff *,
int (sending) pid,
int sequence number,
struct genl_family *,
int flags,
u8 command index (why do we need this?)
*/
/*
* Payload Format:
* <---------------------- nlmsg_len(nlh) --------------------->
* <------ hdrlen ------> <- nlmsg_attrlen(nlh, hdrlen) ->
* +----------------------+- - -+--------------------------------+
* | Family Header | Pad | Attributes |
* +----------------------+- - -+--------------------------------+
*/
msg_head = genlmsg_put(skb, 0, info->snd_seq+1, &lig_gnl_family, 0,
ELC_REQUEST_RLOCS_FOR_EID);
if (msg_head == NULL) {
rc = -ENOMEM;
goto out;
}
/* add a DOC_EXMPL_A_MSG attribute (actual value to be sent) */
rc = nla_put_string(skb, ELA_EID, "hello world from kernel space\n");
if (rc != 0)
goto out;
/* finalize the message */
genlmsg_end(skb, msg_head);
/* send the message back */
// rc = genlmsg_unicast( skb, info->snd_pid );
if (rc != 0)
goto out;
return 0;
out:
printk("an error occured in %s:\n",__func__);
return 0;
}
/*
commands: mapping between the command enumeration and the actual function
*/
struct genl_ops lig_ops[ELC_MAX] = {
{
.cmd = ELC_REQUEST_RLOCS_FOR_EID,
.flags = 0,
.policy = lig_policy,
.doit = handle_results, /* cb function */
.dumpit = NULL, /* cb function */
} ,
{
.cmd = ELC_RESULTS,
.flags = 0,
.policy = lig_policy,
.doit = handle_results, /* cb function */
.dumpit = NULL, /* cb function */
}
};
static int __init init_lig_module(void)
{
int rc;
printk("LIG MODULE initialization\n");
/*register new family*/
rc = genl_register_family(&lig_gnl_family);
if (rc != 0){
genl_unregister_family(&lig_gnl_family);
rc = genl_register_family(&lig_gnl_family);
if (rc != 0)
goto failure;
}
/*register functions (commands) of the new family*/
rc = genl_register_ops(&lig_gnl_family, lig_ops);
if (rc != 0){
printk(KERN_WARNING "could not register ops: %i\n",rc);
genl_unregister_family(&lig_gnl_family);
goto failure;
}
return 0;
failure:
printk(KERN_ERR "an error occured while inserting the generic
netlink example module\n");
return -1;
}
static void __exit cleanup_lig_module(void)
{
int ret = 0;
printk(KERN_INFO "cleanup_lig_module() called\n");
/* do not forget to unregister family
returns 0 on success
unregister operations as well
*/
ret = genl_unregister_family(&lig_gnl_family);
if( ret != 0)
{
printk(KERN_WARNING "Could not unregister family, error: %d\n", ret);
}
}
module_init( init_lig_module );
module_exit( cleanup_lig_module );
=====================================================
==== the debug output of the userspace application "lig_daemon" ====
=====================================================
teto at tatooine:~/lig_daemon$ NLCB=debug lig_daemon
Starting LIG DAEMON
-- Debug: Sent Message:
-------------------------- BEGIN NETLINK MESSAGE ---------------------------
[HEADER] 16 octets
.nlmsg_len = 20
.nlmsg_type = 16 <genl/family::nlctrl>
.nlmsg_flags = 773 <REQUEST,ACK,ROOT,MATCH>
.nlmsg_seq = 1364408051
.nlmsg_pid = 13496
[PAYLOAD] 4 octets
03 01 00 00 ....
--------------------------- END NETLINK MESSAGE ---------------------------
-- Debug: Received Message:
-------------------------- BEGIN NETLINK MESSAGE ---------------------------
[HEADER] 16 octets
.nlmsg_len = 116
.nlmsg_type = 16 <genl/family::nlctrl>
.nlmsg_flags = 2 <MULTI>
.nlmsg_seq = 1364408051
.nlmsg_pid = 13496
[PAYLOAD] 4 octets
01 02 00 00 ....
[ATTR 02] 7 octets
6e 6c 63 74 72 6c 00 nlctrl.
[PADDING] 1 octets
00 .
[ATTR 01] 2 octets
10 00 ..
[PADDING] 2 octets
00 00 ..
[ATTR 03] 4 octets
02 00 00 00 ....
[ATTR 04] 4 octets
00 00 00 00 ....
[ATTR 05] 4 octets
07 00 00 00 ....
[ATTR 06] 20 octets
14 00 01 00 08 00 01 00 03 00 00 00 08 00 02 00 0e 00 ..................
00 00 ..
[ATTR 07] 24 octets
18 00 01 00 08 00 02 00 10 00 00 00 0b 00 01 00 6e 6f ................no
74 69 66 79 00 00 tify..
--------------------------- END NETLINK MESSAGE ---------------------------
-- Debug: Received Message:
-------------------------- BEGIN NETLINK MESSAGE ---------------------------
[HEADER] 16 octets
.nlmsg_len = 232
.nlmsg_type = 16 <genl/family::nlctrl>
.nlmsg_flags = 2 <MULTI>
.nlmsg_seq = 1364408051
.nlmsg_pid = 13496
[PAYLOAD] 4 octets
01 02 00 00 ....
[ATTR 02] 10 octets
4e 4c 42 4c 5f 4d 47 4d 54 00 NLBL_MGMT.
[PADDING] 2 octets
00 00 ..
[ATTR 01] 2 octets
11 00 ..
[PADDING] 2 octets
00 00 ..
[ATTR 03] 4 octets
03 00 00 00 ....
[ATTR 04] 4 octets
00 00 00 00 ....
[ATTR 05] 4 octets
0a 00 00 00 ....
[ATTR 06] 160 octets
14 00 01 00 08 00 01 00 01 00 00 00 08 00 02 00 0b 00 ..................
00 00 14 00 02 00 08 00 01 00 02 00 00 00 08 00 02 00 ..................
0b 00 00 00 14 00 03 00 08 00 01 00 03 00 00 00 08 00 ..................
02 00 0c 00 00 00 14 00 04 00 08 00 01 00 04 00 00 00 ..................
08 00 02 00 0b 00 00 00 14 00 05 00 08 00 01 00 05 00 ..................
00 00 08 00 02 00 0b 00 00 00 14 00 06 00 08 00 01 00 ..................
06 00 00 00 08 00 02 00 0a 00 00 00 14 00 07 00 08 00 ..................
01 00 07 00 00 00 08 00 02 00 0c 00 00 00 14 00 08 00 ..................
08 00 01 00 08 00 00 00 08 00 02 00 0a 00 00 00 ................
--------------------------- END NETLINK MESSAGE ---------------------------
-- Debug: Received Message:
-------------------------- BEGIN NETLINK MESSAGE ---------------------------
[HEADER] 16 octets
.nlmsg_len = 156
.nlmsg_type = 16 <genl/family::nlctrl>
.nlmsg_flags = 2 <MULTI>
.nlmsg_seq = 1364408051
.nlmsg_pid = 13496
[PAYLOAD] 4 octets
01 02 00 00 ....
[ATTR 02] 13 octets
4e 4c 42 4c 5f 43 49 50 53 4f 76 34 00 NLBL_CIPSOv4.
[PADDING] 3 octets
00 00 00 ...
[ATTR 01] 2 octets
12 00 ..
[PADDING] 2 octets
00 00 ..
[ATTR 03] 4 octets
03 00 00 00 ....
[ATTR 04] 4 octets
00 00 00 00 ....
[ATTR 05] 4 octets
0c 00 00 00 ....
[ATTR 06] 80 octets
14 00 01 00 08 00 01 00 01 00 00 00 08 00 02 00 0b 00 ..................
00 00 14 00 02 00 08 00 01 00 02 00 00 00 08 00 02 00 ..................
0b 00 00 00 14 00 03 00 08 00 01 00 03 00 00 00 08 00 ..................
02 00 0a 00 00 00 14 00 04 00 08 00 01 00 04 00 00 00 ..................
08 00 02 00 0c 00 00 00 ........
--------------------------- END NETLINK MESSAGE ---------------------------
-- Debug: Received Message:
-------------------------- BEGIN NETLINK MESSAGE ---------------------------
[HEADER] 16 octets
.nlmsg_len = 232
.nlmsg_type = 16 <genl/family::nlctrl>
.nlmsg_flags = 2 <MULTI>
.nlmsg_seq = 1364408051
.nlmsg_pid = 13496
[PAYLOAD] 4 octets
01 02 00 00 ....
[ATTR 02] 11 octets
4e 4c 42 4c 5f 55 4e 4c 42 4c 00 NLBL_UNLBL.
[PADDING] 1 octets
00 .
[ATTR 01] 2 octets
13 00 ..
[PADDING] 2 octets
00 00 ..
[ATTR 03] 4 octets
03 00 00 00 ....
[ATTR 04] 4 octets
00 00 00 00 ....
[ATTR 05] 4 octets
07 00 00 00 ....
[ATTR 06] 160 octets
14 00 01 00 08 00 01 00 03 00 00 00 08 00 02 00 0b 00 ..................
00 00 14 00 02 00 08 00 01 00 04 00 00 00 08 00 02 00 ..................
0b 00 00 00 14 00 03 00 08 00 01 00 05 00 00 00 08 00 ..................
02 00 0c 00 00 00 14 00 04 00 08 00 01 00 06 00 00 00 ..................
08 00 02 00 0b 00 00 00 14 00 05 00 08 00 01 00 07 00 ..................
00 00 08 00 02 00 0b 00 00 00 14 00 06 00 08 00 01 00 ..................
08 00 00 00 08 00 02 00 0c 00 00 00 14 00 07 00 08 00 ..................
01 00 01 00 00 00 08 00 02 00 0b 00 00 00 14 00 08 00 ..................
08 00 01 00 02 00 00 00 08 00 02 00 0a 00 00 00 ................
--------------------------- END NETLINK MESSAGE ---------------------------
-- Debug: Received Message:
-------------------------- BEGIN NETLINK MESSAGE ---------------------------
[HEADER] 16 octets
.nlmsg_len = 104
.nlmsg_type = 16 <genl/family::nlctrl>
.nlmsg_flags = 2 <MULTI>
.nlmsg_seq = 1364408051
.nlmsg_pid = 13496
[PAYLOAD] 4 octets
01 02 00 00 ....
[ATTR 02] 11 octets
61 63 70 69 5f 65 76 65 6e 74 00 acpi_event.
[PADDING] 1 octets
00 .
[ATTR 01] 2 octets
14 00 ..
[PADDING] 2 octets
00 00 ..
[ATTR 03] 4 octets
01 00 00 00 ....
[ATTR 04] 4 octets
00 00 00 00 ....
[ATTR 05] 4 octets
01 00 00 00 ....
[ATTR 07] 32 octets
20 00 01 00 08 00 02 00 01 00 00 00 12 00 01 00 61 63 ...............ac
70 69 5f 6d 63 5f 67 72 6f 75 70 00 00 00 pi_mc_group...
--------------------------- END NETLINK MESSAGE ---------------------------
-- Debug: Received Message:
-------------------------- BEGIN NETLINK MESSAGE ---------------------------
[HEADER] 16 octets
.nlmsg_len = 112
.nlmsg_type = 16 <genl/family::nlctrl>
.nlmsg_flags = 2 <MULTI>
.nlmsg_seq = 1364408051
.nlmsg_pid = 13496
[PAYLOAD] 4 octets
01 02 00 00 ....
[ATTR 02] 14 octets
74 68 65 72 6d 61 6c 5f 65 76 65 6e 74 00 thermal_event.
[PADDING] 2 octets
00 00 ..
[ATTR 01] 2 octets
15 00 ..
[PADDING] 2 octets
00 00 ..
[ATTR 03] 4 octets
01 00 00 00 ....
[ATTR 04] 4 octets
00 00 00 00 ....
[ATTR 05] 4 octets
01 00 00 00 ....
[ATTR 07] 36 octets
24 00 01 00 08 00 02 00 02 00 00 00 16 00 01 00 74 68 $...............th
65 72 6d 61 6c 5f 6d 63 5f 67 72 6f 75 70 02 00 00 00 ermal_mc_group....
--------------------------- END NETLINK MESSAGE ---------------------------
-- Debug: Received Message:
-------------------------- BEGIN NETLINK MESSAGE ---------------------------
[HEADER] 16 octets
.nlmsg_len = 68
.nlmsg_type = 16 <genl/family::nlctrl>
.nlmsg_flags = 2 <MULTI>
.nlmsg_seq = 1364408051
.nlmsg_pid = 13496
[PAYLOAD] 4 octets
01 02 00 00 ....
[ATTR 02] 10 octets
56 46 53 5f 44 51 55 4f 54 00 VFS_DQUOT.
[PADDING] 2 octets
00 00 ..
[ATTR 01] 2 octets
16 00 ..
[PADDING] 2 octets
00 00 ..
[ATTR 03] 4 octets
01 00 00 00 ....
[ATTR 04] 4 octets
00 00 00 00 ....
[ATTR 05] 4 octets
06 00 00 00 ....
--------------------------- END NETLINK MESSAGE ---------------------------
-- Debug: Received Message:
-------------------------- BEGIN NETLINK MESSAGE ---------------------------
[HEADER] 16 octets
.nlmsg_len = 112
.nlmsg_type = 16 <genl/family::nlctrl>
.nlmsg_flags = 2 <MULTI>
.nlmsg_seq = 1364408051
.nlmsg_pid = 13496
[PAYLOAD] 4 octets
01 02 00 00 ....
[ATTR 02] 10 octets
54 41 53 4b 53 54 41 54 53 00 TASKSTATS.
[PADDING] 2 octets
00 00 ..
[ATTR 01] 2 octets
17 00 ..
[PADDING] 2 octets
00 00 ..
[ATTR 03] 4 octets
01 00 00 00 ....
[ATTR 04] 4 octets
00 00 00 00 ....
[ATTR 05] 4 octets
04 00 00 00 ....
[ATTR 06] 40 octets
14 00 01 00 08 00 01 00 01 00 00 00 08 00 02 00 0b 00 ..................
00 00 14 00 02 00 08 00 01 00 04 00 00 00 08 00 02 00 ..................
0a 00 00 00 ....
--------------------------- END NETLINK MESSAGE ---------------------------
-- Debug: Received Message:
-------------------------- BEGIN NETLINK MESSAGE ---------------------------
[HEADER] 16 octets
.nlmsg_len = 1540
.nlmsg_type = 16 <genl/family::nlctrl>
.nlmsg_flags = 2 <MULTI>
.nlmsg_seq = 1364408051
.nlmsg_pid = 13496
[PAYLOAD] 4 octets
01 02 00 00 ....
[ATTR 02] 8 octets
6e 6c 38 30 32 31 31 00 nl80211.
[ATTR 01] 2 octets
18 00 ..
[PADDING] 2 octets
00 00 ..
[ATTR 03] 4 octets
01 00 00 00 ....
[ATTR 04] 4 octets
00 00 00 00 ....
[ATTR 05] 4 octets
98 00 00 00 ....
[ATTR 06] 1340 octets
14 00 01 00 08 00 01 00 01 00 00 00 08 00 02 00 0e 00 ..................
00 00 14 00 02 00 08 00 01 00 02 00 00 00 08 00 02 00 ..................
0b 00 00 00 14 00 03 00 08 00 01 00 05 00 00 00 08 00 ..................
02 00 0e 00 00 00 14 00 04 00 08 00 01 00 06 00 00 00 ..................
08 00 02 00 0b 00 00 00 14 00 05 00 08 00 01 00 07 00 ..................
00 00 08 00 02 00 0b 00 00 00 14 00 06 00 08 00 01 00 ..................
08 00 00 00 08 00 02 00 0b 00 00 00 14 00 07 00 08 00 ..................
01 00 09 00 00 00 08 00 02 00 0b 00 00 00 14 00 08 00 ..................
08 00 01 00 0a 00 00 00 08 00 02 00 0b 00 00 00 14 00 ..................
09 00 08 00 01 00 0b 00 00 00 08 00 02 00 0b 00 00 00 ..................
14 00 0a 00 08 00 01 00 0c 00 00 00 08 00 02 00 0b 00 ..................
00 00 14 00 0b 00 08 00 01 00 0e 00 00 00 08 00 02 00 ..................
0b 00 00 00 14 00 0c 00 08 00 01 00 0f 00 00 00 08 00 ..................
02 00 0b 00 00 00 14 00 0d 00 08 00 01 00 10 00 00 00 ..................
08 00 02 00 0b 00 00 00 14 00 0e 00 08 00 01 00 11 00 ..................
00 00 08 00 02 00 0e 00 00 00 14 00 0f 00 08 00 01 00 ..................
12 00 00 00 08 00 02 00 0b 00 00 00 14 00 10 00 08 00 ..................
01 00 13 00 00 00 08 00 02 00 0b 00 00 00 14 00 11 00 ..................
08 00 01 00 14 00 00 00 08 00 02 00 0b 00 00 00 14 00 ..................
12 00 08 00 01 00 15 00 00 00 08 00 02 00 0f 00 00 00 ..................
14 00 13 00 08 00 01 00 16 00 00 00 08 00 02 00 0b 00 ..................
00 00 14 00 14 00 08 00 01 00 17 00 00 00 08 00 02 00 ..................
0b 00 00 00 14 00 15 00 08 00 01 00 18 00 00 00 08 00 ..................
02 00 0b 00 00 00 14 00 16 00 08 00 01 00 19 00 00 00 ..................
08 00 02 00 0b 00 00 00 14 00 17 00 08 00 01 00 1f 00 ..................
00 00 08 00 02 00 0a 00 00 00 14 00 18 00 08 00 01 00 ..................
1a 00 00 00 08 00 02 00 0b 00 00 00 14 00 19 00 08 00 ..................
01 00 1b 00 00 00 08 00 02 00 0b 00 00 00 14 00 1a 00 ..................
08 00 01 00 1c 00 00 00 08 00 02 00 0a 00 00 00 14 00 ..................
1b 00 08 00 01 00 1d 00 00 00 08 00 02 00 0b 00 00 00 ..................
14 00 1c 00 08 00 01 00 21 00 00 00 08 00 02 00 0b 00 ........!.........
00 00 14 00 1d 00 08 00 01 00 20 00 00 00 08 00 02 00 .......... .......
0c 00 00 00 14 00 1e 00 08 00 01 00 4b 00 00 00 08 00 ............K.....
02 00 0b 00 00 00 14 00 1f 00 08 00 01 00 4c 00 00 00 ..............L...
08 00 02 00 0b 00 00 00 14 00 20 00 08 00 01 00 25 00 .......... .....%.
00 00 08 00 02 00 0b 00 00 00 14 00 21 00 08 00 01 00 ............!.....
26 00 00 00 08 00 02 00 0b 00 00 00 14 00 22 00 08 00 &............."...
01 00 27 00 00 00 08 00 02 00 0b 00 00 00 14 00 23 00 ..'.............#.
08 00 01 00 28 00 00 00 08 00 02 00 0b 00 00 00 14 00 ....(.............
24 00 08 00 01 00 2b 00 00 00 08 00 02 00 0b 00 00 00 $.....+...........
14 00 25 00 08 00 01 00 2c 00 00 00 08 00 02 00 0b 00 ..%.....,.........
00 00 14 00 26 00 08 00 01 00 2d 00 00 00 08 00 02 00 ....&.....-.......
0f 00 00 00 14 00 27 00 08 00 01 00 2e 00 00 00 08 00 ......'...........
02 00 0b 00 00 00 14 00 28 00 08 00 01 00 30 00 00 00 ........(.....0...
08 00 02 00 0b 00 00 00 14 00 29 00 08 00 01 00 31 00 ..........).....1.
00 00 08 00 02 00 0b 00 00 00 14 00 2a 00 08 00 01 00 ............*.....
32 00 00 00 08 00 02 00 0c 00 00 00 14 00 2b 00 08 00 2.............+...
01 00 34 00 00 00 08 00 02 00 0b 00 00 00 14 00 2c 00 ..4.............,.
08 00 01 00 35 00 00 00 08 00 02 00 0b 00 00 00 14 00 ....5.............
2d 00 08 00 01 00 36 00 00 00 08 00 02 00 0b 00 00 00 -.....6...........
14 00 2e 00 08 00 01 00 37 00 00 00 08 00 02 00 0b 00 ........7.........
00 00 14 00 2f 00 08 00 01 00 38 00 00 00 08 00 02 00 ..../.....8.......
0b 00 00 00 14 00 30 00 08 00 01 00 39 00 00 00 08 00 ......0.....9.....
02 00 0b 00 00 00 14 00 31 00 08 00 01 00 3a 00 00 00 ........1.....:...
08 00 02 00 0b 00 00 00 14 00 32 00 08 00 01 00 3b 00 ..........2.....;.
00 00 08 00 02 00 0b 00 00 00 14 00 33 00 08 00 01 00 ............3.....
43 00 00 00 08 00 02 00 0b 00 00 00 14 00 34 00 08 00 C.............4...
01 00 3d 00 00 00 08 00 02 00 0b 00 00 00 14 00 35 00 ..=.............5.
08 00 01 00 3e 00 00 00 08 00 02 00 0a 00 00 00 14 00 ....>.............
36 00 08 00 01 00 3f 00 00 00 08 00 02 00 0b 00 00 00 6.....?...........
14 00 37 00 08 00 01 00 41 00 00 00 08 00 02 00 0b 00 ..7.....A.........
00 00 14 00 38 00 08 00 01 00 42 00 00 00 08 00 02 00 ....8.....B.......
0b 00 00 00 14 00 39 00 08 00 01 00 44 00 00 00 08 00 ......9.....D.....
02 00 0b 00 00 00 14 00 3a 00 08 00 01 00 45 00 00 00 ........:.....E...
08 00 02 00 0b 00 00 00 14 00 3b 00 08 00 01 00 49 00 ..........;.....I.
00 00 08 00 02 00 0a 00 00 00 14 00 3c 00 08 00 01 00 ............<.....
4a 00 00 00 08 00 02 00 0b 00 00 00 14 00 3d 00 08 00 J.............=...
01 00 4f 00 00 00 08 00 02 00 0b 00 00 00 14 00 3e 00 ..O.............>.
08 00 01 00 52 00 00 00 08 00 02 00 0b 00 00 00 14 00 ....R.............
3f 00 08 00 01 00 51 00 00 00 08 00 02 00 0b 00 00 00 ?.....Q...........
14 00 40 00 08 00 01 00 53 00 00 00 08 00 02 00 0b 00 .. at .....S.........
00 00 14 00 41 00 08 00 01 00 54 00 00 00 08 00 02 00 ....A.....T.......
0b 00 00 00 14 00 42 00 08 00 01 00 55 00 00 00 08 00 ......B.....U.....
02 00 0b 00 00 00 14 00 43 00 08 00 01 00 57 00 00 00 ........C.....W...
08 00 02 00 0b 00 00 00 ........
[ATTR 07] 128 octets
18 00 01 00 08 00 02 00 03 00 00 00 0b 00 01 00 63 6f ................co
6e 66 69 67 00 00 18 00 02 00 08 00 02 00 04 00 00 00 nfig..............
09 00 01 00 73 63 61 6e 00 00 00 00 1c 00 03 00 08 00 ....scan..........
02 00 05 00 00 00 0f 00 01 00 72 65 67 75 6c 61 74 6f ..........regulato
72 79 00 00 18 00 04 00 08 00 02 00 06 00 00 00 09 00 ry................
01 00 6d 6c 6d 65 00 00 00 00 1c 00 05 00 08 00 02 00 ..mlme............
07 00 00 00 0d 00 01 00 74 65 73 74 6d 6f 64 65 00 00 ........testmode..
00 00 ..
--------------------------- END NETLINK MESSAGE ---------------------------
-- Debug: Received Message:
-------------------------- BEGIN NETLINK MESSAGE ---------------------------
[HEADER] 16 octets
.nlmsg_len = 92
.nlmsg_type = 16 <genl/family::nlctrl>
.nlmsg_flags = 2 <MULTI>
.nlmsg_seq = 1364408051
.nlmsg_pid = 13496
[PAYLOAD] 4 octets
01 02 00 00 ....
[ATTR 02] 11 octets
4c 49 47 5f 46 41 4d 49 4c 59 00 LIG_FAMILY.
[PADDING] 1 octets
00 .
[ATTR 01] 2 octets
19 00 ..
[PADDING] 2 octets
00 00 ..
[ATTR 03] 4 octets
01 00 00 00 ....
[ATTR 04] 4 octets
00 00 00 00 ....
[ATTR 05] 4 octets
02 00 00 00 ....
[ATTR 06] 20 octets
14 00 01 00 08 00 01 00 00 00 00 00 08 00 02 00 0a 00 ..................
00 00 ..
--------------------------- END NETLINK MESSAGE ---------------------------
-- Debug: Received Message:
-------------------------- BEGIN NETLINK MESSAGE ---------------------------
[HEADER] 16 octets
.nlmsg_len = 20
.nlmsg_type = 3 <DONE>
.nlmsg_flags = 2 <MULTI>
.nlmsg_seq = 1364408051
.nlmsg_pid = 13496
[PAYLOAD] 4 octets
00 00 00 00 ....
--------------------------- END NETLINK MESSAGE ---------------------------
-- Debug: End of multipart message block: type=DONE length=20
flags=<MULTI> sequence-nr=1364408051 pid=13496
End of DAEMON
I hope it's not too much reading. I am running Ubuntu 12.10 with a
3.5.0 kernel. Please tell me if you need more infos or if I should run
a specific test.
Best regards
More information about the libnl
mailing list