aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Tan <samueltan@google.com>2015-08-13 17:26:40 -0700
committerSamuel Tan <samueltan@google.com>2015-08-18 13:47:36 -0700
commit68df7cfd9156424667636ad3544d0fa9f337647d (patch)
tree83d9f568d7811b37b3942bcdb498eee59aba53f0
parent0c07e7a4a10f902911d93f37e01b8a0308d67e96 (diff)
downloaddhcpcd-6.8.2-68df7cfd9156424667636ad3544d0fa9f337647d.tar.gz
[PATCH] DHCPv6: Fix prefix delegation lease file name
Cherry-picked from https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/ master/net-misc/dhcpcd/files/patches/dhcpcd-6.8.2-DHCPv6-Fix-prefix- delegation-lease-file-name.patch. For DHCPv6, daemon creates two lease files, one for non-temporary address and the other for prefix delegation. Currently only non-temporary address lease is using the lease identifier obtained from command line for its file name, since dhcpcd is using a separate pseudo interface for handling prefix delegation messages. So fix it to have both lease files using the same identifier obtained from the command line, with non-temporary address lease ends in ".lease6" and prefix delegation ends is ".pd.lease6". BUG: 22956197 Change-Id: I24ada24e791e0be77aaadd148349be00ef2b6966 Reviewed-on: https://chromium-review.googlesource.com/282041
-rw-r--r--dhcp-common.c4
-rw-r--r--dhcp6.c8
2 files changed, 10 insertions, 2 deletions
diff --git a/dhcp-common.c b/dhcp-common.c
index 9ac226a..a3764f1 100644
--- a/dhcp-common.c
+++ b/dhcp-common.c
@@ -750,11 +750,11 @@ dhcp_set_leasefile(char *leasefile, size_t len, int family,
if (strlen(ifp->lease_identifier) > 0) {
return snprintf(leasefile, len,
family == AF_INET ? LEASEFILE : LEASEFILE6,
- ifp->lease_identifier, "", "");
+ ifp->lease_identifier, "", extra);
}
return snprintf(leasefile, len,
family == AF_INET ? LEASEFILE : LEASEFILE6,
- ifp->name, "", "");
+ ifp->name, "", extra);
}
static size_t
diff --git a/dhcp6.c b/dhcp6.c
index 79b7cf1..238acd4 100644
--- a/dhcp6.c
+++ b/dhcp6.c
@@ -3207,6 +3207,14 @@ dhcp6_start1(void *arg)
ifp->name);
ifp->options->options |=
DHCPCD_NOPFXDLG;
+ /*
+ * Maintain the same lease identifier
+ * for the pseudo interface for
+ * obtaining prefix delegation.
+ */
+ strlcpy(ifn->lease_identifier,
+ ifp->lease_identifier,
+ sizeof(ifn->lease_identifier));
TAILQ_REMOVE(ifs, ifn, next);
TAILQ_INSERT_AFTER(ifp->ctx->ifaces,
ifp, ifn, next);