Puffy
Puffy

Reputation: 49

c - lkm using netfilter, trouble with strcmp

I am having a lot of trouble with this problem. If I could figure this out, it would solve several problems for me, but I have been unable to figure this out.

This is an LKM project using netlink

So I have a line in this project

    printk(KERN_INFO "Netlink received msg payload:%s\n", (char *)nlmsg_data(nlh));

which obviously prints the payload to KERN_INFO.

But I need to determine what the payload is.

   "%s", (char *)nlmsg_data(nlh)

So I am trying my best to figure this out and all I've got so far, which doesn't work is:

    if (strcmp("%s\n", "hide") == 0)

But where do I put

    (char *)nlmsg_data(nlh)

How can I write this in a way which will work? AM I going about this the wrong way? Thanks to anyone who can help.

Upvotes: 0

Views: 56

Answers (0)

Related Questions