Linux netfilterÔ´Âë·ÖÎö(1)
תÌù×Ô:http://alexanderlaw.blog.hexun.com/8960896_d.html
Linux netfilterÔ´Âë·ÖÎö(1)
ÄÚÈÝ»ù±¾ÉÏÀ´×ÔÁ½ÆªÎÄÕÂ:
¡¶NetfilterÔ´Âë·ÖÎö¡·—£¨¶À¹Â¾Å¼úhttp://www.skynet.org.cn/index.php£©
¡¶Linux NetfilterʵÏÖ»úÖƺÍÀ©Õ¹¼¼Êõ¡·——£¨ÑîɳÖÞ ¹ú·À¿Æ¼¼´óѧ¼ÆËã»úѧԺ£©
Ò»¡¢ IP±¨ÎĵĽÓÊÕµ½hookº¯ÊýµÄµ÷ÓÃ
1.1 ip_input.c ip_rcv()º¯Êý
ÒÔ½ÓÊÕµ½µÄ±¨ÎÄΪÀý£¬ÀàËƵĻ¹ÓÐip_forward(ip_forward.c)ºÍip_output(ip_output.c)
int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev)
{
struct iphdr *iph; //¶¨ÒåÒ»¸öip±¨ÎĵÄÊý¾Ý±¨Í·
u32 len;
if (skb->pkt_type == PACKET_OTHERHOST)
goto drop; //Êý¾Ý°ü²»ÊÇ·¢¸øÎÒÃǵÄ
IP_INC_STATS_BH(IPSTATS_MIB_INRECEIVES); //ÊÕµ½Êý¾Ý°üͳ¼ÆÁ¿¼Ó1
if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)
{
/* Èç¹ûÊý¾Ý±¨Êǹ²ÏíµÄ£¬Ôò¸´ÖÆÒ»¸ö³öÀ´£¬´Ëʱ¸´Öƶø³öµÄÒѾºÍsocketÍÑÀëÁ˹Øϵ */
IP_INC_STATS_BH(IPSTATS_MIB_INDISCARDS);
goto out;
}
if (!pskb_may_pull(skb, sizeof(struct iphdr)))
goto inhdr_error; //¶ÔÊý¾Ý±¨µÄÍ·³¤¶È½øÐмì²é£¬
iph = skb->nh.iph; //È¡µÃÊý¾Ý±¨µÄÍ·²¿Î»ÖÃ
if (iph->ihl < 5 || iph->version != 4) //°æ±¾ºÅ»òÕßÍ·³¤¶È²»¶Ô£¬
goto inhdr_error; //Í·³¤¶ÈÊÇÒÔ4×Ö½ÚΪµ¥Î»µÄ£¬ËùÒÔ5±íʾµÄÊÇ20×Ö½Ú
if (!pskb_may_pull(skb, iph->ihl*4))
goto inhdr_error;
if (unlikely(ip_fast_csum((u8 *)iph, iph->ihl)))
goto inhdr_error; //¼ì²é±¨ÎĵļìÑéºÍ×Ö¶Î
len = ntohs(iph->tot_len);
if (skb->len < len || len < (iph->ihl*4))
goto inhdr_error; //Õû¸ö±¨Îij¤¶È²»¿ÉÄܱȱ¨Í·³¤¶ÈС
if (pskb_tr
Ïà¹ØÎĵµ£º
Service Discovery Protocol(SDP)ÌṩһÖÖÄÜÁ¦£¬ÈÃÓ¦ÓóÌÐòÓз½·¨·¢ÏÖÄÄÖÖ·þÎñ¿ÉÓÃÒÔ¼°ÕâÖÖ·þÎñµÄÌØÐÔ¡£
·þÎñ·¢ÏÖÐÒé(SDP»òBluetooth SDP)ÔÚÀ¶ÑÀÐÒéÕ»ÖжÔÀ¶ÑÀ»·¾³ÖеÄÓ¦ÓóÌÐòÓÐÌØÊâµÄº¬Ò⣬·¢ÏÖÄĸö·þÎñÊÇ¿ÉÓõĺÍÈ·¶¨ÕâЩ¿ÉÓ÷þÎñµÄÌØÕ÷¡£SDP¶¨ÒåÁËbluetooth client·¢ÏÖ¿ÉÓÃbluetooth server·þÎñºÍËüÃǵÄÌØÕ÷µÄ·½·¨¡£ ......
ÔÚlinuxϵͳÏ£¬Èç¹ûÄãÏÂÔز¢°²×°ÁËÓ¦ÓóÌÐò£¬ºÜÓпÉÄÜÔÚ¼üÈëËüµÄÃû³Æʱ³öÏÖ“command not found”µÄÌáʾÄÚÈÝ¡£Èç¹ûÿ´Î¶¼µ½°²×°Ä¿±êÎļþ¼ÐÄÚ£¬ÕÒµ½¿ÉÖ´ÐÐÎļþÀ´½øÐвÙ×÷¾ÍÌ«·±ËöÁË¡£ÕâÉæ¼°µ½»·¾³±äÁ¿PATHµÄÉèÖÃÎÊÌ⣬¶øPATHµÄÉèÖÃÒ²ÊÇÔÚlinux϶¨ÖÆ»·¾³±äÁ¿µÄÒ»¸ö×é³É²¿·Ö¡£±¾ÎÄ»ùÓÚRedHat 9.0£¬Ïêϸ½²½âÁË»·¾ ......
A ¼Óºó׺
1.ÎÊÌ⣺ͬÒÔĿ¼ÏÂÓк£Á¿ÒÔÈÕÆÚÃüÃûµÄÎļþ£¬ÆäÖÐÓеÄÓкó׺£¬ÓеÄÒÔµã½á⣬Èç20020101.£¬20020102.£¬……£¬20020101.td£¬20020102.td……
ÒªÇó£º °ÑËùÓÐÒÔµã½áβµÄ¼ÓÉϺó׺.ts
Îҵķ½·¨£º
#£¡/bin/bash
for files in `ls *.`
do
mv $files `echo “$filests” `
done ......
linuxÏÂÓÐרÃŵÄÎļþϵͳÓÃÀ´¶ÔÉ豸½øÐйÜÀí£¬devfsºÍsysfs¾ÍÊÇÆäÖÐÁ½ÖÖ¡£
1£¬devfs£ºdevfsÊÇÔÚ2.4Äں˾ͳöÏÖÁË£¬ËüÊÇÓÃÀ´½â¾ölinuxÖÐÉ豸¹ÜÀí»ìÂÒµÄÎÊÌ⣬linuxÄں˿ª·¢ÈËÔ±¿ª·¢ÁËdevfs¡£
2£¬sysfs£ºÊÇLinux ÄÚºËÖÐÉè¼Æ½ÏеÄÒ»ÖÖÐéÄâµÄ»ùÓÚÄÚ´æµÄÎļþϵͳ£¬ËüµÄ×÷ÓÃÓëproc ÓÐЩÀàËÆ£¬µ« ......
ÐèÒªÈÃÄãµÄÐéÄâ»úGuest OS(Linux)ÄÜ×Ô¶¯Ê¶±ðUÅÌ¡£
·½·¨ÈçÏ£º
±£³Ö½¹µãÔÚLinuxÉÏ£¬²åÈëUÅÌ£¬ÕâʱËÞÖ÷²Ù×÷ϵͳWindows»áµ¯³ö“ÕÒµ½ÐÂÉ豸µÄÌáʾ”£¬È»ºóÒ»²½Ò»²½
µÄµãÏÂÒ»²½£¬½áÊøÒԺ󣬾ͿÉÒÔÔÚlinuxʹÓÃfdisk -l /dev/sdbÃüÁî²é¿´µ½/dev/sdb1¡£
ÔÚÐéÄâ»úʶ±ð³öUSBÖ®ºó£¬ÓÃ
fdisk -l /dev/sdb
»ò
fdisk -l ......