2011年8月5日 星期五

Embedded Linux IPv6 ready logo phase-2

The past month I'm working on IPv6 ready test on an embedded linux platform.
Since the kernel is really old 2.6.10 and I have to do some porting from newer kernel to get IPv6 ready test pass. Last week I finally all pass and below are some tips.

1.The test node (TN) is FreeBSD 7.4 release with v6eval-3.3.2 / v6eval-remotes-3.0 / Self_Test_5.0.0

It's very important that to disable ipv6 autoconfiguration on TN, because the testing suit needs clean ipv6 environment.

To disable ipv6 autoconfiguration, edit /etc/rc.conf and set

ipv6_enable="NO"

then after TN boot, the ipv6 link local address (fe80:X) won't be exist.

2./usr/local/v6eval/etc/tn.def

#
# tn.def
#
#  Information about the Tester Node (TN)
#

#
# Remote Controal Configuration
#
RemoteDevice    cuad0
RemoteDebug     0
RemoteIntDebug  0
RemoteLog       1
RemoteSpeed     0
RemoteLogout    0
RemoteMethod    serial
#filter ipv6

#linkname       interface       BOGUS ether source address
#               name            of the Tester Interface
Link0           rl0             00:00:00:00:01:00
#Link1          de1             00:00:00:00:01:01
#Link2          de2             00:00:00:00:01:02
#Link3          de4             00:00:00:00:01:03

3./usr/local/v6eval/etc/nut.def

#
# nut.def
#
#  Information about the Node Under Test (NUT)
#

# System type
System          linux-v6

# System information
TargetName      FreeBSD/i386 4.9-RELEASE + kame-20040726-freebsd49-snap

# Name
HostName        HL200

# Type
#   host, router, special
Type            host

# Super user name and it's password
# if you select manual as "System", you don't care "User" and "Password"
#
User            root
Password        1234

#linkname       interface       The EXACT ether source address
#               name            of the Interface Under Test
Link0           eth0            00:AE:45:BC:84:1E
#Link0          eth0            00:60:37:c0:ff:ee
#Link1          fxp1            00:00:92:a7:6d:f6
#Link2          de0             00:c0:f6:b0:aa:ef
#Link3          de1             00:00:92:a7:6d:f8
#Link4          de2             00:90:27:14:ce:e3

4./usr/local/lib/perl5/site_perl/5.10.1/V6evalRemote.pm
This file is really important for self test. It makes the TN to communicate NUT through serial RS232 port. TN can login / logout NUT system even more reboot NUT.

So, find key words below in this file and get it right

    $Type="linux-v6";
    $Device="cuad0";
    $User="root";
    $Password="1234";

The TN will detect message from NUT to login / logout. For example "login: " and "Password: ". Also get it right for your NUT's Behavior

    # login prompt
    %prompt_user = (
           ...
           'linux-v6',         'login: ',
           ...
    );

    # password prompt
    %prompt_password = (
       ...
        'linux-v6',             'Password: ',
        ...
    );

    # command prompt
    %prompt_command = (
        ...
        'linux-v6',              '(\$|#) ',
        ...
    );

    and so on

5.Test TN <-RS232-> NUT
If you can see login screen or promopt, it works

touch /var/log/aculog
chown uucp:dialer /var/log/aculog
chmod 660 /var/log/aculog
cu -l /dev/cuad0
Connected

[root@HL200 ~]$

6.Remote test
To test if TN can login then logout NUT

/usr/local/v6eval/bin/linux-v6/loginout.rmt -o1

HL200 login: root
Password:


BusyBox v1.2.2 (2011.07.20-06:33+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

[root@HL200 ~]$
[root@HL200 ~]$ exit

7.Run self test

cd Self_Test_5-0-0
make clean
make ipv6ready_p2_host

8.Run parts of self test

There are 5 test sections, you can test separated.

cd nd.p2/
make clean
make ipv6ready_p2_host

Also can test only few items, for example test items 10 to 20

make AROPT="-s 10 -e 20" ipv6ready_p2_host

9.Embedded linux setup.
There are some sysctl for ipv6 need to be set correct.

echo 0 > /proc/sys/net/ipv6/conf/default/forwarding
echo 2 > /proc/sys/net/ipv6/conf/default/dad_transmits
echo 1 > /proc/sys/net/ipv6/conf/default/use_tempaddr
echo 2 > /proc/sys/net/ipv6/conf/default/accept_dad
echo 1 > /proc/sys/net/ipv6/conf/default/optimistic_dad
echo 1 > /proc/sys/net/ipv6/conf/default/accept_redirects

Remember to set promisc and allmulti to ethernet port.
Another tip is to sleep 10 seconds after the ethernet up then go login screen

ip -6 link set lo up
#ip -6 link set eth0 up
ifconfig eth0 up promisc allmulti

echo "Wait 10 secs..."            
sleep 10                          

10.Finally, fix /usr/local/v6eval/bin/unknown/ping6.rmt

########################################################################
use V6evalRemote;

rOpen() || goto error;

$NUTif = $rOpt_if;
$dstaddress = $rOpt_addr;
$rOpt_timeout = 5 if ! defined $rOpt_timeout;

if($rOpt_size < 1) {
    $rOpt_size = 2;
}

$pingpath = "ping6";
$pingopt  = "-n -c 1 -i 1 -s $rOpt_size -p 00 -w 2 -M want";
$ifopt    = "-I $NUTif" if $NUTif ne "";

rLogin($rOpt_timeout) || goto error;
rCommand("$pingpath $pingopt $ifopt $dstaddress", 15) || goto error;
rLogout($rOpt_timeout) || goto error;

rClose();
exit($V6evalRemote::exitPass);

error:
    rClose();
    exit($V6evalRemote::exitFail);

########################################################################