26 2 2009 2 Application Research of Computers Vol. 26 No. 2 Feb. 2009 Linux IPv6 * OLSR ( 610054) IPv6 Ad hoc OLSR Linux Linux OLSR OLSR IPv6 OLSR ; OLSR ; Linux ; ; IPv6 TP393 A 1001-3695( 2009) 02-0655- 05 Implementation of IPv6 OLSR protocols in Linux OS YAN Wen GUO Wei LIU Jun ( National Key Laboratory of Communication University of Electronic Science & Technology of China Chengdu 610054 China) Abstract This paper presented a concrete scheme and key techniques about OLSR protocol implementation that supported IPv6 address in Ad hoc network. Firstly introduced the general framework of IPv6 OLSR protocol according to the routing mechanism in Linux OS. Then analyzed the difficulties encountered in the implementation of IPv6 OLSR and then provided proper solutions. Finally built two test beds and presented the implementation results. This implementation scheme is extensible and universality that can be applied to various proactive routing protocols. Key words Ad hoc network; Linux OS; OLSR ( optimized link state routing) protocol; IPv6 address 0 Linux Ad hoc ( mobile Ad hoc network MANET) OLSR Ad hoc 1 OLSR OLSR ( table-driven routing protocol) OLSR OLSR [ 1] IPv4 128 bit IPv6 a) ( multi-point relay MPR) IPv4 IP MPR MPR IPv6 OLSR MPR b) Ga- MPR ted [ 2] Zebra [ 3] Gated GNU ; Zebra GNU OLSR [ Zebra IPv6 4] Zebra [ 5 OLSR 7] OLSR IPv4 IPv6 IPv6 OLSR OLSR hello ( topology control TC) OLSR 2008-04- 20; 2008-07- 05 ( 10577007 60472052) ( 1983- ) Ad hoc ( littlesecret999 @ 126. com) ; ( 1964 - ) Ad hoc ; ( 1973- ) Ad hoc MAC.
656 26 ANSN hello Hello TC 1 2 ; 1 2 MPR MPR TC MPR hello 1 TC TC MPR ( MPR selector) TC ; MPR TC 2 Linux OLSR Linux Windows a) ; b) Linux OLSR 1 OLSR 698 UDP ; ; ; OLSR OLSR MPR_selector TC MPR TC ; 3 OLSR 2 OLSR SIGALRM Linux SI- GALRM a) Hello TC ; Hello TC MPR selector TC TC TC ANSN 1 TC a) hello 2 MPR-selector 2 MPR MPR_selector ; / Hello 1 SIGINT SIGALRM SIGINT Linux ctr + c Linux SIGINT OLSR OLSR hello b) 2 ( a) N_SYM_time N_status b) TC TC ANSN( advertised neighbor sequence number) TC LOST_ NEIGH 2_hop MPR MPR
2 Linux IPv6 OLSR 657 selector ( b) N_ASYM_ time 4. 2. 2 N_status LOST_ NEIGH N_ status SYM_ NEIGH MPR_NEIGH LOST_NEIGH ASYM_NEIGH ( c) N_time 4 OLSR 4. 1 OLSR OLSR 1 1 OLSR SIGALRM SIGALRM 4. 2. 1 OLSR ( TimerQ ) TimerQ 4 2 2 MPR MPR selec tor MPR MPR OLSR hash [ 8] 5 IPv 6 [9] 4. 2 4. 2. 1 OLSR 5. 1. 2 IP ASCII settimer( alarm) IPv6 IPv4 5 a) ; b) 5. 1. 3 Linux SIGALRM TimerQ TimerQ SIGALRM MPR hash [10 ] 5. 1 IPv6 OLSR IPv6 128 bit IPv4 32 bit 3 IPv6 hello 2 5. 1. 1 IPv 6 MPR selector ; IPv6 IPv4 3 4 6 2 MPR selector IPv6 7 SYM 1 struct in6_addr { ; 2 2-hop unit8 _t s6_addr[ 16] ; 2 ; 5 } ; struct sockaddr_in6 { } ; uint8_t sin6_len; /* length of this struct ( 28) * / uint8_t sin6_family; / * AF_INET6* / unsigned short sin6_port; unsigned long sin6_flowinfo; struct in6_addr sin6 _addr; unsigned long sin6_scope_id; IPv6 AF_INET6; IPv4 AF_INET OLSR bind( ) sendto( )
658 26 recvfrom( ) IPv6 IPv4 1 RTF_UP RTF_HOST IPv6 sockaddr_in6 sockaddr_in 300 m 100 m 5. 2 IPv6 IPv4 IPv6 Linux 5. 2. 1 IPv6 ( ) ( IPv6 ) ff Linux ip6tables [ 11] FF01 1 IPv6 M FF02 1 IP fec0 106 2700 12( 12) MAC 00 19 E0 85 01 57 M 5. 2. 2 ip6tables-a INPUT-m mac--mac-source 00 19 E0 85 01 Linux setsockopt 57-j DROP IPv 6_MUL- M TICAST_ IF IPv6 _ ip6 tables-d INPUT 1 ADD_MEMBERSHIP ip6tables ip6 tables-l INPUT struct ipv6_mreq { struct in6_addr ipv6mr_multiaddr; /* IPv6 multicast addr * / OLSR unsigned int ipv6mr_interface; / * interface index or 0 * / PC } ; IPv6_DROP_MEM- /proc / sys/ net/ipv6 / conf/ all/ forwarding BERSHIP 1 [10] 6. 2 OLSR 5. 3 6. 2. 1 Watch route-a inet6 Linux ioctl 6. 1 OLSR / watch route-a inet6 IPv6 Linux ioctl SIOADDRT SIOCDELRTSIOADDRT 6. 2. 2 Ping6 SIOCDELRT Ping ; ping6 IPv4 ioctl IPv6 rtentry ; IPv6 in6_ 6. 3 ping6 rtmsg in6_rt- 6. 3 msg if_nametoindex IPv6 ( ) 1 6 7 RTF_UP RTF_HOST RTF_GATEWAY ; 6 socket UDP socket 698; ff05 15IEEE 802. 11b ( ) 6. 1 OLSR 1 000
2 Linux IPv6 OLSR 659 ICMP IPv6 8 9 = / ; = / 7 1 2 IPv6 fec0 106 2700 22 22; Linux OLSR IPv6 () ( ) OLSR 2 3 8 9 QoS 3 - - 99. 9 1. 29 100 1. 12 99. 7 2. 65 99. 7 1. 22 100 1. 13 5 99. 9 1. 72 - - 100 1. 34 100 1. 65 99. 9 1. 42 98. 9 2. 67 6 100 1. 08 100 1. 29 - - 99. 8 1. 15 100 1. 03 99. 4 2. 25 9 99. 5 3. 24 99. 9 3. 36 99. 9 1. 11 - - 99. 9 1. 84 98. 6 3. 78 12 99. 7 1. 14 99. 7 2. 88 100 1. 09 100 1. 26 - - 99. 1 2. 29 22 100 1. 23 98. 7 2. 49 99. 4 2. 7 98. 4 3. 29 99 2. 39 - - 3 2 [ 6]. OLSR [ J]. 2006 32( 3) 78-81. 3 5 6 9 12 22 [ 7]. Ad hoc [ J]. 2006 32 ( 3) 5-10. /% /ms / % / ms / % / ms / % / ms /% /ms / % / ms [ 8]. [ M]. 2001 212-216. 3 - - 97. 2 3. 13 99. 8 2. 41 99. 5 2. 62 99. 9 1. 17 99. 8 1. 13 [ 9] STEVENS W R. Advanced programming in the UNIX environment 5 99 3. 48 - - 99. 9 0. 96 94. 6 3. 34 100 3. 27 99. 1 4. 45 [ M]. 3rd ed. [ S. l. ] Addison Wesley 2002 263-324. 6 99. 8 2. 4 100 1. 01 - - 100 1. 08 100 0. 97 99. 5 3. 23 [ 10] STEVENS W R FENNER B RUDOFF A M. UNIX network programming 9 99. 4 2. 88 99. 6 2. 96 100 1. 3 - - 100 1. 27 98. 9 3. 44 volume 1 the sockets networking API[ M]. 3rd ed. [ S. 12 100 1. 11 99. 6 2. 89 100 1. 11 100 1. 18 - - 99. 5 2. 49 l. ] Addison Wesley 2003. 22 100 1. 22 96. 6 3. 98 99. 2 3. 24 99. 2 3. 48 99. 6 2. 47 - - 2 1 [ 1 ] LAUSEN T JACQUET P. RFC 3626 Optimized link state routing protocol[ S]. 2003. 3 5 6 9 12 22 [ 2] Gated project homepage[ EB/ OL]. ( 2007-09 -05 ). http / /www. gated. org. /% /ms / % / ms / % / ms / % / ms /% /ms / % / ms [ 3] Zebra project homepage[ EB/OL]. ( 2007-11 -05 ). http / /www. zebra. org/. [ 4] TSUKADA M ERNST T. Vehicle communication experiment environment with MANET and NEMO[ C] / /Proc of Applications and the Internet Workshops. 2007. [ 5]. OOP OLSR [ J]. 2007 23 ( 27) 125-126. [ 11] Netfilter /Iptables homepage[ EB/OL]. ( 2007-12-07). http / /www. netfilter. org. ( 654 ) [ 5] ETTLER K A LEHOCZKY J P TTROSNIDER J K. Modeling bus scheduling policies for real-time systems[ C] / /Proc of the 16th IEEE Real-time Systems Symposium. Oakland IEEE Press 1995 242-253. [ 6] CHEN C H LEE G W HUANG J D et al. A real-time and bandwidth guaranteed arbitration algorithm for SoC bus communication [ C] / / Proc of Asia and South Pacific Design Automation Conference. Pacifica Yokohama IEEE Press 2006 600-605. [ 7] KOVALSKI A B. High-speed bus arbiter for multiprocessors [ C] / / Proc of IEEE. [ S. l. ] IEEE Press 1983 49-56. [ 8] SECELEANU T KNUUTILA T NEVALAINEN O. Starvation free arbitration policies for the segmented-bus platform[ C] / / Proc of International Symposium on Signals Circuits and Systems. Iasi Romania IEEE Press 2005 67-70. [ 9] LAHIRI K RAGHUNATHAN A LAKSHMINARAYANA G. LOT- TERYBUS a new high-performance communication architecture for system-on-chip designs [ C] / / Proc of DAC 2001. Las Vegas IEEE Press 2001 15-20. [ 10] XU Yi LI Li GAO Ming-lun et al. An adaptive dynamic arbiter for multi-processor SoC[ C] / / Proc of the 8th International Conference on Solid-State and Integrated Circuit Technology. Shanghai IEEE Press 2006 1993-1996. [ 11] LI Ming ZENG Qing-an JONE W B. DyXY a proximity congestion-aware deadlock-free dynamic routing method for network on chip [ C] / / Proc of DAC 2006. San Francisco California IEEE Press 2006 849-852.