add new cubox and hummingboard dtbs to armv7 miniroot/ramdisk

2018-03-14 Thread Jonathan Gray
As of U-Boot 2018.03 the mx6cuboxi U-Boot image may attempt to load

imx6q-hummingboard2.dtb
imx6dl-hummingboard2.dtb
imx6q-hummingboard.dtb
imx6dl-hummingboard.dtb
imx6q-cubox-i.dtb
imx6dl-cubox-i.dtb

dtbs for rev 1.5 soms will be loaded automatically at some
point in the future
https://patchwork.ozlabs.org/patch/881181/

The hummingboard2 and rev 1.5 dtbs require the dtb 4.16-rc5 update I
just committed to ports.

Index: miniroot/cubox/Makefile
===
RCS file: /cvs/src/distrib/armv7/miniroot/cubox/Makefile,v
retrieving revision 1.5
diff -u -p -r1.5 Makefile
--- miniroot/cubox/Makefile 10 Jun 2016 12:14:44 -  1.5
+++ miniroot/cubox/Makefile 15 Mar 2018 02:53:05 -
@@ -3,8 +3,22 @@ PLATFORM=IMX
 UBOOT= mx6cuboxi
 DTBS=\
imx6dl-cubox-i.dtb \
+   imx6dl-cubox-i-emmc-som-v15.dtb \
+   imx6dl-cubox-i-som-v15.dtb \
imx6dl-hummingboard.dtb \
+   imx6dl-hummingboard-emmc-som-v15.dtb \
+   imx6dl-hummingboard-som-v15.dtb \
+   imx6dl-hummingboard2.dtb \
+   imx6dl-hummingboard2-emmc-som-v15.dtb \
+   imx6dl-hummingboard2-som-v15.dtb \
imx6q-cubox-i.dtb \
-   imx6q-hummingboard.dtb
+   imx6q-cubox-i-emmc-som-v15.dtb \
+   imx6q-cubox-i-som-v15.dtb \
+   imx6q-hummingboard.dtb \
+   imx6q-hummingboard-emmc-som-v15.dtb \
+   imx6q-hummingboard-som-v15.dtb \
+   imx6q-hummingboard2.dtb \
+   imx6q-hummingboard2-emmc-som-v15.dtb \
+   imx6q-hummingboard2-som-v15.dtb
 
 .include "${.CURDIR}/../Makefile.inc"
Index: ramdisk/list
===
RCS file: /cvs/src/distrib/armv7/ramdisk/list,v
retrieving revision 1.34
diff -u -p -r1.34 list
--- ramdisk/list3 Dec 2017 10:34:30 -   1.34
+++ ramdisk/list15 Mar 2018 02:53:05 -
@@ -146,9 +146,23 @@ COPY   /usr/local/share/dtb/arm/omap4-sdp.
 COPY   /usr/local/share/u-boot/mx6cuboxi/SPL   usr/mdec/cubox/SPL
 COPY   /usr/local/share/u-boot/mx6cuboxi/u-boot.img
usr/mdec/cubox/u-boot.img
 COPY   /usr/local/share/dtb/arm/imx6dl-cubox-i.dtb 
usr/mdec/cubox/imx6dl-cubox-i.dtb
+COPY   /usr/local/share/dtb/arm/imx6dl-cubox-i-emmc-som-v15.dtb
usr/mdec/cubox/imx6dl-cubox-i-emmc-som-v15.dtb
+COPY   /usr/local/share/dtb/arm/imx6dl-cubox-i-som-v15.dtb 
usr/mdec/cubox/imx6dl-cubox-i-som-v15.dtb
 COPY   /usr/local/share/dtb/arm/imx6dl-hummingboard.dtb
usr/mdec/cubox/imx6dl-hummingboard.dtb
+COPY   /usr/local/share/dtb/arm/imx6dl-hummingboard-emmc-som-v15.dtb   
usr/mdec/cubox/imx6dl-hummingboard-emmc-som-v15.dtb
+COPY   /usr/local/share/dtb/arm/imx6dl-hummingboard-som-v15.dtb
usr/mdec/cubox/imx6dl-hummingboard-som-v15.dtb
+COPY   /usr/local/share/dtb/arm/imx6dl-hummingboard2.dtb   
usr/mdec/cubox/imx6dl-hummingboard2.dtb
+COPY   /usr/local/share/dtb/arm/imx6dl-hummingboard2-emmc-som-v15.dtb  
usr/mdec/cubox/imx6dl-hummingboard2-emmc-som-v15.dtb
+COPY   /usr/local/share/dtb/arm/imx6dl-hummingboard2-som-v15.dtb   
usr/mdec/cubox/imx6dl-hummingboard2-som-v15.dtb
 COPY   /usr/local/share/dtb/arm/imx6q-cubox-i.dtb  
usr/mdec/cubox/imx6q-cubox-i.dtb
+COPY   /usr/local/share/dtb/arm/imx6q-cubox-i-emmc-som-v15.dtb 
usr/mdec/cubox/imx6q-cubox-i-emmc-som-v15.dtb
+COPY   /usr/local/share/dtb/arm/imx6q-cubox-i-som-v15.dtb  
usr/mdec/cubox/imx6q-cubox-i-som-v15.dtb
 COPY   /usr/local/share/dtb/arm/imx6q-hummingboard.dtb 
usr/mdec/cubox/imx6q-hummingboard.dtb
+COPY   /usr/local/share/dtb/arm/imx6q-hummingboard-emmc-som-v15.dtb
usr/mdec/cubox/imx6q-hummingboard-emmc-som-v15.dtb
+COPY   /usr/local/share/dtb/arm/imx6q-hummingboard-som-v15.dtb 
usr/mdec/cubox/imx6q-hummingboard-som-v15.dtb
+COPY   /usr/local/share/dtb/arm/imx6q-hummingboard2.dtb
usr/mdec/cubox/imx6q-hummingboard2.dtb
+COPY   /usr/local/share/dtb/arm/imx6q-hummingboard2-emmc-som-v15.dtb   
usr/mdec/cubox/imx6q-hummingboard2-emmc-som-v15.dtb
+COPY   /usr/local/share/dtb/arm/imx6q-hummingboard2-som-v15.dtb
usr/mdec/cubox/imx6q-hummingboard2-som-v15.dtb
 
 COPY   /usr/local/share/dtb/arm/imx6dl-nitrogen6x.dtb  
usr/mdec/nitrogen/imx6dl-nitrogen6x.dtb
 COPY   /usr/local/share/dtb/arm/imx6dl-sabrelite.dtb   
usr/mdec/nitrogen/imx6dl-sabrelite.dtb



Re: ipmi at acpi

2018-03-14 Thread Patrick Wildt
On Wed, Mar 14, 2018 at 02:58:14PM +0100, Patrick Wildt wrote:
> Hi,
> 
> I have some hardware where IPMI is not found using the SMBIOS table
> anymore but using ACPI.  These show up in the dmesg as
> 
> "IPI0001" at acpi0 not configured
> 
> The driver basically reads the information out of ACPI and then runs
> the normal IPMI attach code.  It's an attachment driver, no magic.
> 
> This is so far tested with the KSC interface type, I don't have any
> hardware (that I know of) with the other interface types.  But it
> should complain if things don't work.
> 
> With this I get proper sensor data out of IPMI.
> 
> Comments?
> 
> Patrick
> 
> diff --git a/sys/arch/amd64/conf/GENERIC b/sys/arch/amd64/conf/GENERIC
> index f76f70697c2..0f9dbedfc71 100644
> --- a/sys/arch/amd64/conf/GENERIC
> +++ b/sys/arch/amd64/conf/GENERIC
> @@ -66,6 +66,7 @@ acpicbkbd*  at acpi?
>  acpials* at acpi?
>  tpm* at acpi?
>  acpihve* at acpi?
> +ipmi*at acpi? disable

This should be ipmi0, otherwise on machines where IPMI is defined in
both tables it tries to attach twice and will fail.  With ipmi0 there
can only be one.  Verified on some other hardware I found.

Found thanks to jsg@.

>  
>  mpbios0  at bios0
>  
> diff --git a/sys/dev/acpi/acpireg.h b/sys/dev/acpi/acpireg.h
> index 130df5c97b2..2c6612d2b3f 100644
> --- a/sys/dev/acpi/acpireg.h
> +++ b/sys/dev/acpi/acpireg.h
> @@ -760,5 +760,6 @@ struct acpi_ivrs {
>  #define ACPI_DEV_IOSA"ACPI000B"  /* IO SAPIC Device */
>  #define ACPI_DEV_THZ "THERMALZONE"   /* Thermal Zone */
>  #define ACPI_DEV_FFB "FIXEDBUTTON"   /* Fixed Feature Button */
> +#define ACPI_DEV_IPMI"IPI0001"   /* IPMI */
>  
>  #endif   /* !_DEV_ACPI_ACPIREG_H_ */
> diff --git a/sys/dev/acpi/files.acpi b/sys/dev/acpi/files.acpi
> index 44edff19d6f..e22d64673ec 100644
> --- a/sys/dev/acpi/files.acpi
> +++ b/sys/dev/acpi/files.acpi
> @@ -154,3 +154,7 @@ file  dev/acpi/acpihve.c  acpihve
>  device   acpisbs
>  attach   acpisbs at acpi
>  file dev/acpi/acpisbs.c  acpisbs
> +
> +# IPMI
> +attach   ipmi at acpi with ipmi_acpi
> +file dev/acpi/ipmi_acpi.cipmi_acpi
> diff --git a/sys/dev/acpi/ipmi_acpi.c b/sys/dev/acpi/ipmi_acpi.c
> new file mode 100644
> index 000..df5a7bbf06e
> --- /dev/null
> +++ b/sys/dev/acpi/ipmi_acpi.c
> @@ -0,0 +1,161 @@
> +/* $OpenBSD$ */
> +/*
> + * Copyright (c) 2018 Patrick Wildt 
> + *
> + * Permission to use, copy, modify, and distribute this software for any
> + * purpose with or without fee is hereby granted, provided that the above
> + * copyright notice and this permission notice appear in all copies.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
> + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
> + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
> + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#undef DEVNAME
> +
> +#include 
> +
> +#define DEVNAME(s)   ((s)->sc.sc_dev.dv_xname)
> +
> +int  ipmi_acpi_match(struct device *, void *, void *);
> +void ipmi_acpi_attach(struct device *, struct device *, void *);
> +int  ipmi_acpi_parse_crs(int, union acpi_resource *, void *);
> +
> +extern void ipmi_attach(struct device *, struct device *, void *);
> +
> +struct ipmi_acpi_softc {
> + struct ipmi_softcsc;
> +
> + struct acpi_softc   *sc_acpi;
> + struct aml_node *sc_devnode;
> +
> + int  sc_ift;
> +
> + bus_space_tag_t  sc_iot;
> + bus_size_t   sc_iobase;
> + int  sc_iospacing;
> + char sc_iotype;
> +};
> +
> +struct cfattach ipmi_acpi_ca = {
> + sizeof(struct ipmi_acpi_softc), ipmi_acpi_match, ipmi_acpi_attach,
> +};
> +
> +const char *ipmi_acpi_hids[] = { ACPI_DEV_IPMI, NULL };
> +
> +int
> +ipmi_acpi_match(struct device *parent, void *match, void *aux)
> +{
> + struct acpi_attach_args *aa = aux;
> + struct cfdata *cf = match;
> +
> + /* sanity */
> + return (acpi_matchhids(aa, ipmi_acpi_hids, cf->cf_driver->cd_name));
> +}
> +
> +void
> +ipmi_acpi_attach(struct device *parent, struct device *self, void *aux)
> +{
> + struct ipmi_acpi_softc *sc = (struct ipmi_acpi_softc *)self;
> + struct acpi_attach_args *aa = aux;
> + struct ipmi_attach_args ia;
> + struct aml_value res;
> + int64_t ift;
> + int rc;
> +
> + sc->sc_acpi = (struct acpi_softc 

ipmi at acpi

2018-03-14 Thread Patrick Wildt
Hi,

I have some hardware where IPMI is not found using the SMBIOS table
anymore but using ACPI.  These show up in the dmesg as

"IPI0001" at acpi0 not configured

The driver basically reads the information out of ACPI and then runs
the normal IPMI attach code.  It's an attachment driver, no magic.

This is so far tested with the KSC interface type, I don't have any
hardware (that I know of) with the other interface types.  But it
should complain if things don't work.

With this I get proper sensor data out of IPMI.

Comments?

Patrick

diff --git a/sys/arch/amd64/conf/GENERIC b/sys/arch/amd64/conf/GENERIC
index f76f70697c2..0f9dbedfc71 100644
--- a/sys/arch/amd64/conf/GENERIC
+++ b/sys/arch/amd64/conf/GENERIC
@@ -66,6 +66,7 @@ acpicbkbd*at acpi?
 acpials*   at acpi?
 tpm*   at acpi?
 acpihve*   at acpi?
+ipmi*  at acpi? disable
 
 mpbios0at bios0
 
diff --git a/sys/dev/acpi/acpireg.h b/sys/dev/acpi/acpireg.h
index 130df5c97b2..2c6612d2b3f 100644
--- a/sys/dev/acpi/acpireg.h
+++ b/sys/dev/acpi/acpireg.h
@@ -760,5 +760,6 @@ struct acpi_ivrs {
 #define ACPI_DEV_IOSA  "ACPI000B"  /* IO SAPIC Device */
 #define ACPI_DEV_THZ   "THERMALZONE"   /* Thermal Zone */
 #define ACPI_DEV_FFB   "FIXEDBUTTON"   /* Fixed Feature Button */
+#define ACPI_DEV_IPMI  "IPI0001"   /* IPMI */
 
 #endif /* !_DEV_ACPI_ACPIREG_H_ */
diff --git a/sys/dev/acpi/files.acpi b/sys/dev/acpi/files.acpi
index 44edff19d6f..e22d64673ec 100644
--- a/sys/dev/acpi/files.acpi
+++ b/sys/dev/acpi/files.acpi
@@ -154,3 +154,7 @@ filedev/acpi/acpihve.c  acpihve
 device acpisbs
 attach acpisbs at acpi
 file   dev/acpi/acpisbs.c  acpisbs
+
+# IPMI
+attach ipmi at acpi with ipmi_acpi
+file   dev/acpi/ipmi_acpi.cipmi_acpi
diff --git a/sys/dev/acpi/ipmi_acpi.c b/sys/dev/acpi/ipmi_acpi.c
new file mode 100644
index 000..df5a7bbf06e
--- /dev/null
+++ b/sys/dev/acpi/ipmi_acpi.c
@@ -0,0 +1,161 @@
+/* $OpenBSD$ */
+/*
+ * Copyright (c) 2018 Patrick Wildt 
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#undef DEVNAME
+
+#include 
+
+#define DEVNAME(s) ((s)->sc.sc_dev.dv_xname)
+
+intipmi_acpi_match(struct device *, void *, void *);
+void   ipmi_acpi_attach(struct device *, struct device *, void *);
+intipmi_acpi_parse_crs(int, union acpi_resource *, void *);
+
+extern void ipmi_attach(struct device *, struct device *, void *);
+
+struct ipmi_acpi_softc {
+   struct ipmi_softcsc;
+
+   struct acpi_softc   *sc_acpi;
+   struct aml_node *sc_devnode;
+
+   int  sc_ift;
+
+   bus_space_tag_t  sc_iot;
+   bus_size_t   sc_iobase;
+   int  sc_iospacing;
+   char sc_iotype;
+};
+
+struct cfattach ipmi_acpi_ca = {
+   sizeof(struct ipmi_acpi_softc), ipmi_acpi_match, ipmi_acpi_attach,
+};
+
+const char *ipmi_acpi_hids[] = { ACPI_DEV_IPMI, NULL };
+
+int
+ipmi_acpi_match(struct device *parent, void *match, void *aux)
+{
+   struct acpi_attach_args *aa = aux;
+   struct cfdata *cf = match;
+
+   /* sanity */
+   return (acpi_matchhids(aa, ipmi_acpi_hids, cf->cf_driver->cd_name));
+}
+
+void
+ipmi_acpi_attach(struct device *parent, struct device *self, void *aux)
+{
+   struct ipmi_acpi_softc *sc = (struct ipmi_acpi_softc *)self;
+   struct acpi_attach_args *aa = aux;
+   struct ipmi_attach_args ia;
+   struct aml_value res;
+   int64_t ift;
+   int rc;
+
+   sc->sc_acpi = (struct acpi_softc *)parent;
+   sc->sc_devnode = aa->aaa_node;
+
+   rc = aml_evalinteger(sc->sc_acpi, sc->sc_devnode, "_IFT", 0, NULL, 
);
+   if (rc) {
+   printf(": no _IFT\n");
+   return;
+   }
+   sc->sc_ift = ift;
+
+   if (aml_evalname(sc->sc_acpi, sc->sc_devnode, "_CRS", 0, NULL, )) {
+   printf(": no _CRS method\n");
+   return;
+   }
+   if (res.type != AML_OBJTYPE_BUFFER) {
+   printf(": invalid _CRS object (type %d len %d)\n",
+   res.type, 

Re: netinet6 - bcopy -> memcpy

2018-03-14 Thread Florian Obser
OK florian@ for after unlock

On Tue, Mar 13, 2018 at 05:40:24PM -0400, David Hill wrote:
> Hello -
> 
> A few bcopy to memcpy conversions where the memory does not overlap.
> 
> OK?
> 
> Index: netinet6/icmp6.c
> ===
> RCS file: /cvs/src/sys/netinet6/icmp6.c,v
> retrieving revision 1.221
> diff -u -p -r1.221 icmp6.c
> --- netinet6/icmp6.c  14 Dec 2017 14:26:50 -  1.221
> +++ netinet6/icmp6.c  13 Mar 2018 21:32:32 -
> @@ -1075,7 +1075,7 @@ icmp6_reflect(struct mbuf *m, size_t off
>   if ((m = m_pullup(m, l)) == NULL)
>   return;
>   }
> - bcopy((caddr_t), mtod(m, caddr_t), sizeof(nip6));
> + memcpy(mtod(m, caddr_t), (caddr_t), sizeof(nip6));
>   } else /* off == sizeof(struct ip6_hdr) */ {
>   size_t l;
>   l = sizeof(struct ip6_hdr) + sizeof(struct icmp6_hdr);
> @@ -1268,7 +1268,7 @@ icmp6_redirect_input(struct mbuf *m, int
>   bzero(, sizeof(sin6));
>   sin6.sin6_family = AF_INET6;
>   sin6.sin6_len = sizeof(struct sockaddr_in6);
> - bcopy(, _addr, sizeof(reddst6));
> + memcpy(_addr, , sizeof(reddst6));
>   rt = rtalloc(sin6tosa(), 0, m->m_pkthdr.ph_rtableid);
>   if (rt) {
>   if (rt->rt_gateway == NULL ||
> @@ -1376,9 +1376,9 @@ icmp6_redirect_input(struct mbuf *m, int
>   sdst.sin6_family = sgw.sin6_family = ssrc.sin6_family = 
> AF_INET6;
>   sdst.sin6_len = sgw.sin6_len = ssrc.sin6_len =
>   sizeof(struct sockaddr_in6);
> - bcopy(, _addr, sizeof(struct in6_addr));
> - bcopy(, _addr, sizeof(struct in6_addr));
> - bcopy(, _addr, sizeof(struct in6_addr));
> + memcpy(_addr, , sizeof(struct in6_addr));
> + memcpy(_addr, , sizeof(struct in6_addr));
> + memcpy(_addr, , sizeof(struct in6_addr));
>   rtredirect(sin6tosa(), sin6tosa(), sin6tosa(),
>   , m->m_pkthdr.ph_rtableid);
>  
> @@ -1395,7 +1395,7 @@ icmp6_redirect_input(struct mbuf *m, int
>   bzero(, sizeof(sdst));
>   sdst.sin6_family = AF_INET6;
>   sdst.sin6_len = sizeof(struct sockaddr_in6);
> - bcopy(, _addr, sizeof(struct in6_addr));
> + memcpy(_addr, , sizeof(struct in6_addr));
>   pfctlinput(PRC_REDIRECT_HOST, sin6tosa());
>   }
>  
> Index: netinet6/in6_ifattach.c
> ===
> RCS file: /cvs/src/sys/netinet6/in6_ifattach.c,v
> retrieving revision 1.106
> diff -u -p -r1.106 in6_ifattach.c
> --- netinet6/in6_ifattach.c   13 Mar 2018 13:58:03 -  1.106
> +++ netinet6/in6_ifattach.c   13 Mar 2018 21:32:33 -
> @@ -165,7 +165,7 @@ in6_get_hw_ifid(struct ifnet *ifp, struc
>  
>   /* make EUI64 address */
>   if (addrlen == 8)
> - bcopy(addr, >s6_addr[8], 8);
> + memcpy(>s6_addr[8], addr, 8);
>   else if (addrlen == 6) {
>   in6->s6_addr[8] = addr[0];
>   in6->s6_addr[9] = addr[1];
> @@ -244,7 +244,7 @@ in6_get_soii_ifid(struct ifnet *ifp, str
>   SHA512Update(, ip6_soiikey, sizeof(ip6_soiikey));
>   SHA512Final(digest, );
>  
> - bcopy(digest + (sizeof(digest) - 8), >s6_addr[8], 8);
> + memcpy(>s6_addr[8], digest + (sizeof(digest) - 8), 8);
>  
>   return 0;
>  }
> @@ -464,7 +464,7 @@ in6_nigroup(struct ifnet *ifp, const cha
>   sa6->sin6_addr.s6_addr16[0] = htons(0xff02);
>   sa6->sin6_addr.s6_addr16[1] = htons(ifp->if_index);
>   sa6->sin6_addr.s6_addr8[11] = 2;
> - bcopy(digest, >sin6_addr.s6_addr32[3],
> + memcpy(>sin6_addr.s6_addr32[3], digest,
>   sizeof(sa6->sin6_addr.s6_addr32[3]));
>  
>   return 0;
> Index: netinet6/ip6_output.c
> ===
> RCS file: /cvs/src/sys/netinet6/ip6_output.c,v
> retrieving revision 1.234
> diff -u -p -r1.234 ip6_output.c
> --- netinet6/ip6_output.c 19 Feb 2018 08:59:53 -  1.234
> +++ netinet6/ip6_output.c 13 Mar 2018 21:32:33 -
> @@ -850,7 +850,7 @@ ip6_copyexthdr(struct mbuf **mp, caddr_t
>   }
>   m->m_len = hlen;
>   if (hdr)
> - bcopy(hdr, mtod(m, caddr_t), hlen);
> + memcpy(mtod(m, caddr_t), hdr, hlen);
>  
>   *mp = m;
>   return (0);
> @@ -918,7 +918,7 @@ ip6_insert_jumboopt(struct ip6_exthdrs *
>   if (!n)
>   return (ENOBUFS);
>   n->m_len = oldoptlen + JUMBOOPTLEN;
> - bcopy(mtod(mopt, caddr_t), mtod(n, caddr_t),
> + memcpy(mtod(n, caddr_t), mtod(mopt, caddr_t),
> oldoptlen);
>   optbuf = mtod(n, u_int8_t *) + oldoptlen;
>   

Re: Bugfix: acme-client 301 redirect issue

2018-03-14 Thread Sebastian Benoit
ok

Florian Obser(flor...@openbsd.org) on 2018.03.14 08:15:35 +0100:
> On Wed, Mar 14, 2018 at 01:08:33AM +, Stuart Henderson wrote:
> > On 2018/03/11 17:52, Florian Obser wrote:
> > > 
> > > I think we should just follow the 301.
> > 
> > I didn't hear back from @letsencrypt_ops about why they were
> > issue 301s, but I do agree it makes sense to follow them.
> 
> update diff with more redirect status codes and EOL tab fixed
> 
> diff --git netproc.c netproc.c
> index 26033a3fc3c..ea901a1bda5 100644
> --- netproc.c
> +++ netproc.c
> @@ -180,15 +180,18 @@ nreq(struct conn *c, const char *addr)
>  {
>   struct httpget  *g;
>   struct sourcesrc[MAX_SERVERS_DNS];
> + struct httphead *st;
>   char*host, *path;
>   shortport;
>   size_t   srcsz;
>   ssize_t  ssz;
>   long code;
> + int  redirects = 0;
>  
>   if ((host = url2host(addr, , )) == NULL)
>   return -1;
>  
> +again:
>   if ((ssz = urlresolve(c->dfd, host, src)) < 0) {
>   free(host);
>   free(path);
> @@ -202,7 +205,36 @@ nreq(struct conn *c, const char *addr)
>   if (g == NULL)
>   return -1;
>  
> - code = g->code;
> + switch (g->code) {
> + case 301:
> + case 302:
> + case 303:
> + case 307:
> + case 308:
> + redirects++;
> + if (redirects > 3) {
> + warnx("too many redirects");
> + http_get_free(g);
> + return -1;
> + }
> +
> + if ((st = http_head_get("Location", g->head, g->headsz)) ==
> + NULL) {
> + warnx("redirect without location header");
> + return -1;
> + }
> +
> + dodbg("Location: %s", st->val);
> + host = url2host(st->val, , );
> + http_get_free(g);
> + if (host == NULL)
> + return -1;
> + goto again;
> + break;
> + default:
> + code = g->code;
> + break;
> + }
>  
>   /* Copy the body part into our buffer. */
>  
> 
> 
> -- 
> I'm not entirely sure you are real.
> 



[PATCH] remove unused struct member

2018-03-14 Thread Kevin Lo
Hi,

This diff removes an unused member sc_iface_number of the softc.  Ok?

Index: sys/dev/usb/uticom.c
===
RCS file: /cvs/src/sys/dev/usb/uticom.c,v
retrieving revision 1.32
diff -u -p -u -p -r1.32 uticom.c
--- sys/dev/usb/uticom.c8 Apr 2017 02:57:25 -   1.32
+++ sys/dev/usb/uticom.c14 Mar 2018 07:34:55 -
@@ -120,8 +120,6 @@ struct  uticom_softc {
struct usbd_device  *sc_udev;   /* device */
struct usbd_interface   *sc_iface;  /* interface */
 
-   int sc_iface_number; /* interface number */
-
struct usbd_interface   *sc_intr_iface; /* interrupt interface */
int sc_intr_number; /* interrupt number */
struct usbd_pipe*sc_intr_pipe;  /* interrupt pipe */
@@ -271,7 +269,6 @@ uticom_attach_hook(struct device *self)
 
/* Find the bulk out interface used to upload firmware. */
id = usbd_get_interface_descriptor(sc->sc_iface);
-   sc->sc_iface_number = id->bInterfaceNumber;
 
for (i = 0; i < id->bNumEndpoints; i++) {
ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i);
@@ -351,7 +348,6 @@ fwload_done:
 
/* Find the interrupt endpoints. */
id = usbd_get_interface_descriptor(sc->sc_iface);
-   sc->sc_iface_number = id->bInterfaceNumber;
 
for (i = 0; i < id->bNumEndpoints; i++) {
ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i);
@@ -382,7 +378,6 @@ fwload_done:
 
/* Find the bulk{in,out} endpoints. */
id = usbd_get_interface_descriptor(sc->sc_iface);
-   sc->sc_iface_number = id->bInterfaceNumber;
 
for (i = 0; i < id->bNumEndpoints; i++) {
ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i);
Index: sys/dev/usb/uts.c
===
RCS file: /cvs/src/sys/dev/usb/uts.c,v
retrieving revision 1.40
diff -u -p -u -p -r1.40 uts.c
--- sys/dev/usb/uts.c   8 Apr 2017 02:57:25 -   1.40
+++ sys/dev/usb/uts.c   14 Mar 2018 07:34:55 -
@@ -57,7 +57,6 @@ struct uts_softc {
struct device   sc_dev;
struct usbd_device  *sc_udev;
struct usbd_interface   *sc_iface;
-   int sc_iface_number;
int sc_product;
int sc_vendor;
 
@@ -180,7 +179,6 @@ uts_attach(struct device *parent, struct
 
/* Find the interrupt endpoint */
id = usbd_get_interface_descriptor(sc->sc_iface);
-   sc->sc_iface_number = id->bInterfaceNumber;
 
for (i = 0; i < id->bNumEndpoints; i++) {
ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i);
Index: sys/dev/usb/uvscom.c
===
RCS file: /cvs/src/sys/dev/usb/uvscom.c,v
retrieving revision 1.35
diff -u -p -u -p -r1.35 uvscom.c
--- sys/dev/usb/uvscom.c8 Apr 2017 02:57:25 -   1.35
+++ sys/dev/usb/uvscom.c14 Mar 2018 07:34:55 -
@@ -130,7 +130,6 @@ struct  uvscom_softc {
struct device   sc_dev; /* base device */
struct usbd_device  *sc_udev;   /* USB device */
struct usbd_interface   *sc_iface;  /* interface */
-   int sc_iface_number;/* interface number */
 
struct usbd_interface   *sc_intr_iface; /* interrupt interface */
int sc_intr_number; /* interrupt number */
@@ -269,7 +268,6 @@ uvscom_attach(struct device *parent, str
}
 
id = usbd_get_interface_descriptor(sc->sc_iface);
-   sc->sc_iface_number = id->bInterfaceNumber;
 
/* Find endpoints */
for (i = 0; i < id->bNumEndpoints; i++) {



Re: Bugfix: acme-client 301 redirect issue

2018-03-14 Thread Florian Obser
On Wed, Mar 14, 2018 at 01:08:33AM +, Stuart Henderson wrote:
> On 2018/03/11 17:52, Florian Obser wrote:
> > 
> > I think we should just follow the 301.
> 
> I didn't hear back from @letsencrypt_ops about why they were
> issue 301s, but I do agree it makes sense to follow them.

update diff with more redirect status codes and EOL tab fixed

diff --git netproc.c netproc.c
index 26033a3fc3c..ea901a1bda5 100644
--- netproc.c
+++ netproc.c
@@ -180,15 +180,18 @@ nreq(struct conn *c, const char *addr)
 {
struct httpget  *g;
struct sourcesrc[MAX_SERVERS_DNS];
+   struct httphead *st;
char*host, *path;
shortport;
size_t   srcsz;
ssize_t  ssz;
long code;
+   int  redirects = 0;
 
if ((host = url2host(addr, , )) == NULL)
return -1;
 
+again:
if ((ssz = urlresolve(c->dfd, host, src)) < 0) {
free(host);
free(path);
@@ -202,7 +205,36 @@ nreq(struct conn *c, const char *addr)
if (g == NULL)
return -1;
 
-   code = g->code;
+   switch (g->code) {
+   case 301:
+   case 302:
+   case 303:
+   case 307:
+   case 308:
+   redirects++;
+   if (redirects > 3) {
+   warnx("too many redirects");
+   http_get_free(g);
+   return -1;
+   }
+
+   if ((st = http_head_get("Location", g->head, g->headsz)) ==
+   NULL) {
+   warnx("redirect without location header");
+   return -1;
+   }
+
+   dodbg("Location: %s", st->val);
+   host = url2host(st->val, , );
+   http_get_free(g);
+   if (host == NULL)
+   return -1;
+   goto again;
+   break;
+   default:
+   code = g->code;
+   break;
+   }
 
/* Copy the body part into our buffer. */
 


-- 
I'm not entirely sure you are real.