Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: src/scripts/mod_for_test_scripts/100setupTestingInterface

Issue 2731001: s/connman/flimflam/ to match other changes (Closed) Base URL: ssh://gitrw.chromium.org/chromiumos
Patch Set: Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 2
3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 echo "Configuring for backchannel network device" 7 echo "Configuring for backchannel network device"
8 8
9 testif=eth_test 9 testif=eth_test
10 10
11 # Prevent connman from taking control of the backchannel network device. 11 # Prevent flimflam from taking control of the backchannel network device.
12 ORIG_CONF=${ROOT_FS_DIR}/etc/init/connman.conf 12 ORIG_CONF=${ROOT_FS_DIR}/etc/init/flimflam.conf
13 TEMP_CONF=${ORIG_CONF}.tmp 13 TEMP_CONF=${ORIG_CONF}.tmp
14 sed "s/connmand -W/connmand -I ${testif} -W/" ${ORIG_CONF} > ${TEMP_CONF} 14 sed "s/flimflamd -W/flimflamd -I ${testif} -W/" ${ORIG_CONF} > ${TEMP_CONF}
15 mv -f ${TEMP_CONF} ${ORIG_CONF} 15 mv -f ${TEMP_CONF} ${ORIG_CONF}
16 16
17 # Arrange to run dhclient on the backchannel device but without 17 # Arrange to run dhclient on the backchannel device but without
18 # installing the default route, and stashing said route away for later 18 # installing the default route, and stashing said route away for later
19 # installation as a host route. 19 # installation as a host route.
20 cat > ${ROOT_FS_DIR}/etc/udev/rules.d/50-backchannel-network.rules <<EOF 20 cat > ${ROOT_FS_DIR}/etc/udev/rules.d/50-backchannel-network.rules <<EOF
21 KERNEL=="eth*", SUBSYSTEMS=="usb", ACTION=="add", RUN+="/sbin/backchannel-setup %k" 21 KERNEL=="eth*", SUBSYSTEMS=="usb", ACTION=="add", RUN+="/sbin/backchannel-setup %k"
22 KERNEL=="${testif}", SUBSYSTEMS=="usb", ACTION=="remove", RUN+="kill \$(cat /var /run/dhclient-%k.pid)" 22 KERNEL=="${testif}", SUBSYSTEMS=="usb", ACTION=="remove", RUN+="kill \$(cat /var /run/dhclient-%k.pid)"
23 EOF 23 EOF
24 24
25 cat > ${ROOT_FS_DIR}/sbin/backchannel-setup <<EOF 25 cat > ${ROOT_FS_DIR}/sbin/backchannel-setup <<EOF
26 #!/bin/sh 26 #!/bin/sh
27 27
28 testif=${testif} 28 testif=${testif}
29 29
30 if [ ! -f /mnt/stateful_partition/etc/enable_backchannel_network ]; then 30 if [ ! -f /mnt/stateful_partition/etc/enable_backchannel_network ]; then
31 # This mechanism has to be explicitly enabled on the device. 31 # This mechanism has to be explicitly enabled on the device.
32 exit 32 exit
33 fi 33 fi
34 34
35 if [ -f /var/run/dhclient-\${testif}.pid ]; then 35 if [ -f /var/run/dhclient-\${testif}.pid ]; then
36 # Something else is already going on - perhaps a second 36 # Something else is already going on - perhaps a second
37 # USB Ethernet device has been inserted. Let's not mess with it. 37 # USB Ethernet device has been inserted. Let's not mess with it.
38 exit 38 exit
39 fi 39 fi
40 40
41 if [ "\$1" != "\${testif}" ]; then 41 if [ "\$1" != "\${testif}" ]; then
42 initctl stop connman 42 initctl stop flimflam
43 # \$1 is the current name of the backchannel device. Swap it with testif. 43 # \$1 is the current name of the backchannel device. Swap it with testif.
44 if ifconfig \${testif} > /dev/null 2>&1; then 44 if ifconfig \${testif} > /dev/null 2>&1; then
45 orig_mac=\$(ifconfig \${testif} | awk '/HWaddr/ {print \$5}') 45 orig_mac=\$(ifconfig \${testif} | awk '/HWaddr/ {print \$5}')
46 ifconfig \${testif} down # must be down for nameif to work 46 ifconfig \${testif} down # must be down for nameif to work
47 nameif eth_tmp \${orig_mac} 47 nameif eth_tmp \${orig_mac}
48 fi 48 fi
49 bdev_mac=\$(ifconfig \$1 | awk '/HWaddr/ {print \$5}') 49 bdev_mac=\$(ifconfig \$1 | awk '/HWaddr/ {print \$5}')
50 ifconfig \$1 down # must be down for nameif to work 50 ifconfig \$1 down # must be down for nameif to work
51 nameif \${testif} \${bdev_mac} 51 nameif \${testif} \${bdev_mac}
52 if [ -n "\${orig_mac}" ]; then 52 if [ -n "\${orig_mac}" ]; then
53 nameif \$1 \${orig_mac} 53 nameif \$1 \${orig_mac}
54 fi 54 fi
55 initctl start connman 55 initctl start flimflam
56 fi 56 fi
57 57
58 # Bring up the backchannel interface 58 # Bring up the backchannel interface
59 dhclient -q -pf /var/run/dhclient-\${testif}.pid \\ 59 dhclient -q -pf /var/run/dhclient-\${testif}.pid \\
60 -lf /var/run/dhclient-\${testif}.leases \\ 60 -lf /var/run/dhclient-\${testif}.leases \\
61 -cf /etc/dhclient-backchannel.conf \\ 61 -cf /etc/dhclient-backchannel.conf \\
62 -sf /sbin/dhclient-backchannel-script \\ 62 -sf /sbin/dhclient-backchannel-script \\
63 \${testif} 63 \${testif}
64 EOF 64 EOF
65 65
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 EXPIRE|FAIL|RELEASE|STOP) 123 EXPIRE|FAIL|RELEASE|STOP)
124 if [ -n "\$old_ip_address" ]; then 124 if [ -n "\$old_ip_address" ]; then
125 # Shut down interface, which will delete routes and clear arp cache. 125 # Shut down interface, which will delete routes and clear arp cache.
126 ifconfig \$interface inet 0 126 ifconfig \$interface inet 0
127 fi 127 fi
128 ;; 128 ;;
129 esac 129 esac
130 EOF 130 EOF
131 131
132 chmod +x ${ROOT_FS_DIR}/sbin/dhclient-backchannel-script 132 chmod +x ${ROOT_FS_DIR}/sbin/dhclient-backchannel-script
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698