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

linuxÉ豸Çý¶¯³ÌÐò——ÍøÂçÉ豸Çý¶¯³ÌÐò

LinuxµÄÍøÂçϵͳÖ÷ÒªÊÇ»ùÓÚBSD Unix µÄsocket»úÖÆ£¬ ·ÃÎÊÍøÂçÉ豸µÄÇý¶¯³ÌÐò²»ÐèҪʹÓÃÉ豸½Úµã¡£ÔÚϵͳºÍÇý¶¯³ÌÐòÖ®¼ä¶¨ÒåÓÐרÃŵÄÊý¾Ý½á¹¹£¨sk_buff£©½øÐÐÊý¾ÝµÄ´«µÝ¡£ÏµÍ³ÄÚ²¿Ö§³Ö¶Ô·¢ËÍÊý¾ÝºÍ½ÓÊÕÊý¾ÝµÄ»º´æ£¬ÌṩÁ÷Á¿¿ØÖÆ»úÖÆ£¬Ìṩ¶Ô¶àЭÒéµÄÖ§³Ö¡£Òò´Ë£¬Ñ¡ÔñÄĸöÇý¶¯³ÌÐòÊÇ»ùÓÚÄÚºËÄÚ²¿µÄÆäËû¾ö¶¨£¬¶ø²»Êǵ÷ÓÃopen()£¬¶ÔÍøÂçÉ豸µÄʹÓÃͨ³£ÓÉϵͳµ÷ÓÃsocket½Ó¿ÚÒýÈë¡£
LinuxÍøÂçÉ豸Çý¶¯³ÌÐò´ÓÉϵ½Ï¿ÉÒÔ»®·ÖΪ4²ã£¬ÒÀ´ÎΪÍøÂçЭÒé½Ó¿Ú²ã¡¢ÍøÂçÉ豸½Ó¿Ú²ã¡¢Ìṩʵ¼Ê¶¯ÄܵÄÉ豸Çý¶¯¹¦ÄܲãÒÔ¼°ÍøÂçÉ豸Óëý½é²ã¡£ÔÚÉè¼Æ¾ßÌåµÄÍøÂçÉ豸Çý¶¯³ÌÐòʱ£¬ÎÒÃÇÐèÒªÍê³ÉµÄÖ÷Òª¹¤×÷ÊDZàдÉ豸Çý¶¯¹¦ÄܲãµÄÏà¹Øº¯ÊýÒÔÌî³änet_deviceÊý¾Ý½á¹¹µÄÄÚÈݲ¢½«net_device×¢²áÈëÄںˡ£
Ò»¡¢ÍøÂçЭÒé½Ó¿Ú²ã
      ÍøÂçЭÒé½Ó¿Ú²ã×îÖ÷ÒªµÄ¹¦ÄÜÊǸøÉϲãЭÒéÌṩÁË͸Ã÷µÄÊý¾Ý°ü·¢ËͺͽÓÊÕ½Ó¿Ú¡£µ±ÉϲãARP»òIPЭÒéÐèÒª·¢ËÍÊý¾Ý°üʱ£¬Ëü½«µ÷ÓÃÍøÂçЭÒé½Ó¿Ú²ãµÄdev_queue_xmit()º¯Êý·¢Ë͸ÃÊý¾Ý£¬ÉϲãÊý¾Ý°üµÄ½ÓÊÕҲͨ¹ýÏònetif_rx()º¯Êý´«µÝÒ»¸östruct sk_buffÊý¾Ý½á¹¹µÄÖ¸ÕëÀ´Íê³É¡£
       sk_buff½á¹¹Ìå·Ç³£ÖØÒª£¬ËüµÄº¬ÒåΪ“Ì×½Ó×Ö»º³åÇø”£¬ÓÃÓÚÔÚLinuxÍøÂç×ÓϵͳÖеĸ÷²ãÖ®¼ä´«µÝÊý¾Ý£¬ÊÇLinuxÍøÂç×ÓϵͳÊý¾Ý´«µÝµÄ“ÖÐÊàÉñ¾­”¡£
1.Ì×½Ó×Ö»º³åÇø³ÉÔ±
(1) ¸÷²ãЭÒéÍ·h¡¢nhºÍmac 3¸öЭÒéÍ·¶ÔÓ¦ÓÚÍøÂçЭÒéµÄ²»Í¬²ã´Î£¬·Ö±ðΪ´«Êä²ãTCP/UDPЭÒéÍ·h¡¢ÍøÂç²ãЭÒéÍ·nhºÍÁ´Â·²ãЭÒéÍ·mac¡£
(2) Êý¾Ý»º³åÇøÖ¸Õëhead¡¢data¡¢tailºÍend
(3) ³¤¶ÈÐÅÏ¢len¡¢data_len¡¢truesize
2. Ì×½Ó×Ö»º³åÇø²Ù×÷
·ÖÅä alloc_skb(),dev_alloc_skb()£»ÊÍ·Å kfree_skb(),dev_kfree_skb(),dev_kfree_skb_irq(),dev_kfree_skb_any()£»
Ö¸ÕëÒƶ¯ skb_put(),_ _skb_put(),skb_push(),_ _skb_push(),skb_pull(),skb_reserve()¡£
¶þ¡¢ÍøÂçÉ豸½Ó¿Ú²ã
Ö÷Òª¹¦ÄÜÊÇΪǧ±äÍò»¯µÄÍøÂçÉ豸¶¨ÒåÁËͳһ¡¢³éÏóµÄÊý¾Ý½á¹¹net_device½á¹¹Ì壬ÒÔ²»±äÓ¦Íò±ä£¬ÊµÏÖ¶àÖÖÓ²¼þÔÚÈí¼þ²ã´ÎÉϵÄͳһ¡£
É豸²Ù×÷£ºopen(),stop()¡£
Èý¡¢É豸Çý¶¯¹¦Äܲã
       net_device½á¹¹ÌåµÄ³ÉÔ±ÐèÒª±»É豸Çý¶¯¹¦ÄܲãµÄ¾ßÌåÊýÖµºÍº¯Êý¸³Óè¡£
       ÓÉÓÚÍøÂçÊý¾Ý°üµÄ½ÓÊÕ¿ÉÓÉÖжÏÒý·¢£¬É豸Çý¶¯¹¦ÄܲãÖÐÁíÒ»¸öÖ÷Ì岿·Ö½«ÊÇÖжϴ¦Àíº¯Êý£¬Ëü¸ºÔð¶ÁÈ¡Ó²¼þÉϽÓÊÕµÄÊý¾Ý°ü²¢


Ïà¹ØÎĵµ£º

linuxÏÂmatlabµÄÒ»¸öÀý×Ó

ÌâÄ¿£ºÔÚLinuxϵÄMATLABÖÐÔËÐÐMATLAB³ÌÐò²¢ÔÚwebÖÐÏÔʾ½á¹û
ÎÒ×öÁËÒ»¸öÀý×ÓÖ÷ÒªÓÐ5¸öÎļþ£º
 webtttt.html  webtttt1.html  webtttt2.html  webtttttempt.html  webttttrnd.m
1.webtttt1.htmlÎļþ
 <!-- $Revision: 1.2 $ -->
<HTML>
<HEAD>
<TITLE>Simulat ......

ǶÈëʽlinuxÉÕд(¶þ)—LinuxÄں˵IJüôºÍ±àÒë

Ò»¡¢Äں˵ĻñµÃ
¿ÉÒÔ´ÓÍøÉÏÏÂÔØÄÚºËÎļþ£¬http://www.kernel.org¡£Èç¹ûÊÇΪÁËÁ·Ï°£¬¾¡Á¿ÏÂÔØ£².4.xµÄÄںˡ£ÒòΪ2.6.xµÄÄں˱Ƚϴ󣬵±È»±àÒëÒ²ÐèÒª¸ü¶¼µÄʱ¼ä¡£
 
¶þ¡¢Äں˵ıàÒë
LinuxÄں˵ıàÒë²Ëµ¥Ö÷ÒªÓÐÈý¸ö°æ±¾£º
£±£©make config£º½øÈëÃüÁîÐУ¬¿ÉÒÔÒ»ÐÐÒ»ÐеÄÅäÖá£
£²£©make menuconfig£º¿ª·¢ÈËÔ±±È½ÏÊìÏ ......

linuxÅäÖÃiptablesºÍsquid

iptables-save > ipt.v1.0
iptables-save > ipt.v1.1
iptables-restore < ipt.v1.0
cp /etc/sysconfig/iptables iptables.raw
service iptables save
ipαװµÄ½Å±¾Îļþiptables_masquerade
#!/bin/bash
//ÉèÖÃlinuxϵͳÔÊÐíip°üµÄת·¢
echo "1" > /proc/sys/net/ipv4/ip_forward
//¼ÓÔØʵÏÖ ......

¡¾Linux×ÀÃæÓ¦Óá¿sudoµÄÓ÷¨¼°ÅäÖÃ

sudoÊÇlinuxϳ£ÓõÄÔÊÐíÆÕͨÓû§Ê¹Ó󬼶Óû§È¨Ï޵Ť¾ß¡£
ËüµÄÖ÷ÒªÅäÖÃÎļþÊÇsudoers,linuxÏÂͨ³£ÔÚ/etcĿ¼Ï£¬Èç¹ûÊÇsolaris£¬È±Ê¡²»×°sudoµÄ£¬±àÒë°²×°ºóͨ³£ÔÚ°²×°Ä¿Â¼µÄ etcĿ¼Ï£¬²»¹ý²»¹ÜsudoersÎļþÔÚÄĶù£¬sudo¶¼ÌṩÁËÒ»¸ö±à¼­¸ÃÎļþµÄÃüÁvisudoÀ´¶Ô¸ÃÎļþ½øÐÐÐ޸ġ£Ç¿ÁÒÍƼöʹÓøÃÃüÁîÐÞ¸Ä sudoers£¬ÒòΪ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ