LinuxÄÚºËÈçºÎ½ÓÊÕ²»Í¬ÀàÐÍÒÔÌ«Ö¡
1. Ç°ÑÔ
ÒÔÌ«Í·ÖгýÁË6×Ö½ÚÄ¿µÄMACµØÖ·¡¢6×Ö½ÚÔ´MACµØÖ·Í⣬»¹ÓÐÁ½×Ö½ÚµÄÒÔÌ«Ö¡ÀàÐÍÖµ£¬ÈçIPv4Ϊ0x0800£¬ARPΪ0x0806µÈ£¬Íø¿¨Çý¶¯ÊÕµ½ÒÔÌ«Ö¡ºóͨ¹ý½Ó¿Úº¯Êýnetif_receive_skb()(netif_rxʵ¼Ê×îºóÒ²Êǵ÷ÓÃnetif_receive_skb)½»µ½Éϲ㣬¶øÕâ¸ö½Ó¿Úº¯Êý¾ÍÍê³É¶ÔÒÔÌ«Ö¡ÀàÐ͵ÄÇø·Ö£¬½»µ½²»Í¬µÄÐÒé´¦Àí³ÌÐò¡£Èç¹ûÏë×Ô¼º±àдijһÒÔÌ«ÀàÐÍÖ¡µÄ´¦Àí³ÌÐò£¬ÐèÒª×Ô¼ºÌí¼ÓÏàÓ¦µÄ
ÒÔÏÂLinuxÄں˴úÂëΪ2.6.17.11¡£
2. Êý¾Ý½á¹¹
ÿÖÖÐÒ鶼Ҫ¶¨ÒåÒ»¸öpacket_type½á¹¹£¬Òýµ¼½øÈëÏà¹ØµÄÐÒéÊý¾Ý´¦Àíº¯Êý£¬ËùÓнڵã×é³ÉÒ»¸öÁ´±í(HASHÁ´±í)¡£
/* include/linux/netdevice.h */
struct packet_type {
__be16 type; /* This is really htons(ether_type). */
struct net_device *dev; /* NULL is wildcarded here */
int (*func) (struct sk_buff *,
struct net_device *,
struct packet_type *,
struct net_device *);
void *af_packet_priv;
struct list_head list;
};
²ÎÊý˵Ã÷£º
type£ºÒÔÌ«Ö¡ÀàÐÍ£¬16λ
dev£ºËù¸½×ŵÄÍø¿¨É豸£¬Èç¹ûΪNULLÔòÆ¥ÅäÈ«²¿Íø¿¨
func£ºÐÒéÈë¿Ú½ÓÊÕ´¦Àíº¯Êý
af_packet_priv£ºÐÒé˽ÓÐÊý¾Ý
list£ºÁ´±í¿Û
Ò»°ã¸÷ÐÒéµÄpacket_type½á¹¹¶¼ÊǾ²Ì¬´æÔÚ£¬³õʼ»¯Ê±Ö»ÌṩtypeºÍfuncÁ½¸ö²ÎÊý¾Í¿ÉÒÔÁË£¬Ã¿¸öÐÒéÔÚ³õʼ»¯Ê±¶¼Òª½«´Ë½á¹¹¼ÓÈ뵽ϵͳÀàÐÍÁ´±íÖС£
3. ´¦Àíº¯Êý
3.1 Ìí¼Ó½Úµã
/* net/core/dev.c */
/**
* dev_add_pack - add packet handler
* @pt: packet type declaration
*
* Add a protocol handler to the networking stack. The passed &packet_type
* is linked into kernel lists and may not be freed until it has been
* removed from the kernel lists.
*
* This call does not sleep therefore it can not
* guarantee all CPU's that are in middle of receiving packets
* will see the new packet type (until the next received packet).
*/
void dev_add_pack(struct packet_type *pt)
{
int hash;
 
Ïà¹ØÎĵµ£º
1. HCI²ãÐÒé¸ÅÊö£º
HCIÌṩһÌ×ͳһµÄ·½·¨À´·ÃÎÊBluetoothµ×²ã¡£ÈçͼËùʾ£º
´ÓͼÉÏ¿ÉÒÔ¿´³ö£¬Host Controller Interface(HCI) ¾ÍÊÇÓÃÀ´¹µÍ¨HostºÍModule¡£Hostͨ³£¾ÍÊÇPC£¬ ModuleÔòÊÇÒÔ¸÷ÖÖÎïÀíÁ¬½ÓÐÎʽ£¨USB,serial,pc-cardµÈ£©Á¬½Óµ½PCÉϵÄbluetooth Dongle¡£
ÔÚHostÕâÒ»¶Ë£ºapplication,SDP,L2capµÈÐÒé ......
LinuxÏÂmbstring°²×°
1¡¢ÓÃcdÃüÁî½øÈëphpµÄÔ´´úÂëĿ¼ÏµÄetc/mbstringĿ¼Ï£¬Èç“/src/php5.2.5”£¬¼´“cd /src/php5.2.5”;
2¡¢>/usr/local/php/bin/phpize £¨¼ÙÉèphp°²×°ÔÚ/usr/local/phpĿ¼Ï£©
3¡¢±àÒëÅäÖã¬>./configure --with-php-config=/usr/local/php/bin/php-config
4¡¢Ö´ÐÐ ......
LinuxÒª°²×°mssqlÀ©Õ¹£¬±ØÐëÊ×ÏÈ°²×°freetds£¬°²×°¹ý³ÌÈçÏ£º
1¡¢¼ÙÉèÔ´ÎļþĿ¼Ϊ/webServ£¬°²×°Ä¿Â¼Îª/opt/freetds¡£
1) >cd /webServ
2) ÏÂÔØ£¬ >wget ftp://ftp.ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz
3) ½âѹ£¬ >tar -zxvf freetds-stable.tgz
4) ½øÈ룬 >cd freetds-0¡£ ......
ÔÚÎÒÃÇÔÚд³ÌÐòµÄ¹ý³ÌÖÐ,ÓÐЩʱºòÐèÒªÖªµÀһЩµçÄÔµÄÓ²¼þÐÅÏ¢,±ÈÈçÎÒÃÇдһЩÐèҪע²áµÄ³ÌÐòµÄʱºò,¾ÍÐèÒªµÃµ½Ä³¸öµçÄÔÌض¨µÄÐÅÏ¢,Ò»°ãÀ´Ëµ,Íø¿¨µÄÎïÀíµØÖ·ÊDz»»áÖظ´µÄ,ÎÒÃÇÕýºÃ¿ÉÒÔÓÃËüÀ´×öΪÎÒÃÇʶ±ðһ̨µçÄԵıêÖ¾.ÄÇÈçºÎµÃµ½Íø¿¨µÄÎïÀíµØÖ·ÄØ?ÎÒÃÇ¿ÉÒÔ½èÖúÓÚProcessBuilderÕâ¸öÀà,Õâ¸öÀàÊÇJDK1.5мӵÄ,ÒÔÇ°Ò²¿ÉÒÔÓÃRu ......
¸ú×ÙϵͳµÄÊä³ö:
strace
ÀýÈç: strace -p 9034 -x -s 2048
-p ½ø³ÌºÅ
-x ²»ÊÇASCIIµÄÊä³öÓÃHEX±íʾ
-s ÿ´ÎÊä³öµ ......