<span style="color:rgb(0,0,0);"><font face="Courier New">nlsk <span style="color:rgb(0,0,204);">=</span> netlink_kernel_create<span style="color:rgb(0,0,204);">(</span>net<span style="color:rgb(0,0,204);">,</span> NETLINK_XFRM<span style="color:rgb(0,0,204);">,</span> XFRMNLGRP_MAX<span style="color:rgb(0,0,204);">,</span><br /> xfrm_netlink_rcv<span style="color:rgb(0,0,204);">,</span> <span style="color:rgb(255,0,0);">NULL</span><span style="color:rgb(0,0,204);">,</span> THIS_MODULE<span style="color:rgb(0,0,204);">)</span><span style="color:rgb(0,0,204);">;</span><br /> <br /><br /><span style="color:rgb(0,0,255);">static</span> <span style="color:rgb(0,0,255);">void</span> xfrm_netlink_rcv<span style="color:rgb(0,0,204);">(</span><span style="color:rgb(0,0,255);">struct</span> sk_buff <span style="color:rgb(0,0,204);">*</span>skb<span style="color:rgb(0,0,204);">)</span><br /><span style="color:rgb(0,0,204);">{</span><br /> mutex_lock<span style="color:rgb(0,0,204);">(</span><span style="color:rgb(0,0,204);">&</span>xfrm_cfg_mutex<span style="color:rgb(0,0,204);">)</span><span style="color:rgb(0,0,204);">;</span><br /><br /> netlink_rcv_skb<span style="color:rgb(0,0,204);">(</span>skb<span style="color:rgb(0,0,204);">,</span> <span style="color:rgb(0,0,204);">&</span>xfrm_user_rcv_msg<span style="color:rgb(0,0,204);">)</span><span style="color:rgb(0,0,204);">;</span><br /> mutex_unlock<span style="color:rgb(0,0,204);">(</span><span style="color:rgb(0,0,204);">&</span>xfrm_cfg_mutex<span style="color:rgb(0,0,204);">)</span><span style="color:rgb(0,0,204);">;</span><br /><span style="color:rgb(0,0,204);">}</span><br />在netlink_rcv_skb<span style="color:rgb(0,0,204);">(</span><span style="color:rgb(0,0,204);">)</span>函数中进行接收处理。<br /> <br /><br /><span style="color:rgb(0,0,255);">int</span> netlink_broadcast<span style="color:rgb(0,0,204);">(</span><span style="color:rgb(0,0,255);">struct</span> sock <span style="color:rgb(0,0,204);">*</span>ssk<span style="color:rgb(0,0,204);">,</span> <span style="color:rgb(0,0,255);">struct</span> sk_buff <span style="color:rgb(0,0,204);">*</span>skb<span style="color:rgb(0,0,204);">,</span> u32 pid<span style="color:rgb(0,0,204);">,</span><br /> u32 group<span style="color:rgb(0,0,204);">,</span> gfp_t allocation<span style="color:rgb(0,0,204);">)</span><br /></font></span>
|