mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-17 18:06:59 +02:00
Merge pull request #464 from philips/oem-gce-cloud-config
Fixes for GCE
This commit is contained in:
commit
fe357a7be0
14
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-gce/files/cloud-config.yml
vendored
Normal file
14
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-gce/files/cloud-config.yml
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
#cloud-config
|
||||
|
||||
coreos:
|
||||
units:
|
||||
- name: ec2-ssh-key.service
|
||||
runtime: yes
|
||||
content: |
|
||||
[Unit]
|
||||
Description=Sets SSH key from metadata
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
StandardOutput=journal+console
|
||||
ExecStart=/usr/share/oem/bin/gce-ssh-key
|
@ -16,9 +16,9 @@ IUSE=""
|
||||
S="${WORKDIR}"
|
||||
|
||||
src_install() {
|
||||
exeinto "/"
|
||||
doexe ${FILESDIR}/run
|
||||
into "/"
|
||||
dobin ${FILESDIR}/gce-ssh-key
|
||||
|
||||
insinto "/"
|
||||
doins ${FILESDIR}/oem-release
|
||||
doins ${FILESDIR}/cloud-config.yml
|
||||
}
|
||||
|
@ -0,0 +1,66 @@
|
||||
From 2b1ce33baa29bddf5367c0bcfcfb884e36641cc7 Mon Sep 17 00:00:00 2001
|
||||
From: Brandon Philips <brandon@ifup.co>
|
||||
Date: Thu, 20 Mar 2014 11:28:12 -0700
|
||||
Subject: [PATCH] network: dhcp: create explicit host route to gateway
|
||||
|
||||
Some DHCP servers gives you a netmask of 255.255.255.255 so the gateway is not
|
||||
routable. Other DHCP client implementations look through the existing routes to
|
||||
figure out if they should add an explicit host route. See below for a link.
|
||||
|
||||
However, it makes sense to just create the route explicitly whether it is
|
||||
needed or not since it is explicit, makes the dhcp route entries independent of
|
||||
other entries and saves us from knowing the state of the kernel tables.
|
||||
|
||||
The code from dhcpcd that works around this issue is on line 637.
|
||||
https://android.googlesource.com/platform/external/dhcpcd/+/master/configure.c
|
||||
---
|
||||
src/network/networkd-link.c | 26 ++++++++++++++++++++++++++
|
||||
1 file changed, 26 insertions(+)
|
||||
|
||||
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
|
||||
index 275ad97..8077ac7 100644
|
||||
--- a/src/network/networkd-link.c
|
||||
+++ b/src/network/networkd-link.c
|
||||
@@ -237,6 +237,8 @@ static int link_enter_set_routes(Link *link) {
|
||||
|
||||
if (link->dhcp_lease) {
|
||||
_cleanup_route_free_ Route *route = NULL;
|
||||
+ _cleanup_route_free_ Route *route_gw = NULL;
|
||||
+ struct in_addr netmask;
|
||||
struct in_addr gateway;
|
||||
|
||||
r = sd_dhcp_lease_get_router(link->dhcp_lease, &gateway);
|
||||
@@ -253,6 +255,30 @@ static int link_enter_set_routes(Link *link) {
|
||||
return r;
|
||||
}
|
||||
|
||||
+ r = route_new_dynamic(&route_gw);
|
||||
+ if (r < 0) {
|
||||
+ log_error_link(link, "Could not allocate route: %s",
|
||||
+ strerror(-r));
|
||||
+ return r;
|
||||
+ }
|
||||
+
|
||||
+ /* The dhcp netmask may mask out the gateway. Add an explicit
|
||||
+ * route for the gw host so that we can route no matter the
|
||||
+ * netmask or existing kernel route tables. */
|
||||
+ route_gw->family = AF_INET;
|
||||
+ route_gw->dst_addr.in = gateway;
|
||||
+ route_gw->dst_prefixlen = 32;
|
||||
+ route_gw->scope = RT_SCOPE_LINK;
|
||||
+
|
||||
+ r = route_configure(route_gw, link, &route_handler);
|
||||
+ if (r < 0) {
|
||||
+ log_warning_link(link,
|
||||
+ "could not set host route: %s", strerror(-r));
|
||||
+ return r;
|
||||
+ }
|
||||
+
|
||||
+ link->route_messages ++;
|
||||
+
|
||||
route->family = AF_INET;
|
||||
route->in_addr.in = gateway;
|
||||
|
||||
--
|
||||
1.8.5.2 (Apple Git-48)
|
||||
|
@ -0,0 +1,29 @@
|
||||
From 7bf2f4397255bc8f6cf20a0f2adab4c984ea7d14 Mon Sep 17 00:00:00 2001
|
||||
From: Tom Gundersen <teg@jklm.no>
|
||||
Date: Wed, 19 Mar 2014 10:41:29 +0100
|
||||
Subject: [PATCH] sd-dhcp-client: accept infinite lease lifetime
|
||||
|
||||
Otherwise we would fail with -EINVAL. Thanks to Brandon Philips
|
||||
<brandon.philips@coreos.com>, for reporting the bug.
|
||||
---
|
||||
src/libsystemd-network/sd-dhcp-client.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c
|
||||
index 8411141..ce375dd 100644
|
||||
--- a/src/libsystemd-network/sd-dhcp-client.c
|
||||
+++ b/src/libsystemd-network/sd-dhcp-client.c
|
||||
@@ -747,6 +747,10 @@ static int client_set_lease_timeouts(sd_dhcp_client *client, uint64_t usec) {
|
||||
assert(client);
|
||||
assert(client->event);
|
||||
|
||||
+ /* don't set timers for infinite leases */
|
||||
+ if (client->lease->lifetime == 0xffffffff)
|
||||
+ return 0;
|
||||
+
|
||||
if (client->lease->lifetime < 10)
|
||||
return -EINVAL;
|
||||
|
||||
--
|
||||
1.8.5.2 (Apple Git-48)
|
||||
|
@ -132,6 +132,10 @@ src_prepare() {
|
||||
# dns feature for more than one server
|
||||
epatch "${FILESDIR}"/211-networkd-allow-more-than-one-static-dns-server.patch
|
||||
|
||||
# patches to fix dhcp on gce
|
||||
epatch "${FILESDIR}"/211-0001-sd-dhcp-client-accept-infinite-lease-lifetime.patch
|
||||
epatch "${FILESDIR}"/0001-network-dhcp-create-explicit-host-route-to-gateway.patch
|
||||
|
||||
if [[ ${PV} == *9999 ]]; then
|
||||
if use doc; then
|
||||
gtkdocize --docdir docs/ || die
|
Loading…
Reference in New Issue
Block a user