Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Linux netfilterÔ´Âë·ÖÎö(4)


ËÄ¡¢nf_hook_ops ¹³×ÓµÄ×¢²á
ÔÚfilter±íµÄ³õʼ»¯º¯Êýstatic int __init init(void)ÖгýÁËÓÐÒ»¸önf_register_hookº¯Êý×¢²áÒ»¸ötablesÍ⣬»¹ÓÉnf_register_hookº¯Êý×¢²áÁË3¸öhook
 
4.1        nf_hook_opsÊý¾Ý½á¹¹ netfilter.h
struct nf_hook_ops
{
        struct list_head list;                        //Á´±í³ÉÔ±
        /* User fills in from here down. */
        nf_hookfn *hook;                        //¹³×Óº¯ÊýÖ¸Õë
        struct module *owner;
        int pf;                                        //ЭÒé´Ø£¬¶ÔÓÚipv4¶øÑÔ£¬ÊÇPF_INET
        int hooknum;                                //hookÀàÐÍ
        /* Hooks are ordered in ascending priority. */
        int priority;                                //ÓÅÏȼ¶
};
 
list³ÉÔ±ÓÃÓÚά»¤Netfilter hookµÄÁÐ±í¡£
hook³ÉÔ±ÊÇÒ»¸öÖ¸Ïònf_hookfnÀàÐ͵ĺ¯ÊýµÄÖ¸Õ룬¸Ãº¯ÊýÊÇÕâ¸öhook±»µ÷ÓÃʱִÐеĺ¯Êý¡£nf_hookfnͬÑùÔÚlinux/netfilter.hÖж¨Òå¡£
pfÕâ¸ö³ÉÔ±ÓÃÓÚÖ¸¶¨Ð­Òé×å¡£ÓÐЧµÄЭÒé×åÔÚlinux/socket.hÖÐÁгö£¬µ«¶ÔÓÚIPv4ÎÒÃÇʹÓÃЭÒé×åPF_INET¡£
hooknumÕâ¸ö³ÉÔ±ÓÃÓÚÖ¸¶¨°²×°µÄÕâ¸öº¯Êý¶ÔÓ¦µÄ¾ßÌåµÄhookÀàÐÍ:
        NF_IP_PRE_ROUTING    ÔÚÍêÕûÐÔУÑéÖ®ºó£¬Ñ¡Â·È·¶¨Ö®Ç°
        NF_IP_LOCAL_IN        ÔÚѡ·ȷ¶¨Ö®ºó£¬ÇÒÊý¾Ý°üµÄÄ¿µÄÊDZ¾µØÖ÷»ú
        NF_IP_FORWARD        Ä¿µÄµØÊÇÆäËüÖ÷»úµØÊý¾Ý°ü
        NF_IP_LOCAL_OUT  &n


Ïà¹ØÎĵµ£º

[C++] LinuxϵÄitoaº¯Êý

ÉÏÆªÎÄÕÂ˵µ½linuxÐèÒªitoaº¯Êý£¬ÏÂÃæÎÒ¾ÍÌṩһ·Ý¿çƽ̨µÄitoaº¯Êý¡£
//return the length of result string. support only 10 radix for easy use and better performance
int my_itoa(int val, char* buf)
{
    const int radix = 10;
    char* p;
    int a;&nbs ......

Linux»·¾³½ø³Ì¼äͨÐÅ£¨¶þ£©£¨Ï£©


Linux»·¾³½ø³Ì¼äͨÐÅ£¨¶þ£©:
Ðźţ¨Ï£©
ÎĵµÑ¡Ïî
<tr
valign="top"><td width="8"><img alt="" height="1" width="8"
src="//www.ibm.com/i/c.gif"/></td><td width="16"><img alt="" width=& ......

Linux»·¾³½ø³Ì¼äͨÐÅ£¨Èý£©


Linux»·¾³½ø³Ì¼äͨÐÅ£¨Èý£©
ÏûÏ¢¶ÓÁÐ
ÎĵµÑ¡Ïî
<tr
valign="top"><td width="8"><img alt="" height="1" width="8"
src="//www.ibm.com/i/c.gif"/></td><td width="16"><img alt="" width=" ......

Linux ¹Ø»úÖ¸Áî

1¹Ø»úÃüÁî shutdown 1£©shutdown --help
2£©shutdown -h now ÏÖÔÚÁ¢¼´¹Ø»ú == halt Ö¸Áî
3£©shutdown -r now ÏÖÔÚÁ¢¼´ÖØÆô
4£©shutdown -r +3 Èý·ÖÖÓºóÖØÆô
5£©shutdown -h +3 "The System will shutdown after 3 minutes" ÌáʾʹÓÃÕß½«ÔÚÈý·ÖÖÓºó¹Ø»ú
6£©shutdown -r 20:23 ÔÚ20£º23ʱ½«ÖØÆô¼ÆËã»ú
7£©shutdown ......

¹ØÓÚLinuxÄÚºËѧϰµÄÎóÇø

¡¡¡¡¡¡¡¡¡¡Ð´¸øLinuxÄÚºËÐÂÊÖ-¹ØÓÚLinuxÄÚºËѧϰµÄÎóÇø
-----¸Ð¾õÕâÆªÎÄÕ²»´í£¬Óзdz£¶à½è¼øµÄµØ·½,so×ªÔØ¹ýÀ´ÁË
¡¡¡¡ÏÈ˵¾äÕý¾­µÄ£ºÆäʵÎÒû×ʸñдÕâÆªÎÄÕ£¬ÒòΪ×Ô¼ºÒ²¾ÍÒ»Á½¸öÔÂÒÔÀ´²Å¿ªÊ¼ÓÐËùÁìÎòµÄ¡£Òò´Ë£¬ÕâÀïºÍÆä˵ÊǹØÓÚLinuxÄÚºËѧϰµÄ¾­Ñ飬²»Èç˵ÊÇ×Ô¼ºµÄ½Ìѵ°É£¬Ï£Íû²»ÒªÈÓ¼¦µ°ÔÒÎÒ^_^
¡¡¡¡¡¡³£³£ÓÐÈËÎÊ£ºÎ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ