diff options
-rw-r--r-- | recipes-connectivity/dhcp/dhcp_%.bbappend | 1 | ||||
-rw-r--r-- | recipes-connectivity/dhcp/dhcp_virtualization.inc | 16 | ||||
-rw-r--r-- | recipes-connectivity/dhcp/files/dhclient-exit-hooks | 95 |
3 files changed, 0 insertions, 112 deletions
diff --git a/recipes-connectivity/dhcp/dhcp_%.bbappend b/recipes-connectivity/dhcp/dhcp_%.bbappend deleted file mode 100644 index 617cacc..0000000 --- a/recipes-connectivity/dhcp/dhcp_%.bbappend +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | require ${@bb.utils.contains('DISTRO_FEATURES', 'virtualization', '${BPN}_virtualization.inc', '', d)} | ||
diff --git a/recipes-connectivity/dhcp/dhcp_virtualization.inc b/recipes-connectivity/dhcp/dhcp_virtualization.inc deleted file mode 100644 index 7466056..0000000 --- a/recipes-connectivity/dhcp/dhcp_virtualization.inc +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | FILESEXTRAPATHS_prepend := "${THISDIR}/files:" | ||
2 | |||
3 | SRC_URI += "file://dhclient-exit-hooks \ | ||
4 | " | ||
5 | |||
6 | do_install_append () { | ||
7 | install -m 0644 ${WORKDIR}/dhclient-exit-hooks ${D}${sysconfdir}/dhcp/dhclient-exit-hooks | ||
8 | sed 's%/etc/dhclient-exit-hooks%/etc/dhcp/dhclient-exit-hooks%g' -i ${D}${base_sbindir}/dhclient-script | ||
9 | |||
10 | sed 's%request .*%\noption classless-static-routes code 121 = array of unsigned integer 8;\n\n&%g' -i ${D}${sysconfdir}/dhcp/dhclient.conf | ||
11 | sed 's%netbios-name-servers,.*netbios-scope;%netbios-name-servers, netbios-scope, classless-static-routes;\n%g' -i ${D}${sysconfdir}/dhcp/dhclient.conf | ||
12 | |||
13 | } | ||
14 | |||
15 | FILES_${PN}-client += "${sysconfdir}/dhcp/dhclient-exit-hooks \ | ||
16 | " | ||
diff --git a/recipes-connectivity/dhcp/files/dhclient-exit-hooks b/recipes-connectivity/dhcp/files/dhclient-exit-hooks deleted file mode 100644 index 41bcb08..0000000 --- a/recipes-connectivity/dhcp/files/dhclient-exit-hooks +++ /dev/null | |||
@@ -1,95 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | # | ||
3 | # /etc/dhcp/dhclient-exit-hooks | ||
4 | # | ||
5 | # This file is sourced by /sbin/dhclient-script. | ||
6 | # | ||
7 | # dhcp option 121 is defined in RFC3442. The following is the link. | ||
8 | # http://www.ietf.org/rfc/rfc3442.txt | ||
9 | # | ||
10 | # The code for this option is 121, and its minimum length is 5 bytes. | ||
11 | # This option can contain one or more static routes, each of which | ||
12 | # consists of a destination descriptor and the IP address of the router | ||
13 | # that should be used to reach that destination. | ||
14 | # | ||
15 | # Code Len Destination 1 Router 1 | ||
16 | # +-----+---+----+-----+----+----+----+----+----+ | ||
17 | # | 121 | n | d1 | ... | dN | r1 | r2 | r3 | r4 | | ||
18 | # +-----+---+----+-----+----+----+----+----+----+ | ||
19 | # | ||
20 | # Destination 2 Router 2 | ||
21 | # +----+-----+----+----+----+----+----+ | ||
22 | # | d1 | ... | dN | r1 | r2 | r3 | r4 | | ||
23 | # +----+-----+----+----+----+----+----+ | ||
24 | # | ||
25 | # In the above example, two static routes are specified. | ||
26 | # | ||
27 | # The following table contains some examples of how various subnet | ||
28 | # number/mask combinations can be encoded: | ||
29 | # | ||
30 | # Subnet number Subnet mask Destination descriptor | ||
31 | # 0 0 0 | ||
32 | # 10.0.0.0 255.0.0.0 8.10 | ||
33 | # 10.0.0.0 255.255.255.0 24.10.0.0 | ||
34 | # 10.17.0.0 255.255.0.0 16.10.17 | ||
35 | # 10.27.129.0 255.255.255.0 24.10.27.129 | ||
36 | # 10.229.0.128 255.255.255.128 25.10.229.0.128 | ||
37 | # 10.198.122.47 255.255.255.255 32.10.198.122.47 | ||
38 | # | ||
39 | # For metadata service, the following is a valid route from nova-api that | ||
40 | # the VM instance can uses to retrieve metadata. | ||
41 | # | ||
42 | # 32 169 254 169 254 128 224 149 201 | ||
43 | # | ||
44 | # In the above example, mask length of destination descriptor is always 32, | ||
45 | # destination is always "169.254.169.254", and the gateway is a valid IP address. | ||
46 | # | ||
47 | # The add_routes function takes an array of unsigned integer 8, separated by spaces, | ||
48 | # parse them, and added each of the routes into routing table. | ||
49 | # | ||
50 | |||
51 | function add_routes() { | ||
52 | while [ $# -ne 0 ]; do | ||
53 | mask=$1 | ||
54 | shift | ||
55 | |||
56 | # Parse the arguments into a CIDR net/mask string | ||
57 | if [ $mask -eq 32 ]; then | ||
58 | destination="-host $1.$2.$3.$4" | ||
59 | shift; shift; shift; shift | ||
60 | elif [ $mask -gt 24 ]; then | ||
61 | destination="-net $1.$2.$3.$4/$mask" | ||
62 | shift; shift; shift; shift | ||
63 | elif [ $mask -gt 16 ]; then | ||
64 | destination="-net $1.$2.$3.0/$mask" | ||
65 | shift; shift; shift | ||
66 | elif [ $mask -gt 8 ]; then | ||
67 | destination="-net $1.$2.0.0/$mask" | ||
68 | shift; shift | ||
69 | #Add the default route | ||
70 | elif [ $mask -eq 0 ]; then | ||
71 | destination="default" | ||
72 | else | ||
73 | destination="-net $1.0.0.0/$mask" | ||
74 | shift | ||
75 | fi | ||
76 | |||
77 | # Read the gateway | ||
78 | gateway="$1.$2.$3.$4" | ||
79 | shift; shift; shift; shift | ||
80 | |||
81 | # Add route into routing table | ||
82 | route add $destination gw $gateway | ||
83 | |||
84 | # Print it out if the route is added successfully | ||
85 | if [ $? = 0 ]; then | ||
86 | echo "Added route \"$destination gw $gateway\"" | ||
87 | fi | ||
88 | done | ||
89 | } | ||
90 | |||
91 | # Call add_routes to add routes | ||
92 | if [ "x$new_classless_static_routes" != x ]; then | ||
93 | add_routes $new_classless_static_routes | ||
94 | fi | ||
95 | |||