X-Original-To: alpine-aports@mail.alpinelinux.org Delivered-To: alpine-aports@mail.alpinelinux.org Received: from mail.alpinelinux.org (dallas-a1.alpinelinux.org [127.0.0.1]) by mail.alpinelinux.org (Postfix) with ESMTP id 8F4BFDC10E7 for ; Fri, 13 Nov 2015 13:55:37 +0000 (UTC) Received: from anomx-ro.ovpn.to (anomx.ovpn.to [93.115.92.252]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.alpinelinux.org (Postfix) with ESMTPS id 43ECBDC0092 for ; Fri, 13 Nov 2015 13:55:37 +0000 (UTC) Received: from anomx.ovpn.to (unknown [IPv6:fd48:8bea:68a5:aaaa::aa01]) by anomx-ro.ovpn.to (Postfix) with ESMTPS id EEEBC1F849 for ; Fri, 13 Nov 2015 14:55:34 +0100 (CET) Received: from localhost (anomx.ovpn.to [127.0.0.1]) by anomx.ovpn.to (Postfix) with ESMTP id BF288C0305 for ; Fri, 13 Nov 2015 14:55:34 +0100 (CET) Received: from anomx.ovpn.to ([127.0.0.1]) by localhost (anomx.ovpn.to [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id omyjrLH05A-r for ; Fri, 13 Nov 2015 14:55:32 +0100 (CET) From: sillysausage To: alpine-aports@lists.alpinelinux.org Cc: sillysausage Subject: [alpine-aports] [PATCH] dhcpcd - Describe dhcp6 error code if no text present Date: Sat, 14 Nov 2015 00:24:46 +1030 Message-Id: <1447422886-4338-1-git-send-email-sillysausage@privatedemail.net> X-Virus-Scanned: ClamAV using ClamSMTP X-Mailinglist: alpine-aports Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: Patch from upstream, will be included in dhcpcd-6.9.4 when released http://roy.marples.name/projects/dhcpcd/vpatch?from=d8f8999d1efb4376c29d7d2c13b0de1c6da52226&to=90e878f68804cb98e03e90b33233e607e6541358 --- main/dhcpcd/describe_dhcp6_error_code.patch | 77 +++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 main/dhcpcd/describe_dhcp6_error_code.patch diff --git a/main/dhcpcd/describe_dhcp6_error_code.patch b/main/dhcpcd/describe_dhcp6_error_code.patch new file mode 100644 index 0000000..cd72206 --- /dev/null +++ b/main/dhcpcd/describe_dhcp6_error_code.patch @@ -0,0 +1,77 @@ +--- ./dhcp6.c ++++ ./dhcp6.c +@@ -111,11 +111,12 @@ + "Success", + "Unspecified Failure", + "No Addresses Available", + "No Binding", + "Not On Link", +- "Use Multicast" ++ "Use Multicast", ++ "No Prefix Available" + }; + + struct dhcp6_ia_addr { + struct in6_addr addr; + uint32_t pltime; +@@ -1660,11 +1661,12 @@ + dhcp6_checkstatusok(const struct interface *ifp, + const struct dhcp6_message *m, const uint8_t *p, size_t len) + { + const struct dhcp6_option *o; + uint16_t code; +- char *status; ++ char buf[32], *sbuf; ++ const char *status; + + if (p) + o = dhcp6_findoption(D6_OPTION_STATUS_CODE, p, len); + else + o = dhcp6_getmoption(D6_OPTION_STATUS_CODE, m, len); +@@ -1686,28 +1688,29 @@ + return 1; + + len -= sizeof(code); + + if (len == 0) { +- if (code < sizeof(dhcp6_statuses) / sizeof(char *)) { +- p = (const uint8_t *)dhcp6_statuses[code]; +- len = strlen((const char *)p); +- } else +- p = NULL; +- } else +- p += sizeof(code); ++ sbuf = NULL; ++ if (code < sizeof(dhcp6_statuses) / sizeof(char *)) ++ status = dhcp6_statuses[code]; ++ else { ++ snprintf(buf, sizeof(buf), "Unknown Status (%d)", code); ++ status = buf; ++ } ++ } else { ++ if ((sbuf = malloc(len + 1)) == NULL) { ++ logger(ifp->ctx, LOG_ERR, "%s: %m", __func__); ++ return -1; ++ } ++ memcpy(sbuf, p + sizeof(code), len); ++ sbuf[len] = '\0'; ++ status = sbuf; ++ } + +- status = malloc(len + 1); +- if (status == NULL) { +- logger(ifp->ctx, LOG_ERR, "%s: %m", __func__); +- return -1; +- } +- if (p) +- memcpy(status, p, len); +- status[len] = '\0'; + logger(ifp->ctx, LOG_ERR, "%s: DHCPv6 REPLY: %s", ifp->name, status); +- free(status); ++ free(sbuf); + return -1; + } + + const struct ipv6_addr * + dhcp6_iffindaddr(const struct interface *ifp, const struct in6_addr *addr, + -- 2.4.1 --- Unsubscribe: alpine-aports+unsubscribe@lists.alpinelinux.org Help: alpine-aports+help@lists.alpinelinux.org ---