{"id":260,"date":"2013-06-07T08:21:28","date_gmt":"2013-06-07T08:21:28","guid":{"rendered":"http:\/\/www.selinuxplus.com\/?p=260"},"modified":"2013-06-07T08:24:04","modified_gmt":"2013-06-07T08:24:04","slug":"linux-kernel-netlink%e7%9a%84create%e6%8e%a5%e5%8f%a3%e6%9c%80%e8%bf%91%e6%9b%b4%e6%94%b9%e5%a4%aa%e9%a2%91%e7%b9%81%e4%ba%86","status":"publish","type":"post","link":"http:\/\/www.selinuxplus.com\/?p=260","title":{"rendered":"linux kernel netlink\u7684create\u63a5\u53e3"},"content":{"rendered":"<p>\u6700\u8fd1\u5728\u521b\u5efanetlink \u7684\u65f6\u5019\uff0c\u53d1\u73b0\u5176\u7248\u672c\u7684\u4fee\u6539\u592a\u9891\u7e41\u4e86\uff0c\u67e5\u4e86\u4e00\u4e9b\u8d44\u6599\uff0c\u4fee\u6539\u5982\u4e0b<\/p>\n<p>\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u51fa\u5904 <a href=\" http:\/\/www.selinuxplus.com\/?p=260\" title=\"selinuxplus.com\">[By SELinux+]<\/a><\/p>\n<pre class=\"lang:default decode:true \" >\r\n#if (LINUX_VERSION_CODE &lt; KERNEL_VERSION(2,6,22))\r\n    nl_sock = netlink_kernel_create( NETLINK_MKM, 0, recv_msg, THIS_MODULE);\r\n#elif (LINUX_VERSION_CODE &lt; KERNEL_VERSION(2,6,24))\r\n    nl_sock = netlink_kernel_create( NETLINK_MKM, 0, recv_msg, NULL, THIS_MODULE);\r\n#elif(LINUX_VERSION_CODE  &lt; KERNEL_VERSION(3,6,0))\r\n    nl_sock = netlink_kernel_create(&amp;init_net, NETLINK_MKM, 0, recv_msg, NULL, THIS_MODULE);\r\n#else \r\n\t{\r\n\tstruct netlink_kernel_cfg cfg ={\r\n        .input = recv_msg,\r\n        .groups = 1,\r\n    };\r\n\r\n#if(LINUX_VERSION_CODE  &lt; KERNEL_VERSION(3,7,0))\r\n    nl_sock = netlink_kernel_create(&amp;init_net, NETLINK_MKM,THIS_MODULE, &amp;cfg);\r\n#else\r\n\tnl_sock = netlink_kernel_create(&amp;init_net, NETLINK_MKM, &amp;cfg);\r\n\r\n#endif \r\n\t}\r\n#endif<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u5728\u521b\u5efanetlink \u7684\u65f6\u5019\uff0c\u53d1\u73b0\u5176\u7248\u672c\u7684\u4fee\u6539&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[45],"tags":[],"_links":{"self":[{"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/posts\/260"}],"collection":[{"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=260"}],"version-history":[{"count":2,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/posts\/260\/revisions"}],"predecessor-version":[{"id":263,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/posts\/260\/revisions\/263"}],"wp:attachment":[{"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=260"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=260"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=260"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}