Commit 795f38b networking: rm cases which are not suitable for upstream test

26 files Authored and Committed by jishi 5 months ago
networking: rm cases which are not suitable for upstream test

part cases need to nics, so not suitable for upstream test

    
 1 @@ -1,82 +0,0 @@
 2 - # Copyright (c) 2014 Red Hat, Inc.  This copyrighted material
 3 - # is made available to anyone wishing to use, modify, copy, or
 4 - # redistribute it subject to the terms and conditions of the GNU General
 5 - # Public License v.2.
 6 - #
 7 - # This program is distributed in the hope that it will be useful, but WITHOUT ANY
 8 - # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 9 - # PARTICULAR PURPOSE. See the GNU General Public License for more details.
10 - #
11 - # You should have received a copy of the GNU General Public License
12 - # along with this program; if not, write to the Free Software
13 - # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 - #
15 - # Author: Wei Chen <weichen@redhat.com>
16 - 
17 - # The toplevel namespace within which the test lives.
18 - # FIXME: You will need to change this:
19 - TOPLEVEL_NAMESPACE=kernel
20 - 
21 - # The name of the package under test:
22 - # FIXME: you wil need to change this:
23 - PACKAGE_NAME=
24 - 
25 - # The path of the test below the package:
26 - # FIXME: you wil need to change this:
27 - RELATIVE_PATH=networking/ipv6/socket/ioctl/ifaddr
28 - 
29 - # Version of the Test. Used with make tag.
30 - export TESTVERSION=0.1
31 - 
32 - # The combined namespace of the test.
33 - export TEST=/$(TOPLEVEL_NAMESPACE)/$(RELATIVE_PATH)
34 - 
35 - 
36 - # A phony target is one that is not really the name of a file.
37 - # It is just a name for some commands to be executed when you
38 - # make an explicit request. There are two reasons to use a
39 - # phony target: to avoid a conflict with a file of the same
40 - # name, and to improve performance.
41 - .PHONY: all install download clean
42 - 
43 - # executables to be built should be added here, they will be generated on the system under test.
44 - BUILT_FILES=
45 - 
46 - # data files, .c files, scripts anything needed to either compile the test and/or run it.
47 - FILES=$(METADATA) runtest.sh Makefile PURPOSE ipv6_ioctl_ifaddr.c
48 - 
49 - run: $(FILES) build
50 - »       ./runtest.sh
51 - 
52 - build: $(BUILT_FILES)
53 - »       chmod a+x ./runtest.sh
54 - 
55 - clean:
56 - »       rm -f *~ *.rpm $(BUILT_FILES)
57 - 
58 - # You may need to add other targets e.g. to build executables from source code
59 - # Add them here:
60 - 
61 - 
62 - # Include Common Makefile
63 - include /usr/share/rhts/lib/rhts-make.include
64 - 
65 - # Generate the testinfo.desc here:
66 - $(METADATA): Makefile
67 - »       @touch $(METADATA)
68 - # Change to the test owner's name
69 - »       @echo "Owner:        Wei Chen <weichen@redhat.com>" > $(METADATA)
70 - »       @echo "Name:         $(TEST)" >> $(METADATA)
71 - »       @echo "Path:         $(TEST_DIR)"»       >> $(METADATA)
72 - »       @echo "License:      GPLv2" >> $(METADATA)
73 - »       @echo "TestVersion:  $(TESTVERSION)"»       >> $(METADATA)
74 - »       @echo "Description:  inet6_ioctl SIOCSIFADDR/SIOCDIFADDR/SIOCSIFDSTADDR">> $(METADATA)
75 - »       @echo "TestTime:     10m" >> $(METADATA)
76 - »       @echo "Type:         Regression" >> $(METADATA)
77 - »       @echo "RunFor:       $(PACKAGE_NAME)" >> $(METADATA)
78 - # add any other packages for which your test ought to run here
79 - »       @echo "Requires:     $(PACKAGE_NAME)" >> $(METADATA)
80 - # add any other requirements for the script to run here
81 - 
82 - # You may need other fields here; see the documentation
83 - »       rhts-lint $(METADATA)
 1 @@ -1,35 +0,0 @@
 2 - Options SIOCSIFADDR, SIOCDIFADDR, SIOCSIFDSTADDR are covered by this testcase:
 3 - 
 4 - 477:int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
 5 - 478-{
 6 - 479-»       struct sock *sk = sock->sk;
 7 - 480-»       struct net *net = sock_net(sk);
 8 - 481-
 9 - 482-»       switch(cmd)
10 - 483-»       {
11 - 484-»       case SIOCGSTAMP:
12 - 485-»       »       return sock_get_timestamp(sk, (struct timeval __user *)arg);
13 - 486-
14 - 487-»       case SIOCGSTAMPNS:
15 - 488-»       »       return sock_get_timestampns(sk, (struct timespec __user *)arg);
16 - 489-
17 - 490-»       case SIOCADDRT:
18 - 491-»       case SIOCDELRT:
19 - 492-
20 - 493-»       »       return(ipv6_route_ioctl(net, cmd, (void __user *)arg));
21 - 494-
22 - 495-»       case SIOCSIFADDR:
23 - 496-»       »       return addrconf_add_ifaddr(net, (void __user *) arg);
24 - 497-»       case SIOCDIFADDR:
25 - 498-»       »       return addrconf_del_ifaddr(net, (void __user *) arg);
26 - 499-»       case SIOCSIFDSTADDR:
27 - 500-»       »       return addrconf_set_dstaddr(net, (void __user *) arg);
28 - 501-»       default:
29 - 502-»       »       if (!sk->sk_prot->ioctl)
30 - 503-»       »       »       return -ENOIOCTLCMD;
31 - 504-»       »       return sk->sk_prot->ioctl(sk, cmd, arg);
32 - 505-»       }
33 - 506-»       /*NOTREACHED*/
34 - 507-»       return(0);
35 - 508-}
36 - 
 1 @@ -1,89 +0,0 @@
 2 - #include <stdio.h>
 3 - #include <unistd.h>
 4 - #include <fcntl.h>
 5 - #include <stdlib.h>
 6 - #include <string.h>
 7 - #include <sys/types.h>
 8 - #include <sys/socket.h>
 9 - #include <sys/ioctl.h>
10 - #include <sys/syscall.h>
11 - #include <arpa/inet.h>
12 - #include <errno.h>
13 - #include <net/if.h>
14 - #include <netinet/in.h>
15 - #include <netinet/sctp.h>
16 - #include <sys/uio.h>
17 - #include <linux/in6.h>
18 - #include <linux/socket.h>
19 - #include <linux/ipv6.h>
20 - #include <netdb.h>
21 - 
22 - 
23 - #define MY_PORT_NUM 51111 /* This can be changed to suit the need and should be same in server and client */
24 - #define TRUE 1
25 - #define FALSE 0
26 - 
27 - 
28 - int main( int argc, char *argv[] )
29 - {
30 - 
31 -   int listenSock, connectSock, ret;
32 -   struct sockaddr_in6 servaddrs;
33 -   struct in6_ifreq ifr61;
34 -   struct in6_ifreq ifr62;
35 - 
36 -   memset(&ifr61, 0, sizeof ifr61);
37 -   memset(&ifr62, 0, sizeof ifr62);
38 - 
39 -   struct sockaddr_in6 servaddr61;
40 -   struct sockaddr_in6 servaddr62;
41 -   bzero( (void *)&servaddr61, sizeof(servaddr61) );
42 -   bzero( (void *)&servaddr62, sizeof(servaddr62) );
43 -   char ipbuffer[INET6_ADDRSTRLEN];
44 - 
45 -   /* Create listen socket */
46 -   listenSock = socket( AF_INET6, SOCK_STREAM, IPPROTO_SCTP );
47 - 
48 -   bzero( (void *)&servaddrs, sizeof(servaddrs) );
49 -   servaddrs.sin6_family = AF_INET6;
50 -   inet_pton (AF_INET6, argv[1], &(servaddrs.sin6_addr));
51 -   servaddrs.sin6_port = htons(51111);
52 -   ret = bind( listenSock, (struct sockaddr *)&servaddrs, sizeof(servaddrs) );
53 - 
54 - 
55 -   /* Set inet6 addr */
56 -   servaddr61.sin6_family = AF_INET6;
57 -   inet_pton (AF_INET6, argv[2], &(servaddr61.sin6_addr));
58 -   servaddr61.sin6_port = htons(51111);
59 -   memcpy( &ifr61.ifr6_addr, &servaddr61.sin6_addr, sizeof (struct sockaddr_in6) );
60 -   ifr61.ifr6_ifindex = 1; 
61 -   if ( ioctl( listenSock, SIOCSIFADDR, &ifr61 ) == -1 )
62 -      perror("inet6_ioctl error.\n");
63 -   else
64 -      printf("change inet addr to: %s\n", inet_ntop(AF_INET6, &servaddr61.sin6_addr, ipbuffer, INET6_ADDRSTRLEN));
65 - 
66 - 
67 -   /* Set remote destination inet6 addr */
68 -   servaddr62.sin6_family = AF_INET6;
69 -   inet_pton (AF_INET6, argv[3], &(servaddr62.sin6_addr));
70 -   servaddr62.sin6_port = htons(51111);
71 -   ifr62.ifr6_ifindex = 1;
72 -   memcpy( &ifr62.ifr6_addr, &servaddr62.sin6_addr, sizeof (struct sockaddr_in6) );
73 - 
74 -   if ( ioctl ( listenSock, SIOCSIFDSTADDR, &ifr62) == -1)
75 -      perror("inet6_ioctl error.\n");
76 -   else
77 -      printf("set remote destination addr to: %s\n", inet_ntop(AF_INET6, &servaddr62.sin6_addr, ipbuffer, INET6_ADDRSTRLEN));
78 - 
79 -   /* Delete inet6 addr */
80 -   if ( ioctl( listenSock, SIOCDIFADDR, &ifr61) == -1)
81 -      perror("inet6_ioctl error.\n");
82 -   else
83 -      printf("Deleted inet addr : %s\n", inet_ntop(AF_INET6, &servaddr61.sin6_addr, ipbuffer, INET6_ADDRSTRLEN));
84 -   
85 - 
86 -   close (listenSock);
87 - 
88 -   return 0;
89 - 
90 - }
 1 @@ -1,68 +0,0 @@
 2 - #!/bin/bash
 3 - # Copyright (c) 2006 Red Hat, Inc.  This copyrighted material
 4 - # is made available to anyone wishing to use, modify, copy, or
 5 - # redistribute it subject to the terms and sctp_conditions of the GNU General
 6 - # Public License v.2.
 7 - #
 8 - # This program is distributed in the hope that it will be useful, but WITHOUT ANY
 9 - # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
10 - # PARTICULAR PURPOSE. See the GNU General Public License for more details.
11 - #
12 - # You should have received a copy of the GNU General Public License
13 - # along with this program; if not, write to the Free Software
14 - # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15 - #
16 - # Author: Wei Chen <weichen@redhat.com>
17 - ###########################################
18 - # RUN_TIME : how long you want to run, max is 300
19 - ###########################################
20 - 
21 - . /usr/share/beakerlib-libraries/kernel/Library/networking-common/include.sh
22 - 
23 - NAY=${NAY:-yes}
24 - NIC_NUM=${NIC_NUM:-2}
25 - 
26 - reset_if()
27 - {
28 -         iface=$1
29 - 
30 -         ip link set dev $iface down
31 -         ip addr flush dev $iface
32 -         ip link set dev $iface up
33 -         sleep 1
34 - }
35 - 
36 - 
37 - Sec_nic_iface=$(get_sec_iface)
38 - ###$(get_required_iface | awk '{ print $2 }')
39 - 
40 - # Should we also use the same subnet for IPv4 ?
41 - SER_ADDR6_1="2012::11"
42 - SER_ADDR6_2="2012::21"
43 - SER_ADDR6_3="2012::31"
44 - 
45 - 
46 - rlJournalStart
47 -         rlPhaseStartSetup
48 - »       »       rlRun "yum install -y lksctp-tools-devel"
49 -         »       rlRun "modprobe sctp"
50 -         »       rlRun "gcc -o ipv6_ioctl_ifaddr ipv6_ioctl_ifaddr.c -lpthread -lsctp -lc"
51 -         »       Sec_nic_iface=$(get_sec_iface)
52 -                 ###$(get_required_iface | awk '{ print $2 }')
53 -         »       rlRun "ip -6 addr flush dev $Sec_nic_iface"
54 -         »       reset_if $Sec_nic_iface
55 -         »       rlRun "ip addr add ${SER_ADDR6_1}/64 dev $Sec_nic_iface"
56 -         rlPhaseEnd
57 - 
58 -         rlPhaseStartTest
59 - »       »       rlRun "tcpdump -i any -vvv -n -nn -l -w /root/tcpdumplog.pcap &"
60 -                 rlRun "./ipv6_ioctl_ifaddr $SER_ADDR6_1 $SER_ADDR6_2 $SER_ADDR6_3" 0
61 -         rlPhaseEnd
62 - 
63 -         rlPhaseStartCleanup
64 -                 ps aux | awk '/ipv6_ioctl_ifaddr/ { print $2 }' | head -1 | xargs kill -9
65 -                 ps aux | awk '/tcpdump/ { print $2 }' | head -1 | xargs kill -9
66 -         rlPhaseEnd
67 - 
68 -         rlJournalPrintText
69 - rlJournalEnd
1 @@ -1,1 +0,0 @@
2 - param: [NAY=yes], setup: [--nay-nic-num=2]
 1 @@ -1,83 +0,0 @@
 2 - # Copyright (c) 2014 Red Hat, Inc.  This copyrighted material
 3 - # is made available to anyone wishing to use, modify, copy, or
 4 - # redistribute it subject to the terms and conditions of the GNU General
 5 - # Public License v.2.
 6 - #
 7 - # This program is distributed in the hope that it will be useful, but WITHOUT ANY
 8 - # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 9 - # PARTICULAR PURPOSE. See the GNU General Public License for more details.
10 - #
11 - # You should have received a copy of the GNU General Public License
12 - # along with this program; if not, write to the Free Software
13 - # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 - #
15 - # Author:  WeiChen <weichen@redhat.com>
16 - 
17 - # The toplevel namespace within which the test lives.
18 - # FIXME: You will need to change this:
19 - TOPLEVEL_NAMESPACE=kernel
20 - 
21 - # The name of the package under test:
22 - # FIXME: you wil need to change this:
23 - PACKAGE_NAME=
24 - 
25 - # The path of the test below the package:
26 - # FIXME: you wil need to change this:
27 - RELATIVE_PATH=networking/ipv6/socket/so_reuseport_udp
28 - 
29 - # Version of the Test. Used with make tag.
30 - export TESTVERSION=0.1
31 - 
32 - # The combined namespace of the test.
33 - export TEST=/$(TOPLEVEL_NAMESPACE)/$(RELATIVE_PATH)
34 - 
35 - 
36 - # A phony target is one that is not really the name of a file.
37 - # It is just a name for some commands to be executed when you
38 - # make an explicit request. There are two reasons to use a
39 - # phony target: to avoid a conflict with a file of the same
40 - # name, and to improve performance.
41 - .PHONY: all install download clean
42 - 
43 - # executables to be built should be added here, they will be generated on the system under test.
44 - BUILT_FILES=
45 - 
46 - # data files, .c files, scripts anything needed to either compile the test and/or run it.
47 - FILES=$(METADATA) runtest.sh Makefile PURPOSE server_anyaddr.py server_ipv6addr.py
48 - 
49 - run: $(FILES) build
50 - »       ./runtest.sh
51 - 
52 - build: $(BUILT_FILES)
53 - »       chmod a+x ./runtest.sh
54 - 
55 - clean:
56 - »       rm -f *~ *.rpm $(BUILT_FILES)
57 - 
58 - # You may need to add other targets e.g. to build executables from source code
59 - # Add them here:
60 - 
61 - 
62 - # Include Common Makefile
63 - include /usr/share/rhts/lib/rhts-make.include
64 - 
65 - # Generate the testinfo.desc here:
66 - $(METADATA): Makefile
67 - »       @touch $(METADATA)
68 - # Change to the test owner's name
69 - »       @echo "Owner:        WeiChen <weichen@redhat.com>" > $(METADATA)
70 - »       @echo "Name:         $(TEST)" >> $(METADATA)
71 - »       @echo "Path:         $(TEST_DIR)"        >> $(METADATA)
72 - »       @echo "License:      GPLv2" >> $(METADATA)
73 - »       @echo "TestVersion:  $(TESTVERSION)"        >> $(METADATA)
74 - »       @echo "Description:  soreuseport: fast reuseport UDP socket selection">> $(METADATA)
75 - »       @echo "TestTime:     1h" >> $(METADATA)
76 - »       @echo "Type:         Singlehost" >> $(METADATA)
77 - »       @echo "RunFor:       $(PACKAGE_NAME)" >> $(METADATA)
78 - # add any other packages for which your test ought to run here
79 - »       @echo "Requires:     $(PACKAGE_NAME)" >> $(METADATA)
80 - # add any other requirements for the script to run here
81 - 
82 - # You may need other fields here; see the documentation
83 - »       rhts-lint $(METADATA)
84 - 
 1 @@ -1,38 +0,0 @@
 2 -    Upstream commit:
 3 -     commit e32ea7e747271a0abcd37e265005e97cc81d9df5
 4 -     Author: Craig Gallek <kraig@google.com>
 5 -     Date:   Mon Jan 4 17:41:46 2016 -0500
 6 -     
 7 -         soreuseport: fast reuseport UDP socket selection
 8 -     
 9 -         Include a struct sock_reuseport instance when a UDP socket binds to
10 -         a specific address for the first time with the reuseport flag set.
11 -         When selecting a socket for an incoming UDP packet, use the information
12 -         available in sock_reuseport if present.
13 -     
14 -         This required adding an additional field to the UDP source address
15 -         equality function to differentiate between exact and wildcard matches.
16 -         The original use case allowed wildcard matches when checking for
17 -         existing port uses during bind.  The new use case of adding a socket
18 -         to a reuseport group requires exact address matching.
19 -     
20 -         Performance test (using a machine with 2 CPU sockets and a total of
21 -         48 cores):  Create reuseport groups of varying size.  Use one socket
22 -         from this group per user thread (pinning each thread to a different
23 -         core) calling recvmmsg in a tight loop.  Record number of messages
24 -         received per second while saturating a 10G link.
25 -           10 sockets: 18% increase (~2.8M -> 3.3M pkts/s)
26 -           20 sockets: 14% increase (~2.9M -> 3.3M pkts/s)
27 -           40 sockets: 13% increase (~3.0M -> 3.4M pkts/s)
28 -     
29 -         This work is based off a similar implementation written by
30 -         Ying Cai <ycai@google.com> for implementing policy-based reuseport
31 -         selection.
32 -     
33 -         Signed-off-by: Craig Gallek <kraig@google.com>
34 -         Signed-off-by: David S. Miller <davem@davemloft.net>
35 -     
36 -     Signed-off-by: Paolo Abeni <pabeni@redhat.com>
37 -     Signed-off-by: Jiri Benc <jbenc@redhat.com>
38 -     Signed-off-by: Rafael Aquini <aquini@redhat.com>
39 - 
  1 @@ -1,110 +0,0 @@
  2 - #!/bin/bash
  3 - # Copyright (c) 2006 Red Hat, Inc.  This copyrighted material
  4 - # is made available to anyone wishing to use, modify, copy, or
  5 - # redistribute it subject to the terms and sctp_conditions of the GNU General
  6 - # Public License v.2.
  7 - #
  8 - # This program is distributed in the hope that it will be useful, but WITHOUT ANY
  9 - # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 10 - # PARTICULAR PURPOSE. See the GNU General Public License for more details.
 11 - #
 12 - # You should have received a copy of the GNU General Public License
 13 - # along with this program; if not, write to the Free Software
 14 - # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 15 - #
 16 - # Author:  Wei Chen <weichen@redhat.com>
 17 - ###########################################
 18 - # RUN_TIME : how long you want to run, max is 300
 19 - ###########################################
 20 - 
 21 - . /usr/share/beakerlib-libraries/kernel/Library/networking-common/include.sh
 22 - 
 23 - default_iface=$(get_default_iface)
 24 - SER_ADDR_6=`ip addr show $default_iface | grep inet6 | grep global | awk '{print $2}' | awk -F "/" '{print $1}' | head -n 1`
 25 - SER_PORT=50011
 26 - 
 27 - rm -f serverlog1 serverlog2
 28 - 
 29 - rlJournalStart
 30 -         rlPhaseStartSetup
 31 - 
 32 -         »       yum install -y nmap-ncat
 33 - »       »       yum install -y nmap
 34 -                 yum install -y screen
 35 - 
 36 - »       rlPhaseEnd
 37 - 
 38 -         rlPhaseStartTest
 39 - 
 40 -                 touch serverlog1 serverlog2
 41 -                 chmod 777 serverlog1 serverlog2
 42 - 
 43 -                 stdbuf -o0 ./server_anyaddr.py &>> serverlog1 &
 44 -                 pidnum1=$(pgrep server)
 45 -                 stdbuf -o0 ./server_anyaddr.py &>> serverlog2 &
 46 -                 pidnum2=$(pgrep server | tail -1)
 47 -                 if [ $pidnum2 -eq $pidnum1 ]
 48 - »       »       then
 49 - »       »       »        pidnum1=$(pgrep server | head -1)
 50 -                 fi
 51 -                 sleep 3
 52 - 
 53 -                 for i in `seq 20`;
 54 -                 do
 55 - »       »       »       rlWatchdog "echo "data1234567890" | ncat -6 -u $SER_ADDR_6 $SER_PORT" 180
 56 - »       »       »       sleep 3
 57 -                 done
 58 - 
 59 -                 pkill -9 server
 60 - »       »       pgrep server | xargs kill -9
 61 - 
 62 -                 pidcount1=$(cat serverlog1 | grep -e "Connected to ${pidnum1}" | wc -l)
 63 -                 pidcount2=$(cat serverlog2 | grep -e "Connected to ${pidnum2}" | wc -l)
 64 -                
 65 - 
 66 -                 if [ $pidcount1 -gt 1 ] && [ $pidcount2 -gt 1 ]
 67 - »       »       then
 68 - »       »       »       rlPass "UDP server listening on IPv6 anyaddr using SO_REUSEPORT is operative"
 69 -                 else 
 70 - »       »       »       rlFail "Either SO_REUSEPORT is not operative or UDP server listening on IPv6 anyaddr does not work as expected"
 71 - »       »       fi
 72 -                
 73 -                 rm -f serverlog1 serverlog2  
 74 -                 touch serverlog1 serverlog2
 75 -                 chmod 777 serverlog1 serverlog2
 76 - 
 77 -                 stdbuf -o0 ./server_ipv6addr.py &>> serverlog1 &
 78 -                 pidnum1=$(pgrep server)
 79 -                 stdbuf -o0 ./server_ipv6addr.py &>> serverlog2 &
 80 - »       »       pidnum2=$(pgrep server | tail -1)
 81 -                 if [ $pidnum2 -eq $pidnum1 ]
 82 - »       »       then
 83 - »       »       »        pidnum1=$(pgrep server | head -1)
 84 -                 fi
 85 -                 sleep 3
 86 -                 
 87 - »       »       for i in `seq 20`;
 88 -                 do
 89 - »       »       »       rlWatchdog "echo "data1234567890" | ncat -6 -u $SER_ADDR_6 $SER_PORT" 180
 90 - »       »       »       sleep 3
 91 -                 done
 92 - 
 93 -                 pkill -9 server
 94 - »       »       pgrep server | xargs kill -9
 95 - 
 96 -                 pidcount1=$(cat serverlog1 | grep -e "Connected to ${pidnum1}" | wc -l)
 97 -                 pidcount2=$(cat serverlog2 | grep -e "Connected to ${pidnum2}" | wc -l)
 98 -                
 99 -                 if [ $pidcount1 -gt 1 ] && [ $pidcount2 -gt 1 ]
100 - »       »       then
101 - »       »       »       rlPass "UDP server listening on IPv6 global addr using SO_REUSEPORT is operative"
102 -                 else 
103 - »       »       »       rlFail "Either SO_REUSEPORT is not operative or UDP server listening on IPv6 global addr does not work as expected"
104 - »       »       fi
105 - 
106 -         rlPhaseEnd
107 - 
108 - 
109 -         rlJournalPrintText
110 - rlJournalEnd
111 - 
 1 @@ -1,28 +0,0 @@
 2 - #!/usr/bin/python
 3 - 
 4 - import socket
 5 - import os
 6 - import sys
 7 - 
 8 - SO_REUSEPORT = 15
 9 - IPV6_V6ONLY = 26
10 - sport = 50011
11 - 
12 - 
13 - 
14 - s = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
15 - s.setsockopt(socket.SOL_SOCKET, SO_REUSEPORT, 1)
16 - s.setsockopt(socket.IPPROTO_IPV6, IPV6_V6ONLY, 1)
17 - s.bind(('', 50011))
18 - while True:
19 -     s.setsockopt(socket.SOL_SOCKET, SO_REUSEPORT, 1)
20 -     print('\nWaiting to receive message')
21 -     data, address = s.recvfrom(4096)
22 -     print('\nReceived %s bytes from %s' % (len(data), address))
23 -     print('\nData: %s' % data)
24 -     print('Connected to {}'.format(os.getpid()))
25 -     s.setsockopt(socket.SOL_SOCKET, SO_REUSEPORT, 0) 
26 -     if data:
27 - »       sent = s.sendto(data, address)
28 - »       print('\nSent %s bytes back to %s' % (sent, address))
29 - 
 1 @@ -1,32 +0,0 @@
 2 - #!/usr/bin/python
 3 - 
 4 - import socket
 5 - import os
 6 - import sys
 7 - import commands
 8 - 
 9 - SO_REUSEPORT = 15
10 - IPV6_V6ONLY = 26
11 - sport = 50011
12 - 
13 - def get_addr6():
14 -         return commands.getoutput("ip -6 route get 2001::1 |head -1|grep -o src.* | grep -o -E \"([0-9|a-f]{0,4}:{1,2}){1,7}[0-9|a-f]{1,4}\"")
15 - ipv6globaladdr=get_addr6()
16 - 
17 - 
18 - s = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
19 - s.setsockopt(socket.SOL_SOCKET, SO_REUSEPORT, 1)
20 - s.setsockopt(socket.IPPROTO_IPV6, IPV6_V6ONLY, 1)
21 - s.bind((ipv6globaladdr, 50011))
22 - while True:
23 -     s.setsockopt(socket.SOL_SOCKET, SO_REUSEPORT, 1)
24 -     print('\nWaiting to receive message')
25 -     data, address = s.recvfrom(4096)
26 -     print('\nReceived %s bytes from %s' % (len(data), address))
27 -     print('\nData: %s' % data)
28 -     print('Connected to {}'.format(os.getpid()))
29 -     s.setsockopt(socket.SOL_SOCKET, SO_REUSEPORT, 0) 
30 -     if data:
31 - »       sent = s.sendto(data, address)
32 - »       print('\nSent %s bytes back to %s' % (sent, address))
33 - 
1 @@ -1,1 +0,0 @@
2 - attr: {distronotin: RHEL-5|RHEL-6}
 1 @@ -1,82 +0,0 @@
 2 - # Copyright (c) 2014 Red Hat, Inc.  This copyrighted material
 3 - # is made available to anyone wishing to use, modify, copy, or
 4 - # redistribute it subject to the terms and conditions of the GNU General
 5 - # Public License v.2.
 6 - #
 7 - # This program is distributed in the hope that it will be useful, but WITHOUT ANY
 8 - # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 9 - # PARTICULAR PURPOSE. See the GNU General Public License for more details.
10 - #
11 - # You should have received a copy of the GNU General Public License
12 - # along with this program; if not, write to the Free Software
13 - # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 - #
15 - # Author: Wei Chen <weichen@redhat.com>
16 - 
17 - # The toplevel namespace within which the test lives.
18 - # FIXME: You will need to change this:
19 - TOPLEVEL_NAMESPACE=kernel
20 - 
21 - # The name of the package under test:
22 - # FIXME: you wil need to change this:
23 - PACKAGE_NAME=
24 - 
25 - # The path of the test below the package:
26 - # FIXME: you wil need to change this:
27 - RELATIVE_PATH=networking/ipv6/socket/sock_raw/compat
28 - 
29 - # Version of the Test. Used with make tag.
30 - export TESTVERSION=0.1
31 - 
32 - # The combined namespace of the test.
33 - export TEST=/$(TOPLEVEL_NAMESPACE)/$(RELATIVE_PATH)
34 - 
35 - 
36 - # A phony target is one that is not really the name of a file.
37 - # It is just a name for some commands to be executed when you
38 - # make an explicit request. There are two reasons to use a
39 - # phony target: to avoid a conflict with a file of the same
40 - # name, and to improve performance.
41 - .PHONY: all install download clean
42 - 
43 - # executables to be built should be added here, they will be generated on the system under test.
44 - BUILT_FILES=
45 - 
46 - # data files, .c files, scripts anything needed to either compile the test and/or run it.
47 - FILES=$(METADATA) runtest.sh Makefile PURPOSE ipv6_compat_sockopt.c subtest.yml
48 - 
49 - run: $(FILES) build
50 - »       ./runtest.sh
51 - 
52 - build: $(BUILT_FILES)
53 - »       chmod a+x ./runtest.sh
54 - 
55 - clean:
56 - »       rm -f *~ *.rpm $(BUILT_FILES)
57 - 
58 - # You may need to add other targets e.g. to build executables from source code
59 - # Add them here:
60 - 
61 - 
62 - # Include Common Makefile
63 - include /usr/share/rhts/lib/rhts-make.include
64 - 
65 - # Generate the testinfo.desc here:
66 - $(METADATA): Makefile
67 - »       @touch $(METADATA)
68 - # Change to the test owner's name
69 - »       @echo "Owner:        Wei Chen <weichen@redhat.com>" > $(METADATA)
70 - »       @echo "Name:         $(TEST)" >> $(METADATA)
71 - »       @echo "Path:         $(TEST_DIR)"»       >> $(METADATA)
72 - »       @echo "License:      GPLv2" >> $(METADATA)
73 - »       @echo "TestVersion:  $(TESTVERSION)"»       >> $(METADATA)
74 - »       @echo "Description:  run program in 32bit mode/compat_ipv6_setsockopt/getsockopt/ipv6_flowlable_opt are covered">> $(METADATA)
75 - »       @echo "TestTime:     10m" >> $(METADATA)
76 - »       @echo "Type:         Regression" >> $(METADATA)
77 - »       @echo "RunFor:       $(PACKAGE_NAME)" >> $(METADATA)
78 - # add any other packages for which your test ought to run here
79 - »       @echo "Requires:     $(PACKAGE_NAME)" >> $(METADATA)
80 - # add any other requirements for the script to run here
81 - 
82 - # You may need other fields here; see the documentation
83 - »       rhts-lint $(METADATA)
1 @@ -1,7 +0,0 @@
2 - Because x86_64 processors are designed over x86 technology, they are still able to support 32-bit programs without any hardware emulation,
3 - like what you would need to run x86 programs in a PowerPC or Sparc environment.  In Linux, all you need to do is install the necessary
4 - software libraries to run the 32-bit software.
5 - 
6 - For example, program compiled using gcc -m32 should be able to run in 64bit linux environment, and call appropriate kernel functions.
7 - As far as this testcase is concerned, compat_ipv6_setsockopt() and compat_ipv6_getsockopt() should be executed.IPV6_FL_A_PUT and IPV6_FL_A_RENEW
8 - branches in ipv6_flowlabel_opt are covered if specific socket options are given in setsockopt() function.
  1 @@ -1,169 +0,0 @@
  2 - #include <stdio.h>
  3 - #include <unistd.h>
  4 - #include <fcntl.h>
  5 - #include <stdlib.h>
  6 - #include <string.h>
  7 - #include <sys/types.h>
  8 - #include <sys/socket.h>
  9 - #include <sys/ioctl.h>
 10 - #include <sys/syscall.h>
 11 - #include <netinet/in.h>
 12 - #include <arpa/inet.h>
 13 - #include <errno.h>
 14 - #include <netinet/in.h>
 15 - #include <sys/uio.h>
 16 - #include <linux/in6.h>
 17 - #include <linux/udp.h>
 18 - #include <sys/uio.h>
 19 - #include <linux/in6.h>
 20 - #include <linux/socket.h>
 21 - #include <linux/ipv6.h>
 22 - #include <netdb.h>
 23 - 
 24 - #define MY_PORT_NUM 51111 /* This can be changed to suit the need and should be same in server and client */
 25 - #define TRUE 1
 26 - #define FALSE 0
 27 - #define IPV6_FLOWLABEL_MGR»       32
 28 - 
 29 - struct pseudo_header
 30 - {
 31 -     u_int32_t source_address;
 32 -     u_int32_t dest_address;
 33 -     u_int8_t placeholder;
 34 -     u_int8_t protocol;
 35 -     u_int16_t udp_length;
 36 - };
 37 -  
 38 - /*
 39 -  *     Generic checksum calculation function
 40 -  *     */
 41 - unsigned short csum(unsigned short *ptr,int nbytes) 
 42 - {
 43 -     register long sum;
 44 -     unsigned short oddbyte;
 45 -     register short answer;
 46 -  
 47 -     sum=0;
 48 -     while(nbytes>1) {
 49 -         sum+=*ptr++;
 50 -         nbytes-=2;
 51 -     }
 52 -     if(nbytes==1) {
 53 -         oddbyte=0;
 54 -         *((u_char*)&oddbyte)=*(u_char*)ptr;
 55 -         sum+=oddbyte;
 56 -     }
 57 -  
 58 -     sum = (sum>>16)+(sum & 0xffff);
 59 -     sum = sum + (sum>>16);
 60 -     answer=(short)~sum;
 61 -      
 62 -     return(answer);
 63 - }
 64 - 
 65 - 
 66 - int main ()
 67 - {
 68 - 
 69 -   int listenSock, connectSock, ret, retime, flags;
 70 -   int  rc, new_sd;
 71 -   struct timespec specbefore, specafter;
 72 -   struct sockaddr_in6 servaddrs;
 73 -   struct sockaddr_in6 servaddrc;
 74 - 
 75 -   flags = 0;
 76 - 
 77 -   /* Create listen socket */
 78 -   listenSock = socket( AF_INET6, SOCK_STREAM, IPPROTO_TCP );
 79 - 
 80 -   bzero( (void *)&servaddrs, sizeof(servaddrs) );
 81 -   servaddrs.sin6_family = AF_INET6;
 82 -   inet_pton(AF_INET6, "0::1", &(servaddrs.sin6_addr));
 83 -   servaddrs.sin6_port = htons(51111);
 84 -   ret = bind( listenSock, (struct sockaddr *)&servaddrs, sizeof(servaddrs) );
 85 - 
 86 -   listen( listenSock, 5 );
 87 - 
 88 -   /* Create connect socket */
 89 -   connectSock = socket( AF_INET6, SOCK_STREAM, IPPROTO_TCP );
 90 - 
 91 -   bzero( (void *)&servaddrc, sizeof(servaddrc) );
 92 -   servaddrc.sin6_family = AF_INET6;
 93 -   servaddrc.sin6_port = htons(51111);
 94 -   inet_pton(AF_INET6, "0::1", &(servaddrc.sin6_addr));
 95 - 
 96 -   ret = connect( connectSock, (struct sockaddr *)&servaddrc, sizeof(servaddrc) );
 97 - 
 98 -   /* Accept connection */
 99 -   new_sd = accept(listenSock, NULL, NULL);
100 -   if (new_sd < 0)
101 -   {
102 -      
103 -      perror("accept() failed");
104 -      close ( connectSock );
105 -      close ( listenSock );
106 -      exit (1);
107 -       
108 -   }
109 -   else
110 -   {
111 -    
112 -      printf("  New incoming connection - %d\n", new_sd);
113 -      printf("  Accept new connection OK.\n " );
114 - 
115 -      struct in6_flowlabel_req flowreq1;
116 -      int flowreq_len1 = sizeof( flowreq1 );
117 -      memcpy(&(flowreq1.flr_dst), &(servaddrc.sin6_addr), sizeof(struct in6_addr));
118 -      flowreq1.flr_label = 0;
119 -      flowreq1.flr_action = IPV6_FL_A_GET;
120 -      flowreq1.flr_share = IPV6_FL_S_EXCL;
121 -      flowreq1.flr_flags = IPV6_FL_F_CREATE;
122 -      flowreq1.flr_expires = 0;
123 -      flowreq1.flr_linger = 0;
124 -      flowreq1.__flr_pad = 0;
125 - 
126 - 
127 -      int optval, slenval;
128 -      ret = setsockopt( new_sd, SOL_IPV6, IPV6_FLOWLABEL_MGR, &flowreq1, flowreq_len1);
129 -      if (ret < 0)
130 -      »       perror("Failed to setsockopt IPV6_FL_A_GET\n");
131 -      else
132 -         printf("IPV6_FL_A_GET succeed, flr_linger: %d \n", flowreq1.flr_linger);
133 - 
134 - 
135 -      flowreq1.flr_action = IPV6_FL_A_PUT;
136 -      ret = setsockopt( new_sd, SOL_IPV6, IPV6_FLOWLABEL_MGR, &flowreq1, flowreq_len1);
137 -      if (ret < 0)
138 -         perror("Failed to setsockopt IPV6_FL_A_PUT\n");
139 -      else
140 -         printf("IPV6_FL_A_PUT succeed\n");
141 - 
142 -      flowreq1.flr_action = IPV6_FL_A_RENEW;
143 -      flowreq1.flr_share = IPV6_FL_S_NONE;
144 -      flowreq1.flr_linger = 2; 
145 -      ret = setsockopt( new_sd, SOL_IPV6, IPV6_FLOWLABEL_MGR, &flowreq1, flowreq_len1);
146 -      if (ret < 0)
147 -      »       perror("Failed to setsockopt IPV6_FL_A_RENEW\n");
148 -      else
149 -         printf("IPV6_FL_A_RENEW succeed\n");
150 - 
151 -      ret = getsockopt( new_sd, IPPROTO_IPV6, IPV6_TCLASS, &optval, &slenval );
152 -      if (ret <0)
153 -      {
154 -         perror("Failed to getsockopt\n");
155 -         return -1;
156 -      }
157 -      else
158 -         printf("getsockopt IPV6_TCLASS: %d \n", optval);
159 - 
160 -      }
161 -  
162 -   close (listenSock);
163 -   close (connectSock);
164 -   close (new_sd);
165 -  
166 -   printf ( "Exiting normally. \n");     
167 -   exit (0);
168 - 
169 - }
170 - 
 1 @@ -1,78 +0,0 @@
 2 - #!/bin/bash
 3 - # vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
 4 - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 5 - #
 6 - #   runtest.sh of /kernel/networking/
 7 - #   Description: /home/weichen/workingfolder/inet6_ioctl
 8 - #   Author: Wei Chen <weichen@redhat.com>
 9 - #
10 - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11 - #
12 - #   Copyright (c) 2014 Red Hat, Inc. 
13 - #
14 - #   This copyrighted material is made available to anyone wishing
15 - #   to use, modify, copy, or redistribute it subject to the terms
16 - #   and conditions of the GNU General Public License version 2.
17 - #
18 - #   This program is distributed in the hope that it will be
19 - #   useful, but WITHOUT ANY WARRANTY; without even the implied
20 - #   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
21 - #   PURPOSE. See the GNU General Public License for more details.
22 - #
23 - #   You should have received a copy of the GNU General Public
24 - #   License along with this program; if not, write to the Free
25 - #   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26 - #   Boston, MA 02110-1301, USA.
27 - #
28 - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29 - # Global parameters
30 - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31 - 
32 - # Include Beaker environment
33 - . /usr/share/beakerlib-libraries/kernel/Library/networking-common/include.sh
34 - 
35 - NIC_NUM=${NIC_NUM:-2}
36 - 
37 - reset_if()
38 - {
39 - 
40 -         iface=$1
41 - 
42 -         ip link set dev $iface down
43 -         ip addr flush dev $iface
44 -         ip link set dev $iface up
45 -         sleep 1
46 - }
47 - 
48 - 
49 - Cur_nic_iface=$(get_cur_iface)
50 - ###$(get_required_iface | awk '{ print $1 }')
51 - Sec_nic_iface=$(get_sec_iface)
52 - ###$(get_required_iface | awk '{ print $2 }')
53 - CLI_ADDR6_1="2012::11"
54 - 
55 - rlJournalStart
56 - 
57 -         rlPhaseStartSetup
58 -             rlRun "yum -y install libgcc.i686"
59 -             rlRun "yum -y install glibc-static.i686"
60 -             rlRun "yum -y install glibc-devel.i686"
61 -             rlRun "gcc -m32 -o ipv6_compat_sockopt ipv6_compat_sockopt.c -lpthread -lc"
62 -             Sec_nic_iface=$(get_sec_iface)
63 -             ###$(get_required_iface | awk '{ print $2 }')
64 -             rlRun "ip -6 addr flush dev $Sec_nic_iface"
65 -             reset_if $Sec_nic_iface
66 -             rlRun "ip addr add ${CLI_ADDR6_1}/64 dev $Sec_nic_iface"
67 -         rlPhaseEnd
68 - 
69 -         rlPhaseStartTest
70 -             rlRun "./ipv6_compat_sockopt" 0
71 -         rlPhaseEnd
72 - 
73 -         rlPhaseStartCleanup
74 - 
75 -         rlPhaseEnd
76 - 
77 -         rlJournalPrintText
78 - 
79 - rlJournalEnd
1 @@ -1,1 +0,0 @@
2 - param: [NIC_NUM=2], setup: [--nay-nic-num=2]
 1 @@ -1,82 +0,0 @@
 2 - # Copyright (c) 2014 Red Hat, Inc.  This copyrighted material
 3 - # is made available to anyone wishing to use, modify, copy, or
 4 - # redistribute it subject to the terms and conditions of the GNU General
 5 - # Public License v.2.
 6 - #
 7 - # This program is distributed in the hope that it will be useful, but WITHOUT ANY
 8 - # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 9 - # PARTICULAR PURPOSE. See the GNU General Public License for more details.
10 - #
11 - # You should have received a copy of the GNU General Public License
12 - # along with this program; if not, write to the Free Software
13 - # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 - #
15 - # Author: Wei Chen <weichen@redhat.com>
16 - 
17 - # The toplevel namespace within which the test lives.
18 - # FIXME: You will need to change this:
19 - TOPLEVEL_NAMESPACE=kernel
20 - 
21 - # The name of the package under test:
22 - # FIXME: you wil need to change this:
23 - PACKAGE_NAME=
24 - 
25 - # The path of the test below the package:
26 - # FIXME: you wil need to change this:
27 - RELATIVE_PATH=networking/ipv6/socket/sock_raw/hdrinc
28 - 
29 - # Version of the Test. Used with make tag.
30 - export TESTVERSION=0.1
31 - 
32 - # The combined namespace of the test.
33 - export TEST=/$(TOPLEVEL_NAMESPACE)/$(RELATIVE_PATH)
34 - 
35 - 
36 - # A phony target is one that is not really the name of a file.
37 - # It is just a name for some commands to be executed when you
38 - # make an explicit request. There are two reasons to use a
39 - # phony target: to avoid a conflict with a file of the same
40 - # name, and to improve performance.
41 - .PHONY: all install download clean
42 - 
43 - # executables to be built should be added here, they will be generated on the system under test.
44 - BUILT_FILES=
45 - 
46 - # data files, .c files, scripts anything needed to either compile the test and/or run it.
47 - FILES=$(METADATA) runtest.sh Makefile PURPOSE ipv6_hdrinc.c
48 - 
49 - run: $(FILES) build
50 - »       ./runtest.sh
51 - 
52 - build: $(BUILT_FILES)
53 - »       chmod a+x ./runtest.sh
54 - 
55 - clean:
56 - »       rm -f *~ *.rpm $(BUILT_FILES)
57 - 
58 - # You may need to add other targets e.g. to build executables from source code
59 - # Add them here:
60 - 
61 - 
62 - # Include Common Makefile
63 - include /usr/share/rhts/lib/rhts-make.include
64 - 
65 - # Generate the testinfo.desc here:
66 - $(METADATA): Makefile
67 - »       @touch $(METADATA)
68 - # Change to the test owner's name
69 - »       @echo "Owner:        Wei Chen <weichen@redhat.com>" > $(METADATA)
70 - »       @echo "Name:         $(TEST)" >> $(METADATA)
71 - »       @echo "Path:         $(TEST_DIR)"»       >> $(METADATA)
72 - »       @echo "License:      GPLv2" >> $(METADATA)
73 - »       @echo "TestVersion:  $(TESTVERSION)"»       >> $(METADATA)
74 - »       @echo "Description:  rawv6_send_hdrinc() is called if IP_HDRINCL is set to enabled">> $(METADATA)
75 - »       @echo "TestTime:     10m" >> $(METADATA)
76 - »       @echo "Type:         Regression" >> $(METADATA)
77 - »       @echo "RunFor:       $(PACKAGE_NAME)" >> $(METADATA)
78 - # add any other packages for which your test ought to run here
79 - »       @echo "Requires:     $(PACKAGE_NAME)" >> $(METADATA)
80 - # add any other requirements for the script to run here
81 - 
82 - # You may need other fields here; see the documentation
83 - »       rhts-lint $(METADATA)
1 @@ -1,7 +0,0 @@
2 - In standard sockets, the payload to be transmitted is encapsulated according to the chosen transport layer protocol (e.g. TCP, UDP).
3 - In contrast, raw sockets usually receive raw packets including the header. When transmitting packets, the automatic addition of a header
4 - may be a configurable option of the socket.
5 - 
6 - The system calls sendmsg() that are used to transmit a message to another socket. Next rawv6_sendmgs() and rawv6_send_hdrinc() are called
7 - to transmit the message from sending raw socket. If IPPROTO_RAW or IP_HDRINCL option is specified in socket() or setsockopt(), user needs 
8 - to construct his/her own IP and uppder layer header structures.
  1 @@ -1,179 +0,0 @@
  2 - #include <stdio.h>
  3 - #include <unistd.h>
  4 - #include <fcntl.h>
  5 - #include <stdlib.h>
  6 - #include <string.h>
  7 - #include <sys/types.h>
  8 - #include <sys/socket.h>
  9 - #include <sys/ioctl.h>
 10 - #include <sys/syscall.h>
 11 - #include <netinet/in.h>
 12 - #include <arpa/inet.h>
 13 - #include <errno.h>
 14 - #include <netinet/in.h>
 15 - #include <netinet/sctp.h>
 16 - #include <sys/uio.h>
 17 - #include <linux/in6.h>
 18 - #include <linux/udp.h>
 19 - #include <linux/socket.h>
 20 - #include <linux/ipv6.h>
 21 - #include <netdb.h>
 22 - 
 23 - #define MY_PORT_NUM 51111 /* This can be changed to suit the need and should be same in server and client */
 24 - #define TRUE 1
 25 - #define FALSE 0
 26 - #define __BIG_ENDIAN_BITFIELD 1
 27 - 
 28 - struct pseudo_header
 29 - {
 30 -     u_int32_t source_address;
 31 -     u_int32_t dest_address;
 32 -     u_int8_t placeholder;
 33 -     u_int8_t protocol;
 34 -     u_int16_t udp_length;
 35 - };
 36 -  
 37 - /*
 38 -  *     Generic checksum calculation function
 39 -  *     */
 40 - unsigned short csum(unsigned short *ptr,int nbytes) 
 41 - {
 42 -     register long sum;
 43 -     unsigned short oddbyte;
 44 -     register short answer;
 45 -  
 46 -     sum=0;
 47 -     while(nbytes>1) {
 48 -         sum+=*ptr++;
 49 -         nbytes-=2;
 50 -     }
 51 -     if(nbytes==1) {
 52 -         oddbyte=0;
 53 -         *((u_char*)&oddbyte)=*(u_char*)ptr;
 54 -         sum+=oddbyte;
 55 -     }
 56 -  
 57 -     sum = (sum>>16)+(sum & 0xffff);
 58 -     sum = sum + (sum>>16);
 59 -     answer=(short)~sum;
 60 -      
 61 -     return(answer);
 62 - }
 63 - 
 64 - int main (int argc, char *argv[] )
 65 - {
 66 - 
 67 -   int rawSock, ret, flags, rc, on;
 68 -   struct sockaddr_in6 servaddrs;
 69 -   struct sockaddr_in6 servaddrc;
 70 -   bzero( (void *)&servaddrs, sizeof(servaddrs) );
 71 -   bzero( (void *)&servaddrc, sizeof(servaddrc) );
 72 -   flags = 0;
 73 -   on = 1;
 74 -   struct msghdr msg;
 75 -   struct iovec iov[1];
 76 -   bzero( (void *)iov, sizeof(iov[1]) );
 77 -   bzero( (void *)&msg, sizeof(msg) );
 78 -   char  * pseudogram = NULL;
 79 -   struct pseudo_header psh;
 80 -   bzero( &psh, sizeof(psh) );  
 81 - 
 82 -   char * datagram;
 83 -   datagram = malloc(4096);
 84 -   memset(datagram, 0, 4096);
 85 -   struct ipv6hdr * ipv6_hdr_str = (struct ipv6hdr * ) datagram;  
 86 -   struct udphdr * udp_hdr_str = (struct udphdr * ) ( datagram + sizeof (struct ipv6hdr) );
 87 -   char * data = (char *) ( datagram + sizeof(struct ipv6hdr) + sizeof(struct udphdr) );
 88 -   strcpy( data, "Zara ali a DPS student in class 10th.\0");
 89 - 
 90 -   int psize = sizeof(struct pseudo_header) + sizeof(struct udphdr) + strlen(data);
 91 -   pseudogram = malloc(psize);
 92 - 
 93 -   rawSock = socket( AF_INET6, SOCK_RAW, IPPROTO_RAW );
 94 -   if (rawSock < 0)
 95 -   {
 96 -         perror("Failed to get raw socket\n");
 97 -         return -1;
 98 -   }
 99 -   else
100 -   {
101 -   »       printf("New raw socket: %d .\n", rawSock);
102 -   }
103 - 
104 -   servaddrs.sin6_family = AF_INET6;
105 -   inet_pton(AF_INET6, "2012:11", &(servaddrs.sin6_addr));
106 -   servaddrs.sin6_port = htons(0);
107 -  
108 -   servaddrc.sin6_family = AF_INET6;
109 -   servaddrc.sin6_port = htons(0);
110 -   servaddrc.sin6_flowinfo = 0;
111 -   servaddrc.sin6_scope_id = 1;
112 -   inet_pton(AF_INET6, "2012::78", &(servaddrc.sin6_addr));
113 -  
114 -   /* Fill out UDP header */
115 -   udp_hdr_str->source = htons(40000);
116 -   udp_hdr_str->dest = htons(40000);
117 -   udp_hdr_str->len = htons(8 + strlen(data));
118 -   udp_hdr_str->check = 0;  
119 -  
120 -  
121 -   /* Fill out IPv6 header */
122 -   ipv6_hdr_str->version = 6;
123 -   ipv6_hdr_str->priority = 1;
124 -   ipv6_hdr_str->flow_lbl[0] = 0;
125 -   ipv6_hdr_str->flow_lbl[1] = 0;
126 -   ipv6_hdr_str->flow_lbl[2] = 0;
127 -   ipv6_hdr_str->payload_len = htons(8 + strlen(data));
128 -   ipv6_hdr_str->nexthdr = IPPROTO_UDP;
129 -   ipv6_hdr_str->hop_limit = 64;
130 -   inet_pton(AF_INET6, "2012::78", &(ipv6_hdr_str->daddr)); // IPv6 
131 -   inet_pton(AF_INET6, "2012::11", &(ipv6_hdr_str->saddr)); // IPv6
132 -  
133 -   //Now the UDP checksum using the pseudo headepsh.source_address = inet_addr( source_ip );
134 -   psh.source_address = inet_addr("2012::11");
135 -   psh.placeholder = 0;
136 -   psh.protocol = IPPROTO_UDP;
137 -   psh.udp_length = htons(sizeof(struct udphdr) + strlen(data) );       
138 -  
139 -   memcpy(pseudogram , (char*) &psh , sizeof (struct pseudo_header));
140 -   memcpy(pseudogram + sizeof(struct pseudo_header) , udp_hdr_str , sizeof(struct udphdr) + strlen(data));
141 -   udp_hdr_str->check = csum( (unsigned short*) pseudogram , psize);
142 -  
143 -   msg.msg_name = (struct sockaddr_in6 *)&servaddrc;
144 -   msg.msg_namelen = sizeof(struct sockaddr_in6);
145 -   iov[0].iov_base = datagram;
146 -   iov[0].iov_len = sizeof(struct ipv6hdr) + sizeof(struct udphdr) + strlen(data);
147 -   msg.msg_iov = iov;
148 -   msg.msg_iovlen = 1;
149 -   msg.msg_control = NULL;
150 -   msg.msg_controllen = 0;
151 -   msg.msg_flags = 0;
152 - 
153 -   ret = setsockopt ( rawSock, IPPROTO_IPV6, IP_HDRINCL, &on, sizeof(on));
154 -   if (ret < 0)
155 -   {
156 -   »       perror("Failed to setsockopt\n");
157 -         return -1;
158 -   }  
159 - 
160 -   rc = sendmsg( rawSock, &msg, flags );
161 -   if (rc < 0)
162 -   {
163 -       
164 -   »       perror("send() failed");
165 -         close ( rawSock );
166 -         return -1;
167 -   }
168 -   else
169 -   {
170 -         printf("send OK.\n"); 
171 -   }
172 -   
173 -  
174 -   free ( pseudogram );
175 - 
176 -   close (rawSock); 
177 -   printf ( "Exiting normally. \n");     
178 -   return 0;
179 -  
180 - }
 1 @@ -1,75 +0,0 @@
 2 - #!/bin/bash
 3 - # vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
 4 - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 5 - #
 6 - #   runtest.sh of /kernel/networking/
 7 - #   Description: /home/weichen/workingfolder/inet6_ioctl
 8 - #   Author: Wei Chen <weichen@redhat.com>
 9 - #
10 - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11 - #
12 - #   Copyright (c) 2014 Red Hat, Inc. 
13 - #
14 - #   This copyrighted material is made available to anyone wishing
15 - #   to use, modify, copy, or redistribute it subject to the terms
16 - #   and conditions of the GNU General Public License version 2.
17 - #
18 - #   This program is distributed in the hope that it will be
19 - #   useful, but WITHOUT ANY WARRANTY; without even the implied
20 - #   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
21 - #   PURPOSE. See the GNU General Public License for more details.
22 - #
23 - #   You should have received a copy of the GNU General Public
24 - #   License along with this program; if not, write to the Free
25 - #   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26 - #   Boston, MA 02110-1301, USA.
27 - #
28 - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29 - # Global parameters
30 - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31 - 
32 - # Include Beaker environment
33 - . /usr/share/beakerlib-libraries/kernel/Library/networking-common/include.sh
34 - 
35 - NIC_NUM=${NIC_NUM:-2}
36 - 
37 - reset_if()
38 - {
39 - 
40 -         iface=$1
41 - 
42 -         ip link set dev $iface down
43 -         ip addr flush dev $iface
44 -         ip link set dev $iface up
45 -         sleep 1
46 - }
47 - 
48 - 
49 - ###Cur_nic_iface=$(get_required_iface | awk '{ print $1 }')
50 - Sec_nic_iface=$(get_sec_iface)
51 - ###$(get_required_iface | awk '{ print $2 }')
52 - CLI_ADDR6_1="2012::11"
53 - 
54 - rlJournalStart
55 - 
56 -         rlPhaseStartSetup
57 -             rlRun "yum -y install lksctp-tools*"
58 -             rlRun "gcc -o ipv6_hdrinc ipv6_hdrinc.c -lpthread -lc"
59 -             Sec_nic_iface=$(get_sec_iface)
60 -             ###$(get_required_iface | awk '{ print $2 }')
61 -             rlRun "ip -6 addr flush dev $Sec_nic_iface"
62 -             reset_if $Sec_nic_iface
63 -             rlRun "ip addr add ${CLI_ADDR6_1}/64 dev $Sec_nic_iface"
64 -         rlPhaseEnd
65 - 
66 -         rlPhaseStartTest
67 -             rlRun "./ipv6_hdrinc"
68 -         rlPhaseEnd
69 - 
70 -         rlPhaseStartCleanup
71 -             pkill "./ipv6_hdrinc";
72 -         rlPhaseEnd
73 - 
74 -         rlJournalPrintText
75 - 
76 - rlJournalEnd
1 @@ -1,1 +0,0 @@
2 - param: [NIC_NUM=2], setup: [--nay-nic-num=2]
 1 @@ -1,82 +0,0 @@
 2 - # Copyright (c) 2014 Red Hat, Inc.  This copyrighted material
 3 - # is made available to anyone wishing to use, modify, copy, or
 4 - # redistribute it subject to the terms and conditions of the GNU General
 5 - # Public License v.2.
 6 - #
 7 - # This program is distributed in the hope that it will be useful, but WITHOUT ANY
 8 - # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 9 - # PARTICULAR PURPOSE. See the GNU General Public License for more details.
10 - #
11 - # You should have received a copy of the GNU General Public License
12 - # along with this program; if not, write to the Free Software
13 - # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 - #
15 - # Author: Wei Chen <weichen@redhat.com>
16 - 
17 - # The toplevel namespace within which the test lives.
18 - # FIXME: You will need to change this:
19 - TOPLEVEL_NAMESPACE=kernel
20 - 
21 - # The name of the package under test:
22 - # FIXME: you wil need to change this:
23 - PACKAGE_NAME=
24 - 
25 - # The path of the test below the package:
26 - # FIXME: you wil need to change this:
27 - RELATIVE_PATH=networking/ipv6/socket/sock_raw/localerr
28 - 
29 - # Version of the Test. Used with make tag.
30 - export TESTVERSION=0.1
31 - 
32 - # The combined namespace of the test.
33 - export TEST=/$(TOPLEVEL_NAMESPACE)/$(RELATIVE_PATH)
34 - 
35 - 
36 - # A phony target is one that is not really the name of a file.
37 - # It is just a name for some commands to be executed when you
38 - # make an explicit request. There are two reasons to use a
39 - # phony target: to avoid a conflict with a file of the same
40 - # name, and to improve performance.
41 - .PHONY: all install download clean
42 - 
43 - # executables to be built should be added here, they will be generated on the system under test.
44 - BUILT_FILES=
45 - 
46 - # data files, .c files, scripts anything needed to either compile the test and/or run it.
47 - FILES=$(METADATA) runtest.sh Makefile PURPOSE ipv6_localerr.c
48 - 
49 - run: $(FILES) build
50 - »       ./runtest.sh
51 - 
52 - build: $(BUILT_FILES)
53 - »       chmod a+x ./runtest.sh
54 - 
55 - clean:
56 - »       rm -f *~ *.rpm $(BUILT_FILES)
57 - 
58 - # You may need to add other targets e.g. to build executables from source code
59 - # Add them here:
60 - 
61 - 
62 - # Include Common Makefile
63 - include /usr/share/rhts/lib/rhts-make.include
64 - 
65 - # Generate the testinfo.desc here:
66 - $(METADATA): Makefile
67 - »       @touch $(METADATA)
68 - # Change to the test owner's name
69 - »       @echo "Owner:        Wei Chen <weichen@redhat.com>" > $(METADATA)
70 - »       @echo "Name:         $(TEST)" >> $(METADATA)
71 - »       @echo "Path:         $(TEST_DIR)"»       >> $(METADATA)
72 - »       @echo "License:      GPLv2" >> $(METADATA)
73 - »       @echo "TestVersion:  $(TESTVERSION)"»       >> $(METADATA)
74 - »       @echo "Description:  ipv6_local_error() message too long">> $(METADATA)
75 - »       @echo "TestTime:     10m" >> $(METADATA)
76 - »       @echo "Type:         Regression" >> $(METADATA)
77 - »       @echo "RunFor:       $(PACKAGE_NAME)" >> $(METADATA)
78 - # add any other packages for which your test ought to run here
79 - »       @echo "Requires:     $(PACKAGE_NAME)" >> $(METADATA)
80 - # add any other requirements for the script to run here
81 - 
82 - # You may need other fields here; see the documentation
83 - »       rhts-lint $(METADATA)
1 @@ -1,8 +0,0 @@
2 - In standard sockets, the payload to be transmitted is encapsulated according to the chosen transport layer protocol (e.g. TCP, UDP).
3 - In contrast, raw sockets usually receive raw packets including the header. When transmitting packets, the automatic addition of a header
4 - may be a configurable option of the socket.
5 - 
6 - The system calls sendmsg() that are used to transmit a message to another socket. Next rawv6_sendmgs() and rawv6_send_hdrinc() are called
7 - to transmit the message from sending raw socket. If IPPROTO_RAW or IP_HDRINCL option is specified in socket() or setsockopt(), user needs 
8 - to construct his/her own IP and uppder layer header structures. If message is too long, erro message EMSGSIZE is returned and ,at the same
9 - time, ipv6_local_error is called to handle aftermath.
  1 @@ -1,184 +0,0 @@
  2 - #include <stdio.h>
  3 - #include <unistd.h>
  4 - #include <fcntl.h>
  5 - #include <stdlib.h>
  6 - #include <string.h>
  7 - #include <sys/types.h>
  8 - #include <sys/socket.h>
  9 - #include <sys/ioctl.h>
 10 - #include <sys/syscall.h>
 11 - #include <netinet/in.h>
 12 - #include <arpa/inet.h>
 13 - #include <errno.h>
 14 - #include <netinet/in.h>
 15 - #include <sys/uio.h>
 16 - #include <linux/in6.h>
 17 - #include <linux/udp.h>
 18 - #include <linux/socket.h>
 19 - #include <linux/ipv6.h>
 20 - #include <netdb.h>
 21 - 
 22 - #define MY_PORT_NUM 51111 /* This can be changed to suit the need and should be same in server and client */
 23 - #define TRUE 1
 24 - #define FALSE 0
 25 - 
 26 - struct pseudo_header
 27 - {
 28 -     u_int32_t source_address;
 29 -     u_int32_t dest_address;
 30 -     u_int8_t placeholder;
 31 -     u_int8_t protocol;
 32 -     u_int16_t udp_length;
 33 - };
 34 -  
 35 - /*
 36 -  *     Generic checksum calculation function
 37 -  *     */
 38 - unsigned short csum(unsigned short *ptr,int nbytes) 
 39 - {
 40 -     register long sum;
 41 -     unsigned short oddbyte;
 42 -     register short answer;
 43 -  
 44 -     sum=0;
 45 -     while(nbytes>1) {
 46 -         sum+=*ptr++;
 47 -         nbytes-=2;
 48 -     }
 49 -     if(nbytes==1) {
 50 -         oddbyte=0;
 51 -         *((u_char*)&oddbyte)=*(u_char*)ptr;
 52 -         sum+=oddbyte;
 53 -     }
 54 -  
 55 -     sum = (sum>>16)+(sum & 0xffff);
 56 -     sum = sum + (sum>>16);
 57 -     answer=(short)~sum;
 58 -      
 59 -     return(answer);
 60 - }
 61 - 
 62 - int main (int argc, char *argv[] )
 63 - {
 64 - 
 65 -   int rawSock, ret, flags, rc, on;
 66 -   struct sockaddr_in6 servaddrs;
 67 -   struct sockaddr_in6 servaddrc;
 68 -   bzero( (void *)&servaddrs, sizeof(servaddrs) );
 69 -   bzero( (void *)&servaddrc, sizeof(servaddrc) );
 70 -   flags = 0;
 71 -   on = 1;
 72 -   struct msghdr msg;
 73 -   struct iovec iov[1];
 74 -   bzero( (void *)iov, sizeof(iov[1]) );
 75 -   bzero( (void *)&msg, sizeof(msg) );
 76 -   char  * pseudogram = NULL;
 77 -   struct pseudo_header psh;
 78 -   bzero( &psh, sizeof(psh) );  
 79 - 
 80 -   char * datagram;
 81 -   datagram = malloc(4096);
 82 -   memset(datagram, 0, 4096);
 83 -   struct ipv6hdr * ipv6_hdr_str = (struct ipv6hdr * ) datagram;  
 84 -   struct udphdr * udp_hdr_str = (struct udphdr * ) ( datagram + sizeof (struct ipv6hdr) );
 85 -   char * data = (char *) ( datagram + sizeof(struct ipv6hdr) + sizeof(struct udphdr) );
 86 -   strcpy( data, "Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS student in class 10th.Zara ali a DPS stude.\0");
 87 - 
 88 -   int psize = sizeof(struct pseudo_header) + sizeof(struct udphdr) + strlen(data);
 89 -   pseudogram = malloc(psize);
 90 - 
 91 -   rawSock = socket( AF_INET6, SOCK_RAW, IPPROTO_RAW );
 92 -   if (rawSock < 0)
 93 -   {
 94 -         perror("Failed to get raw socket\n");
 95 -         return -1;
 96 -   }
 97 -   else
 98 -   {
 99 -   »       printf("New raw socket: %d .\n", rawSock);
100 -   }
101 - 
102 -   servaddrs.sin6_family = AF_INET6;
103 -   inet_pton(AF_INET6, "2012:11", &(servaddrs.sin6_addr));
104 -   servaddrs.sin6_port = htons(0);
105 -  
106 -   servaddrc.sin6_family = AF_INET6;
107 -   servaddrc.sin6_port = htons(0);
108 -   servaddrc.sin6_flowinfo = 0;
109 -   servaddrc.sin6_scope_id = 1;
110 -   inet_pton(AF_INET6, "2012::78", &(servaddrc.sin6_addr));
111 -  
112 -   /* Fill out UDP header */
113 -   udp_hdr_str->source = htons(40000);
114 -   udp_hdr_str->dest = htons(40000);
115 -   udp_hdr_str->len = htons(8 + strlen(data));
116 -   udp_hdr_str->check = 0;  
117 -  
118 -  
119 -   /* Fill out IPv6 header */
120 -   ipv6_hdr_str->version = 6;
121 -   ipv6_hdr_str->priority = 1;
122 -   ipv6_hdr_str->flow_lbl[0] = 0;
123 -   ipv6_hdr_str->flow_lbl[1] = 0;
124 -   ipv6_hdr_str->flow_lbl[2] = 0;
125 -   ipv6_hdr_str->payload_len = htons(8 + strlen(data));
126 -   ipv6_hdr_str->nexthdr = IPPROTO_UDP;
127 -   ipv6_hdr_str->hop_limit = 64;
128 -   inet_pton(AF_INET6, "2012::78", &(ipv6_hdr_str->daddr)); // IPv6 
129 -   inet_pton(AF_INET6, "2012::11", &(ipv6_hdr_str->saddr)); // IPv6
130 -  
131 -   //Now the UDP checksum using the pseudo headepsh.source_address = inet_addr( source_ip );
132 -   psh.source_address = inet_addr("2012::11");
133 -   psh.placeholder = 0;
134 -   psh.protocol = IPPROTO_UDP;
135 -   psh.udp_length = htons(sizeof(struct udphdr) + strlen(data) );       
136 -  
137 -   memcpy(pseudogram , (char*) &psh , sizeof (struct pseudo_header));
138 -   memcpy(pseudogram + sizeof(struct pseudo_header) , udp_hdr_str , sizeof(struct udphdr) + strlen(data));
139 -   udp_hdr_str->check = csum( (unsigned short*) pseudogram , psize);
140 -  
141 -   msg.msg_name = (struct sockaddr_in6 *)&servaddrc;
142 -   msg.msg_namelen = sizeof(struct sockaddr_in6);
143 -   iov[0].iov_base = datagram;
144 -   iov[0].iov_len = sizeof(struct ipv6hdr) + sizeof(struct udphdr) + strlen(data);
145 -   msg.msg_iov = iov;
146 -   msg.msg_iovlen = 1;
147 -   msg.msg_control = NULL;
148 -   msg.msg_controllen = 0;
149 -   msg.msg_flags = 0;
150 - 
151 -   ret = setsockopt ( rawSock, IPPROTO_IPV6, IP_HDRINCL, &on, sizeof(on));
152 -   if (ret < 0)
153 -   {
154 -   »       perror("Failed to setsockopt\n");
155 -         return -1;
156 -   } 
157 - 
158 -   sleep (10);
159 - 
160 -   rc = sendmsg( rawSock, &msg, flags );
161 -   if (rc < 0)
162 -   {
163 - »       int err = errno;
164 -   »       perror("send() failed");
165 -         if ( err != EMSGSIZE )
166 -         {
167 -                 close ( rawSock );
168 -                 free ( pseudogram );
169 - »       »       free ( datagram );
170 - »       »       return -1;
171 -         }
172 -   }
173 -   else
174 -   {
175 -         printf("send OK.\n"); 
176 -   }
177 -   
178 - 
179 -   close ( rawSock ); 
180 -   free ( pseudogram );
181 -   free ( datagram );
182 -   printf ( "Exiting normally. \n");     
183 -   return 0;
184 -  
185 - }
 1 @@ -1,76 +0,0 @@
 2 - #!/bin/bash
 3 - # vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
 4 - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 5 - #
 6 - #   runtest.sh of /kernel/networking/
 7 - #   Description: /home/weichen/workingfolder/inet6_ioctl
 8 - #   Author: Wei Chen <weichen@redhat.com>
 9 - #
10 - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11 - #
12 - #   Copyright (c) 2014 Red Hat, Inc. 
13 - #
14 - #   This copyrighted material is made available to anyone wishing
15 - #   to use, modify, copy, or redistribute it subject to the terms
16 - #   and conditions of the GNU General Public License version 2.
17 - #
18 - #   This program is distributed in the hope that it will be
19 - #   useful, but WITHOUT ANY WARRANTY; without even the implied
20 - #   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
21 - #   PURPOSE. See the GNU General Public License for more details.
22 - #
23 - #   You should have received a copy of the GNU General Public
24 - #   License along with this program; if not, write to the Free
25 - #   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26 - #   Boston, MA 02110-1301, USA.
27 - #
28 - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29 - # Global parameters
30 - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31 - 
32 - # Include Beaker environment
33 - . /usr/share/beakerlib-libraries/kernel/Library/networking-common/include.sh
34 - 
35 - disable_avc_check
36 - 
37 - NIC_NUM=${NIC_NUM:-2}
38 - 
39 - reset_if()
40 - {
41 - 
42 -         iface=$1
43 - 
44 -         ip link set dev $iface down
45 -         ip addr flush dev $iface
46 -         ip link set dev $iface up
47 -         sleep 1
48 - }
49 - 
50 - 
51 - Cur_nic_iface=$(get_cur_iface)
52 - ###$(get_required_iface | awk '{ print $1 }')
53 - Sec_nic_iface=$(get_sec_iface)
54 - ###$(get_required_iface | awk '{ print $2 }')
55 - CLI_ADDR6_1="2012::11"
56 - 
57 - rlJournalStart
58 - 
59 -         rlPhaseStartSetup
60 -             rlRun "gcc -o ipv6_localerr ipv6_localerr.c"
61 -             Sec_nic_iface=$(get_sec_iface)
62 -             ###$(get_required_iface | awk '{ print $2 }')
63 -             rlRun "ip -6 addr flush dev $Sec_nic_iface"
64 -             reset_if $Sec_nic_iface
65 -             rlRun "ip addr add ${CLI_ADDR6_1}/64 dev $Sec_nic_iface"
66 -         rlPhaseEnd
67 - 
68 -         rlPhaseStartTest
69 -             rlRun "./ipv6_localerr"
70 -         rlPhaseEnd
71 - 
72 -         rlPhaseStartCleanup
73 -             pkill "./ipv6_localerr";
74 -         rlPhaseEnd
75 - 
76 - 
77 - rlJournalEnd
1 @@ -1,1 +0,0 @@
2 - param: [NIC_NUM=2], setup: [--nay-nic-num=2]