Re: fix xlockmore build with clang

2017-02-02 Thread Matthieu Herrb
On Fri, Feb 03, 2017 at 05:40:47PM +1100, Jonathan Gray wrote:
> On Fri, Feb 03, 2017 at 07:30:17AM +0100, Matthieu Herrb wrote:
> > On Thu, Feb 02, 2017 at 01:45:36PM +1100, Jonathan Gray wrote:
> > > Sync some xlockmore files with the 5.50 release to fix build errors
> > > with clang of the form:
> > 
> > Sure, ok.
> > 
> > I remember I had more changes to make when trying clang from ports on
> > xenocara during g2k16, but it may be that clang got more gcc
> > compatible since then.
> 
> Or upstreams started adding clang fixes?  Either way this was the only
> clang specific change I needed to build all of xenocara on arm64.
> 
> On a related note the xlock upstream seems to have moved:

Yes, ok. It's going to require some effort to merge it though. We've
a lot of local patches to xlock already. I'd rather replace it with
something that doesn't do fancy graphics (or do it with proper
sandboxing).

> 
> Index: 3RDPARTY
> ===
> RCS file: /cvs/xenocara/3RDPARTY,v
> retrieving revision 1.283
> diff -u -p -r1.283 3RDPARTY
> --- 3RDPARTY  21 Jan 2017 16:17:24 -  1.283
> +++ 3RDPARTY  3 Feb 2017 06:37:50 -
> @@ -44,9 +44,9 @@ Archive Site:   http://dejavu-fonts.org/
>  
>  Package: xlockmore
>  Version: 5.22
> -Current Vers:5.47
> -Maintainer:  bagl...@tux.org
> -Archive Site:http://www.tux.org/~bagleyd/latest/
> +Current Vers:5.50
> +Maintainer:  David A. Bagley
> +Archive Site:http://sillycycle.com/xlock/
>  
>  Package: xkeyboard-config
>  Version: 2.19

-- 
Matthieu Herrb


signature.asc
Description: PGP signature


Re: fix xlockmore build with clang

2017-02-02 Thread Jonathan Gray
On Fri, Feb 03, 2017 at 07:30:17AM +0100, Matthieu Herrb wrote:
> On Thu, Feb 02, 2017 at 01:45:36PM +1100, Jonathan Gray wrote:
> > Sync some xlockmore files with the 5.50 release to fix build errors
> > with clang of the form:
> 
> Sure, ok.
> 
> I remember I had more changes to make when trying clang from ports on
> xenocara during g2k16, but it may be that clang got more gcc
> compatible since then.

Or upstreams started adding clang fixes?  Either way this was the only
clang specific change I needed to build all of xenocara on arm64.

On a related note the xlock upstream seems to have moved:

Index: 3RDPARTY
===
RCS file: /cvs/xenocara/3RDPARTY,v
retrieving revision 1.283
diff -u -p -r1.283 3RDPARTY
--- 3RDPARTY21 Jan 2017 16:17:24 -  1.283
+++ 3RDPARTY3 Feb 2017 06:37:50 -
@@ -44,9 +44,9 @@ Archive Site: http://dejavu-fonts.org/
 
 Package:   xlockmore
 Version:   5.22
-Current Vers:  5.47
-Maintainer:bagl...@tux.org
-Archive Site:  http://www.tux.org/~bagleyd/latest/
+Current Vers:  5.50
+Maintainer:David A. Bagley
+Archive Site:  http://sillycycle.com/xlock/
 
 Package:   xkeyboard-config
 Version:   2.19



Re: fix xserver build on arm64

2017-02-02 Thread Matthieu Herrb
On Fri, Feb 03, 2017 at 03:48:10PM +1100, Jonathan Gray wrote:
> Only compile tested.

Looks sane to me. I don't have any hardware to test it on right now
though.

ok.

> 
> Index: configure
> ===
> RCS file: /cvs/xenocara/xserver/configure,v
> retrieving revision 1.63
> diff -u -p -r1.63 configure
> --- configure 11 Oct 2016 22:15:52 -  1.63
> +++ configure 2 Feb 2017 06:52:46 -
> @@ -1075,6 +1075,8 @@ I386_VIDEO_FALSE
>  I386_VIDEO_TRUE
>  HPPA_VIDEO_FALSE
>  HPPA_VIDEO_TRUE
> +ARM64_VIDEO_FALSE
> +ARM64_VIDEO_TRUE
>  ARM_VIDEO_FALSE
>  ARM_VIDEO_TRUE
>  ALPHA_VIDEO_FALSE
> @@ -22439,6 +22441,10 @@ DEFAULT_INT10="x86emu"
>  
>  
>  case $host_cpu in
> +  aarch64*)
> + ARM64_VIDEO=yes
> + GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
> + ;;
>alpha*)
>   ALPHA_VIDEO=yes
>   case $host_os in
> @@ -22543,6 +22549,14 @@ else
>ARM_VIDEO_FALSE=
>  fi
>  
> + if test "x$ARM64_VIDEO" = xyes; then
> +  ARM64_VIDEO_TRUE=
> +  ARM64_VIDEO_FALSE='#'
> +else
> +  ARM64_VIDEO_TRUE='#'
> +  ARM64_VIDEO_FALSE=
> +fi
> +
>   if test "x$HPPA_VIDEO" = xyes; then
>HPPA_VIDEO_TRUE=
>HPPA_VIDEO_FALSE='#'
> @@ -31734,6 +31748,10 @@ Usually this means the macro was only in
>  fi
>  if test -z "${ARM_VIDEO_TRUE}" && test -z "${ARM_VIDEO_FALSE}"; then
>as_fn_error $? "conditional \"ARM_VIDEO\" was never defined.
> +Usually this means the macro was only invoked conditionally." "$LINENO" 5
> +fi
> +if test -z "${ARM64_VIDEO_TRUE}" && test -z "${ARM64_VIDEO_FALSE}"; then
> +  as_fn_error $? "conditional \"ARM64_VIDEO\" was never defined.
>  Usually this means the macro was only invoked conditionally." "$LINENO" 5
>  fi
>  if test -z "${HPPA_VIDEO_TRUE}" && test -z "${HPPA_VIDEO_FALSE}"; then
> Index: configure.ac
> ===
> RCS file: /cvs/xenocara/xserver/configure.ac,v
> retrieving revision 1.57
> diff -u -p -r1.57 configure.ac
> --- configure.ac  13 Aug 2016 14:05:23 -  1.57
> +++ configure.ac  2 Feb 2017 06:52:17 -
> @@ -314,6 +314,10 @@ DEFAULT_INT10="x86emu"
>  dnl Override defaults as needed for specific platforms:
>  
>  case $host_cpu in
> +  aarch64*)
> + ARM64_VIDEO=yes
> + GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
> + ;;
>alpha*)
>   ALPHA_VIDEO=yes
>   case $host_os in
> @@ -391,6 +395,7 @@ AC_SUBST(GLX_ARCH_DEFINES)
>  dnl BSD *_video.c selection
>  AM_CONDITIONAL(ALPHA_VIDEO, [test "x$ALPHA_VIDEO" = xyes])
>  AM_CONDITIONAL(ARM_VIDEO, [test "x$ARM_VIDEO" = xyes])
> +AM_CONDITIONAL(ARM64_VIDEO, [test "x$ARM64_VIDEO" = xyes])
>  AM_CONDITIONAL(HPPA_VIDEO, [test "x$HPPA_VIDEO" = xyes])
>  AM_CONDITIONAL(I386_VIDEO, [test "x$I386_VIDEO" = xyes])
>  AM_CONDITIONAL(LUNA88K_VIDEO, [test "x$LUNA88K_VIDEO" = xyes])
> Index: hw/xfree86/os-support/bsd/Makefile.am
> ===
> RCS file: /cvs/xenocara/xserver/hw/xfree86/os-support/bsd/Makefile.am,v
> retrieving revision 1.19
> diff -u -p -r1.19 Makefile.am
> --- hw/xfree86/os-support/bsd/Makefile.am 16 Sep 2015 19:10:23 -  
> 1.19
> +++ hw/xfree86/os-support/bsd/Makefile.am 2 Feb 2017 06:52:17 -
> @@ -35,6 +35,11 @@ ARCH_SOURCES = arm_video.c \
>   $(srcdir)/../shared/ioperm_noop.c
>  endif
>  
> +if ARM64_VIDEO
> +ARCH_SOURCES = arm64_video.c \
> + $(srcdir)/../shared/ioperm_noop.c
> +endif
> +
>  if HPPA_VIDEO
>  ARCH_SOURCES = hppa_video.c\
>   $(srcdir)/../shared/ioperm_noop.c
> Index: hw/xfree86/os-support/bsd/Makefile.in
> ===
> RCS file: /cvs/xenocara/xserver/hw/xfree86/os-support/bsd/Makefile.in,v
> retrieving revision 1.41
> diff -u -p -r1.41 Makefile.in
> --- hw/xfree86/os-support/bsd/Makefile.in 11 Oct 2016 22:15:56 -  
> 1.41
> +++ hw/xfree86/os-support/bsd/Makefile.in 2 Feb 2017 06:52:17 -
> @@ -76,26 +76,29 @@ libbsd_la_LIBADD =
>  am__libbsd_la_SOURCES_DIST = $(srcdir)/../shared/posix_tty.c \
>   $(srcdir)/../shared/sigio.c $(srcdir)/../shared/vidmem.c \
>   bsd_VTsw.c bsd_init.c bsd_bell.c alpha_video.c bsd_ev56.c \
> - arm_video.c $(srcdir)/../shared/ioperm_noop.c hppa_video.c \
> - i386_video.c luna88k_video.c ppc_video.c sgi_video.c \
> - sparc64_video.c bsd_sbus.c $(srcdir)/../shared/agp_noop.c \
> - bsd_agp.c $(srcdir)/../shared/pm_noop.c $(srcdir)/bsd_apm.c \
> + arm64_video.c $(srcdir)/../shared/ioperm_noop.c arm_video.c \
> + hppa_video.c i386_video.c luna88k_video.c ppc_video.c \
> + sgi_video.c sparc64_video.c bsd_sbus.c \
> + $(srcdir)/../shared/agp_noop.c bsd_agp.c \
> + $(srcdir)/../shared/pm_noop.c $(srcdir)/bsd_apm.c \
>   $(srcdir)/bsd_kqueue_apm.c $(srcdir)/../shared/kmod_noop.c \
>   bsd_kmod.c
> 

Re: fix xlockmore build with clang

2017-02-02 Thread Matthieu Herrb
On Thu, Feb 02, 2017 at 01:45:36PM +1100, Jonathan Gray wrote:
> Sync some xlockmore files with the 5.50 release to fix build errors
> with clang of the form:

Sure, ok.

I remember I had more changes to make when trying clang from ports on
xenocara during g2k16, but it may be that clang got more gcc
compatible since then.

> 
> c++ -c  -DHAVE_CONFIG_H 
> -DDEF_FILESEARCHPATH=\"/usr/X11R6/share/X11/app-defaults/%N%C%S:/usr/X11R6/share/X11/app-defaults/%N%S\"
>  -I. -I.. -I../.. -I/usr/xenocara/app/xlockmore/xlock/ 
> -I/usr/xenocara/app/xlockmore -I/usr/X11R6/include  -I/usr/X11R6/include 
> -I/usr/X11R6/include/freetype2 -I/usr/X11R6/include -I/usr/X11R6/include -g 
> -O2 /usr/xenocara/app/xlockmore/modes/glx/./i_figureeight.cc
> /usr/xenocara/app/xlockmore/modes/glx/./i_figureeight.cc:31:47: error: use of 
> overloaded operator '^' is ambiguous
>   (with operand types 'class TwoJet' and 'int')
>   FigureEight(w, h, du*D(size, 0)*(D(u, 0)^(-1)), form, v),
>~~~^
> Index: modes/glx/i_figureeight.cc
> ===
> RCS file: /cvs/xenocara/app/xlockmore/modes/glx/i_figureeight.cc,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 i_figureeight.cc
> --- modes/glx/i_figureeight.cc26 Nov 2006 11:08:51 -  1.1.1.1
> +++ modes/glx/i_figureeight.cc2 Feb 2017 02:19:08 -
> @@ -28,7 +28,7 @@ TwoJetVec AddFigureEight(ThreeJetVec p, 
>TwoJetVec w = Normalize(Cross(h, du))*(TwoJet(size)*1.1);
>return RotateZ(
>  TwoJetVec(p) +
> -  FigureEight(w, h, du*D(size, 0)*(D(u, 0)^(-1)), form, v),
> +  FigureEight(w, h, du*D(size, 0)*(D(u, 0)^((double)-1)), form, v),
>  v*(1./n_strips)
>);
>  }
> Index: modes/glx/i_sphere.cc
> ===
> RCS file: /cvs/xenocara/app/xlockmore/modes/glx/i_sphere.cc,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 i_sphere.cc
> --- modes/glx/i_sphere.cc 26 Nov 2006 11:08:51 -  1.1.1.1
> +++ modes/glx/i_sphere.cc 2 Feb 2017 02:21:33 -
> @@ -28,16 +28,16 @@ ThreeJet Param1(ThreeJet x) {
>double offset = 0;
>x %= 4;
>if (x > 2) { x = x+(-2); offset = 2; }
> -  if (x <= 1) return x*2 + (x^2)*(-1) + offset;
> -  else return (x^2) + x*(-2) + (2 + offset);
> +  if (x <= 1) return x*2 + (x^(double)2)*(-1) + offset;
> +  else return (x^(double)2) + x*(-2) + (2 + offset);
>  }
>  
>  ThreeJet Param2(ThreeJet x) {
>double offset = 0;
>x %= 4;
>if (x > 2) { x = x+(-2); offset = 2; }
> -  if (x <= 1) return (x^2) + offset;
> -  else return (x^2)*(-1) + x*4 + (-2 + offset);
> +  if (x <= 1) return (x^(double)2) + offset;
> +  else return (x^(double)2)*(-1) + x*4 + (-2 + offset);
>  }
>  
>  static inline ThreeJet TInterp(double x) {
> @@ -48,7 +48,7 @@ ThreeJet UInterp(ThreeJet x) {
>x %= 2;
>if (x > 1)
>  x = x*(-1) + 2;
> -  return (x^2)*3 + (x^3) * (-2);
> +  return (x^(double)2)*3 + (x^(double)3) * (-2);
>  }
>  
>  #define FFPOW 3
> @@ -59,7 +59,7 @@ ThreeJet FFInterp(ThreeJet x) {
>x = x*1.06 + -0.05;
>if (x < 0) return ThreeJet(0, 0, 0);
>else if (x > 1) return ThreeJet(0, 0, 0) + 1;
> -  else return (x ^ (FFPOW-1)) * (FFPOW) + (x^FFPOW) * (-FFPOW+1);
> +  else return (x ^ (double)(FFPOW-1)) * (FFPOW) + (x^(double)FFPOW) * 
> (-FFPOW+1);
>  }
>  
>  #define FSPOW 3
> @@ -67,7 +67,7 @@ ThreeJet FSInterp(ThreeJet x) {
>x %= 2;
>if (x > 1)
>  x = x*(-1) + 2;
> -  return ((x ^ (FSPOW-1)) * (FSPOW) + (x^FSPOW) * (-FSPOW+1)) * (-0.2);
> +  return ((x ^ (double)(FSPOW-1)) * (FSPOW) + (x^(double)FSPOW) * 
> (-FSPOW+1)) * (-0.2);
>  }
>  
>  ThreeJetVec Stage0(ThreeJet u, ThreeJet v) {
> Index: modes/glx/i_threejetvec.cc
> ===
> RCS file: /cvs/xenocara/app/xlockmore/modes/glx/i_threejetvec.cc,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 i_threejetvec.cc
> --- modes/glx/i_threejetvec.cc26 Nov 2006 11:08:51 -  1.1.1.1
> +++ modes/glx/i_threejetvec.cc2 Feb 2017 02:23:09 -
> @@ -63,10 +63,10 @@ ThreeJetVec Normalize(ThreeJetVec v) {
>  
>  ThreeJetVec RotateZ(ThreeJetVec v, ThreeJet angle) {
>ThreeJetVec result;
> -  ThreeJet s,c;
> +  ThreeJet s, c;
>s = Sin (angle);
>c = Cos (angle);
> -  result.x =  v.x*c + v.y*s;
> +  result.x = v.x*c + v.y*s;
>result.y = v.x*s*-1 + v.y*c;
>result.z = v.z;
>return result;
> @@ -79,13 +79,13 @@ ThreeJetVec RotateY(ThreeJetVec v, Three
>c = Cos (angle);
>result.x = v.x*c + v.z*s*-1;
>result.y = v.y;
> -  result.z = v.x*s + v.z*c;
> +  result.z = v.x*s + v.z*c;
>return result;
>  }
>  
>  ThreeJetVec RotateX(ThreeJetVec v, ThreeJet angle) {
>ThreeJetVec result;
> -  ThreeJet s,c;
> +  ThreeJet s, c;
>s = Sin (angle);
>c = Cos (angle);
>result.x = v.x;
> @@ -100,5 +100,5 @@ ThreeJetVec 

fix xserver build on arm64

2017-02-02 Thread Jonathan Gray
Only compile tested.

Index: configure
===
RCS file: /cvs/xenocara/xserver/configure,v
retrieving revision 1.63
diff -u -p -r1.63 configure
--- configure   11 Oct 2016 22:15:52 -  1.63
+++ configure   2 Feb 2017 06:52:46 -
@@ -1075,6 +1075,8 @@ I386_VIDEO_FALSE
 I386_VIDEO_TRUE
 HPPA_VIDEO_FALSE
 HPPA_VIDEO_TRUE
+ARM64_VIDEO_FALSE
+ARM64_VIDEO_TRUE
 ARM_VIDEO_FALSE
 ARM_VIDEO_TRUE
 ALPHA_VIDEO_FALSE
@@ -22439,6 +22441,10 @@ DEFAULT_INT10="x86emu"
 
 
 case $host_cpu in
+  aarch64*)
+   ARM64_VIDEO=yes
+   GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
+   ;;
   alpha*)
ALPHA_VIDEO=yes
case $host_os in
@@ -22543,6 +22549,14 @@ else
   ARM_VIDEO_FALSE=
 fi
 
+ if test "x$ARM64_VIDEO" = xyes; then
+  ARM64_VIDEO_TRUE=
+  ARM64_VIDEO_FALSE='#'
+else
+  ARM64_VIDEO_TRUE='#'
+  ARM64_VIDEO_FALSE=
+fi
+
  if test "x$HPPA_VIDEO" = xyes; then
   HPPA_VIDEO_TRUE=
   HPPA_VIDEO_FALSE='#'
@@ -31734,6 +31748,10 @@ Usually this means the macro was only in
 fi
 if test -z "${ARM_VIDEO_TRUE}" && test -z "${ARM_VIDEO_FALSE}"; then
   as_fn_error $? "conditional \"ARM_VIDEO\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${ARM64_VIDEO_TRUE}" && test -z "${ARM64_VIDEO_FALSE}"; then
+  as_fn_error $? "conditional \"ARM64_VIDEO\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${HPPA_VIDEO_TRUE}" && test -z "${HPPA_VIDEO_FALSE}"; then
Index: configure.ac
===
RCS file: /cvs/xenocara/xserver/configure.ac,v
retrieving revision 1.57
diff -u -p -r1.57 configure.ac
--- configure.ac13 Aug 2016 14:05:23 -  1.57
+++ configure.ac2 Feb 2017 06:52:17 -
@@ -314,6 +314,10 @@ DEFAULT_INT10="x86emu"
 dnl Override defaults as needed for specific platforms:
 
 case $host_cpu in
+  aarch64*)
+   ARM64_VIDEO=yes
+   GLX_ARCH_DEFINES="-D__GLX_ALIGN64"
+   ;;
   alpha*)
ALPHA_VIDEO=yes
case $host_os in
@@ -391,6 +395,7 @@ AC_SUBST(GLX_ARCH_DEFINES)
 dnl BSD *_video.c selection
 AM_CONDITIONAL(ALPHA_VIDEO, [test "x$ALPHA_VIDEO" = xyes])
 AM_CONDITIONAL(ARM_VIDEO, [test "x$ARM_VIDEO" = xyes])
+AM_CONDITIONAL(ARM64_VIDEO, [test "x$ARM64_VIDEO" = xyes])
 AM_CONDITIONAL(HPPA_VIDEO, [test "x$HPPA_VIDEO" = xyes])
 AM_CONDITIONAL(I386_VIDEO, [test "x$I386_VIDEO" = xyes])
 AM_CONDITIONAL(LUNA88K_VIDEO, [test "x$LUNA88K_VIDEO" = xyes])
Index: hw/xfree86/os-support/bsd/Makefile.am
===
RCS file: /cvs/xenocara/xserver/hw/xfree86/os-support/bsd/Makefile.am,v
retrieving revision 1.19
diff -u -p -r1.19 Makefile.am
--- hw/xfree86/os-support/bsd/Makefile.am   16 Sep 2015 19:10:23 -  
1.19
+++ hw/xfree86/os-support/bsd/Makefile.am   2 Feb 2017 06:52:17 -
@@ -35,6 +35,11 @@ ARCH_SOURCES = arm_video.c \
$(srcdir)/../shared/ioperm_noop.c
 endif
 
+if ARM64_VIDEO
+ARCH_SOURCES = arm64_video.c \
+   $(srcdir)/../shared/ioperm_noop.c
+endif
+
 if HPPA_VIDEO
 ARCH_SOURCES = hppa_video.c\
$(srcdir)/../shared/ioperm_noop.c
Index: hw/xfree86/os-support/bsd/Makefile.in
===
RCS file: /cvs/xenocara/xserver/hw/xfree86/os-support/bsd/Makefile.in,v
retrieving revision 1.41
diff -u -p -r1.41 Makefile.in
--- hw/xfree86/os-support/bsd/Makefile.in   11 Oct 2016 22:15:56 -  
1.41
+++ hw/xfree86/os-support/bsd/Makefile.in   2 Feb 2017 06:52:17 -
@@ -76,26 +76,29 @@ libbsd_la_LIBADD =
 am__libbsd_la_SOURCES_DIST = $(srcdir)/../shared/posix_tty.c \
$(srcdir)/../shared/sigio.c $(srcdir)/../shared/vidmem.c \
bsd_VTsw.c bsd_init.c bsd_bell.c alpha_video.c bsd_ev56.c \
-   arm_video.c $(srcdir)/../shared/ioperm_noop.c hppa_video.c \
-   i386_video.c luna88k_video.c ppc_video.c sgi_video.c \
-   sparc64_video.c bsd_sbus.c $(srcdir)/../shared/agp_noop.c \
-   bsd_agp.c $(srcdir)/../shared/pm_noop.c $(srcdir)/bsd_apm.c \
+   arm64_video.c $(srcdir)/../shared/ioperm_noop.c arm_video.c \
+   hppa_video.c i386_video.c luna88k_video.c ppc_video.c \
+   sgi_video.c sparc64_video.c bsd_sbus.c \
+   $(srcdir)/../shared/agp_noop.c bsd_agp.c \
+   $(srcdir)/../shared/pm_noop.c $(srcdir)/bsd_apm.c \
$(srcdir)/bsd_kqueue_apm.c $(srcdir)/../shared/kmod_noop.c \
bsd_kmod.c
-@ALPHA_VIDEO_FALSE@@ARM_VIDEO_FALSE@@HPPA_VIDEO_FALSE@@I386_VIDEO_FALSE@@LUNA88K_VIDEO_FALSE@@PPC_VIDEO_FALSE@@SGI_VIDEO_FALSE@@SPARC64_VIDEO_TRUE@am__objects_1
 = sparc64_video.lo \
-@ALPHA_VIDEO_FALSE@@ARM_VIDEO_FALSE@@HPPA_VIDEO_FALSE@@I386_VIDEO_FALSE@@LUNA88K_VIDEO_FALSE@@PPC_VIDEO_FALSE@@SGI_VIDEO_FALSE@@SPARC64_VIDEO_TRUE@
bsd_sbus.lo \

Update perl to 5.24.1

2017-02-02 Thread Andrew Fresh
It looks like I'm about ready to import perl 5.24.1 into base with
updated local patches.

The infrastructure to do that is still here on github:

https://github.com/afresh1/OpenBSD-perl/

You can download a pre-patched perl from here and use it to replace
src/gnu/usr.bin/perl and update your system.

http://cvs.afresh1.com/~andrew/OpenBSD-perl-5.24.1.tar.gz

Unfortunately picked up a cold or something this week, but expect to
feel well enough by this weekend to import it.  

Looking forward to any feedback.

l8rZ,
-- 
andrew - http://afresh1.com

Life's unfair - but root password helps!



net80211: fix bogus rateset in assoc requests in 11b mode

2017-02-02 Thread Stefan Sperling
I noticed that an 11a/b ath(4) card, which does not support 11g,
includes 11g rates ("xrates") in association requests it sends on 2GHz:

20:55:03.490128 802.11 flags=0<>: association request, \
caps=2041, ssid (stsp.name), \
rates 1M* 2M* 5M 6M 9M 11M 12M 18M, xrates 24M 36M 48M 54M, \
rsn 0x010fac04010fac04010fac02, \


This is wrong. On 2GHz this client should only advertise 11b rates,
i.e. rates up to and including 11M.

This happens because invalid rates are not discarded from ni->ni_rates
early enough. By default this rateset includes the 11a rates (which
overlap with 11g ones). ieee80211_get_assoc_req() copies rateset
information from ni->ni_rates and includes these bogus rates.

To fix this, call ieee80211_fix_rate() after choosing an AP.
The most important flag parameter here is DODEL which removes invalid rates.
DODEL only takes effect if DOSORT and DONEGO are also set, so just pass
all the flags.

Now this client sends a proper 11b rateset in its assoc request:

21:49:36.934631 802.11 flags=0<>: association request, \
caps=2041, ssid (stsp.name), \
rates 1M* 2M* 5M 11M, rsn 0x010fac04010fac04010fac02, \


Note that rates get fixed up again after association is confirmed,
via ieee80211_recv_assoc_resp() -> ieee80211_setup_rates().
Which is why 11b clients were already working fine in spite of sending
a bogus rateset in the association request.

Index: ieee80211_node.c
===
RCS file: /cvs/src/sys/net80211/ieee80211_node.c,v
retrieving revision 1.113
diff -u -p -r1.113 ieee80211_node.c
--- ieee80211_node.c2 Feb 2017 16:47:53 -   1.113
+++ ieee80211_node.c2 Feb 2017 20:50:36 -
@@ -676,6 +676,12 @@ ieee80211_end_scan(struct ifnet *ifp)
 
ic->ic_curmode = ieee80211_chan2mode(ic, ni->ni_chan);
 
+   /* Make sure we send valid rates in an association request. */
+   if (ic->ic_opmode == IEEE80211_M_STA)
+   ieee80211_fix_rate(ic, ni,
+   IEEE80211_F_DOSORT | IEEE80211_F_DOFRATE |
+   IEEE80211_F_DONEGO | IEEE80211_F_DODEL);
+
if (ic->ic_flags & IEEE80211_F_RSNON)
ieee80211_choose_rsnparams(ic);
else if (ic->ic_flags & IEEE80211_F_WEPON)



Re: dhcpd.conf(5): "domain name" -> "hostname" for next-server option

2017-02-02 Thread Theo Buehler
On Wed, Jan 11, 2017 at 09:30:15PM +0100, Theo Buehler wrote:
> The TOK_NEXT_SERVER case in parse_statement() calls 
> parse_ip_addr_or_hostname(),
> so I think the next-server option wants a host name, not a domain name:

Any takers? I previously suggested 'host name', but the rest of the page
writes 'hostname', so let's go with that.

> 
> Index: dhcpd.conf.5
> ===
> RCS file: /var/cvs/src/usr.sbin/dhcpd/dhcpd.conf.5,v
> retrieving revision 1.17
> diff -u -p -U7 -r1.17 dhcpd.conf.5
> --- dhcpd.conf.5  11 Jun 2015 12:48:32 -  1.17
> +++ dhcpd.conf.5  10 Jan 2017 15:07:27 -
> @@ -645,15 +645,15 @@ statement
>  The
>  .Ic next-server
>  statement is used to specify the host address of
>  the server from which the initial boot file (specified in the
>  .Ic filename
>  statement) is to be loaded.
>  .Ar server-name
> -should be a numeric IP address or a domain name.
> +should be a numeric IP address or a hostname.
>  If no
>  .Ic next-server
>  parameter applies to a given client, the DHCP server's IP address is used.
>  .Pp
>  The
>  .Ic fixed-address
>  statement
> 



Re: make sosetopt responsible for m_free

2017-02-02 Thread David Hill
On Thu, Feb 02, 2017 at 09:34:07AM +0100, Martin Pieuchot wrote:
> On 01/02/17(Wed) 19:27, David Hill wrote:
> > Hello -
> > 
> > This diff makes sosetopt responsible for m_free which is much simpler.
> > Requested by bluhm@ 
> 
> I'd suggest to move the m_free(9) calls to sys_setsockopt().  This
> simplifies the existing code even more and will make it easier to use
> the stack for this temporary storage.
> 

New diff with mpi@'s suggestion. 

Index: kern/uipc_socket.c
===
RCS file: /cvs/src/sys/kern/uipc_socket.c,v
retrieving revision 1.176
diff -u -p -r1.176 uipc_socket.c
--- kern/uipc_socket.c  1 Feb 2017 20:59:47 -   1.176
+++ kern/uipc_socket.c  2 Feb 2017 16:59:45 -
@@ -1551,16 +1551,15 @@ sowwakeup(struct socket *so)
 }
 
 int
-sosetopt(struct socket *so, int level, int optname, struct mbuf *m0)
+sosetopt(struct socket *so, int level, int optname, struct mbuf *m)
 {
int s, error = 0;
-   struct mbuf *m = m0;
 
if (level != SOL_SOCKET) {
if (so->so_proto && so->so_proto->pr_ctloutput) {
NET_LOCK(s);
error = (*so->so_proto->pr_ctloutput)(PRCO_SETOPT, so,
-   level, optname, m0);
+   level, optname, m);
NET_UNLOCK(s);
return (error);
}
@@ -1707,7 +1706,7 @@ sosetopt(struct socket *so, int level, i
level = dom->dom_protosw->pr_protocol;
NET_LOCK(s);
error = (*so->so_proto->pr_ctloutput)
-   (PRCO_SETOPT, so, level, optname, m0);
+   (PRCO_SETOPT, so, level, optname, m);
NET_UNLOCK(s);
return (error);
}
@@ -1739,14 +1738,11 @@ sosetopt(struct socket *so, int level, i
if (error == 0 && so->so_proto && so->so_proto->pr_ctloutput) {
NET_LOCK(s);
(*so->so_proto->pr_ctloutput)(PRCO_SETOPT, so,
-   level, optname, m0);
+   level, optname, m);
NET_UNLOCK(s);
-   m = NULL;   /* freed by protocol */
}
}
 bad:
-   if (m)
-   (void) m_free(m);
return (error);
 }
 
Index: kern/uipc_syscalls.c
===
RCS file: /cvs/src/sys/kern/uipc_syscalls.c,v
retrieving revision 1.148
diff -u -p -r1.148 uipc_syscalls.c
--- kern/uipc_syscalls.c26 Jan 2017 01:58:00 -  1.148
+++ kern/uipc_syscalls.c2 Feb 2017 16:59:45 -
@@ -962,19 +962,13 @@ sys_setsockopt(struct proc *p, void *v, 
goto bad;
}
}
-   if (m == NULL) {
-   error = ENOBUFS;
-   goto bad;
-   }
error = copyin(SCARG(uap, val), mtod(m, caddr_t),
SCARG(uap, valsize));
-   if (error) {
+   if (error)
goto bad;
-   }
m->m_len = SCARG(uap, valsize);
}
error = sosetopt(fp->f_data, SCARG(uap, level), SCARG(uap, name), m);
-   m = NULL;
 bad:
m_freem(m);
FRELE(fp, p);
Index: net/rtsock.c
===
RCS file: /cvs/src/sys/net/rtsock.c,v
retrieving revision 1.222
diff -u -p -r1.222 rtsock.c
--- net/rtsock.c1 Feb 2017 20:59:47 -   1.222
+++ net/rtsock.c2 Feb 2017 16:59:45 -
@@ -240,12 +240,8 @@ route_ctloutput(int op, struct socket *s
int error = 0;
unsigned int tid;
 
-   if (level != AF_ROUTE) {
-   error = EINVAL;
-   if (op == PRCO_SETOPT && m)
-   m_free(m);
-   return (error);
-   }
+   if (level != AF_ROUTE)
+   return EINVAL;
 
switch (op) {
case PRCO_SETOPT:
@@ -271,7 +267,6 @@ route_ctloutput(int op, struct socket *s
error = ENOPROTOOPT;
break;
}
-   m_free(m);
break;
case PRCO_GETOPT:
switch (optname) {
Index: netinet/ip_mroute.c
===
RCS file: /cvs/src/sys/netinet/ip_mroute.c,v
retrieving revision 1.108
diff -u -p -r1.108 ip_mroute.c
--- netinet/ip_mroute.c 1 Feb 2017 20:59:47 -   1.108
+++ netinet/ip_mroute.c 2 Feb 2017 16:59:46 -
@@ -209,7 +209,6 @@ ip_mrouter_set(struct socket *so, int op
break;
}
 
-   m_free(m);
return (error);
 }
 
Index: 

Re: Add quirks to support M-Audio FastTrack Pro (uaudio)

2017-02-02 Thread Martin Pieuchot
On 31/01/17(Tue) 14:05, Christopher Zimmermann wrote:
> On 2017-01-29 Martin Pieuchot  wrote:
> > On 29/01/17(Sun) 19:33, Christopher Zimmermann wrote:
> > > [...]
> > > @@ -444,6 +447,11 @@ uaudio_match(struct device *parent, void
> > >   if (uaa->iface == NULL || uaa->device == NULL)
> > >   return (UMATCH_NONE);
> > >  
> > > + if (uaa->vendor == USB_VENDOR_MAUDIO &&
> > > + uaa->product == USB_PRODUCT_MAUDIO_FASTTRACKPRO &&
> > > + uaa->configno != 2)
> > > + return UMATCH_NONE;  
> > 
> > Why to you need this?
> 
> This device exposes only a very limited set of features in
> configuration 1.

But configuration 1 is midi not audio right?  So it won't match, so why
do you need that?

> > > @@ -3312,6 +3340,9 @@ uaudio_set_params(void *addr, int setmod
> > >   }
> > >   break;
> > >   }
> > > +
> > > + if (sc->sc_quirks & UAUDIO_FLAG_BE)
> > > + p->encoding = AUDIO_ENCODING_SLINEAR_BE;  
> > 
> > Why do you need this chunk and we don't need to set
> > AUDIO_ENCODING_SLINEAR_LE in the other case?
> 
> We probably should set it to _LE in the other case. I moved this piece
> of code into uaudio_match_alt() and made it agnostic about the specific 
> endianness.
> 
> > > @@ -152,6 +153,11 @@ umidi_match(struct device *parent, void 
> > >   DPRINTFN(1,("umidi_match\n"));
> > >  
> > >   if (uaa->iface == NULL)
> > > + return UMATCH_NONE;
> > > +
> > > + if (uaa->vendor == USB_VENDOR_MAUDIO &&
> > > + uaa->product == USB_PRODUCT_MAUDIO_FASTTRACKPRO &&
> > > + uaa->configno != 2)
> > >   return UMATCH_NONE;  
> > 
> > I'd leave the configno check out and add a comment explaining why we
> > want to force this driver to attach to uaudio(4).
> 
> See my comment above about the same piece of code in uaudio.c.
> If I don't add this condition umidi will attach to configuration 1 and
> configuration 2 wouldn't be tried, uaudio wouldn't attach.

Please re-read my comment.  I'm talking about the "configno" check.
Think about somebody reading your code in 5 years, it will just looks
like black magic.

What you're doing is working around our stupid USB detection mechanism
to use a specific configuration.  So you don't want your device to
attach to umidi(4) no matter with which configuration.

> + if (p->precision > 8)
> + /*
> +  * Don't search for matching encoding.
> +  * Just tell the upper layers which one we support.
> +  */
> + p->encoding = sc->sc_alts[i].encoding;

Why do you need that?

> + else if (p->encoding != sc->sc_alts[i].encoding)
> + continue;
> +
>   alts_eh |= 1 << i;
>   DPRINTFN(6,("%s: matched %s alt %d for enc/pre\n", __func__,
>   mode == AUMODE_RECORD ? "rec" : "play", i));



Re: make sosetopt responsible for m_free

2017-02-02 Thread Martin Pieuchot
On 01/02/17(Wed) 19:27, David Hill wrote:
> Hello -
> 
> This diff makes sosetopt responsible for m_free which is much simpler.
> Requested by bluhm@ 

I'd suggest to move the m_free(9) calls to sys_setsockopt().  This
simplifies the existing code even more and will make it easier to use
the stack for this temporary storage.

> 
> Index: kern/uipc_socket.c
> ===
> RCS file: /cvs/src/sys/kern/uipc_socket.c,v
> retrieving revision 1.176
> diff -u -p -r1.176 uipc_socket.c
> --- kern/uipc_socket.c1 Feb 2017 20:59:47 -   1.176
> +++ kern/uipc_socket.c2 Feb 2017 00:13:23 -
> @@ -1562,6 +1562,7 @@ sosetopt(struct socket *so, int level, i
>   error = (*so->so_proto->pr_ctloutput)(PRCO_SETOPT, so,
>   level, optname, m0);
>   NET_UNLOCK(s);
> + m_free(m0);
>   return (error);
>   }
>   error = ENOPROTOOPT;
> @@ -1709,6 +1710,7 @@ sosetopt(struct socket *so, int level, i
>   error = (*so->so_proto->pr_ctloutput)
>   (PRCO_SETOPT, so, level, optname, m0);
>   NET_UNLOCK(s);
> + m_free(m0);
>   return (error);
>   }
>   error = ENOPROTOOPT;
> @@ -1741,7 +1743,8 @@ sosetopt(struct socket *so, int level, i
>   (*so->so_proto->pr_ctloutput)(PRCO_SETOPT, so,
>   level, optname, m0);
>   NET_UNLOCK(s);
> - m = NULL;   /* freed by protocol */
> + m_free(m0);
> + m = NULL;
>   }
>   }
>  bad:
> Index: net/rtsock.c
> ===
> RCS file: /cvs/src/sys/net/rtsock.c,v
> retrieving revision 1.222
> diff -u -p -r1.222 rtsock.c
> --- net/rtsock.c  1 Feb 2017 20:59:47 -   1.222
> +++ net/rtsock.c  2 Feb 2017 00:13:23 -
> @@ -240,12 +240,8 @@ route_ctloutput(int op, struct socket *s
>   int error = 0;
>   unsigned int tid;
>  
> - if (level != AF_ROUTE) {
> - error = EINVAL;
> - if (op == PRCO_SETOPT && m)
> - m_free(m);
> - return (error);
> - }
> + if (level != AF_ROUTE)
> + return EINVAL;
>  
>   switch (op) {
>   case PRCO_SETOPT:
> @@ -271,7 +267,6 @@ route_ctloutput(int op, struct socket *s
>   error = ENOPROTOOPT;
>   break;
>   }
> - m_free(m);
>   break;
>   case PRCO_GETOPT:
>   switch (optname) {
> Index: netinet/ip_mroute.c
> ===
> RCS file: /cvs/src/sys/netinet/ip_mroute.c,v
> retrieving revision 1.108
> diff -u -p -r1.108 ip_mroute.c
> --- netinet/ip_mroute.c   1 Feb 2017 20:59:47 -   1.108
> +++ netinet/ip_mroute.c   2 Feb 2017 00:13:23 -
> @@ -209,7 +209,6 @@ ip_mrouter_set(struct socket *so, int op
>   break;
>   }
>  
> - m_free(m);
>   return (error);
>  }
>  
> Index: netinet/ip_output.c
> ===
> RCS file: /cvs/src/sys/netinet/ip_output.c,v
> retrieving revision 1.335
> diff -u -p -r1.335 ip_output.c
> --- netinet/ip_output.c   1 Feb 2017 20:59:47 -   1.335
> +++ netinet/ip_output.c   2 Feb 2017 00:13:23 -
> @@ -853,11 +853,10 @@ ip_ctloutput(int op, struct socket *so, 
>   int error = 0;
>   u_int rtid = 0;
>  
> - if (level != IPPROTO_IP) {
> - error = EINVAL;
> - if (op == PRCO_SETOPT)
> - (void) m_free(m);
> - } else switch (op) {
> + if (level != IPPROTO_IP)
> + return EINVAL;
> + 
> + switch (op) {
>   case PRCO_SETOPT:
>   switch (optname) {
>   case IP_OPTIONS:
> @@ -1073,7 +1072,6 @@ ip_ctloutput(int op, struct socket *so, 
>   error = ENOPROTOOPT;
>   break;
>   }
> - m_free(m);
>   break;
>  
>   case PRCO_GETOPT:
> @@ -1235,12 +1233,11 @@ ip_pcbopts(struct mbuf **pcbopt, struct 
>  
>   /* turn off any old options */
>   m_free(*pcbopt);
> - *pcbopt = 0;
> + *pcbopt = NULL;
>   if (m == NULL || m->m_len == 0) {
>   /*
>* Only turning off any previous options.
>*/
> - m_free(m);
>   return (0);
>   }
>  
> @@ -1316,7 +1313,6 @@ ip_pcbopts(struct mbuf **pcbopt, struct 
>   return (0);
>  
>  bad:
> - (void)m_free(m);
>   return (EINVAL);
>  }
>  
> Index: netinet/raw_ip.c
> 

Re: ip6_ours()

2017-02-02 Thread Martin Pieuchot
On 01/02/17(Wed) 20:48, Alexander Bluhm wrote:
> Hi,
> 
> I would like to make ip6_input() more like ipv4_input() and introduce
> ip6_ours().
> 
> ok?

This will help making v6 forwarding path un-KERNEL_LOCK()'d, ok mpi@

> Index: netinet6/ip6_input.c
> ===
> RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/ip6_input.c,v
> retrieving revision 1.175
> diff -u -p -r1.175 ip6_input.c
> --- netinet6/ip6_input.c  29 Jan 2017 19:58:47 -  1.175
> +++ netinet6/ip6_input.c  1 Feb 2017 19:42:15 -
> @@ -120,9 +120,9 @@ struct niqueue ip6intrq = NIQUEUE_INITIA
>  struct ip6stat ip6stat;
>  
>  int ip6_check_rh0hdr(struct mbuf *, int *);
> -
>  int ip6_hbhchcheck(struct mbuf *, int *, int *, int *);
>  int ip6_hopopts_input(u_int32_t *, u_int32_t *, struct mbuf **, int *);
> +void ip6_ours(struct mbuf *, int, int);
>  struct mbuf *ip6_pullexthdr(struct mbuf *, size_t, int);
>  
>  static struct mbuf_queue ip6send_mq;
> @@ -179,9 +179,8 @@ ip6_input(struct mbuf *m)
>   struct ip6_hdr *ip6;
>   struct sockaddr_in6 sin6;
>   struct rtentry *rt = NULL;
> - int off, nest;
> + int off, nxt, ours = 0;
>   u_int16_t src_scope, dst_scope;
> - int nxt, ours = 0;
>  #if NPF > 0
>   struct in6_addr odst;
>  #endif
> @@ -214,8 +213,7 @@ ip6_input(struct mbuf *m)
>   if (m->m_len < sizeof(struct ip6_hdr)) {
>   if ((m = m_pullup(m, sizeof(struct ip6_hdr))) == NULL) {
>   ip6stat.ip6s_toosmall++;
> - if_put(ifp);
> - return;
> + goto out;
>   }
>   }
>  
> @@ -353,9 +351,7 @@ ip6_input(struct mbuf *m)
>   ip6_check_rh0hdr(m, )) {
>   ip6stat.ip6s_badoptions++;
>   icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, off);
> - /* m is already freed */
> - if_put(ifp);
> - return;
> + goto out;
>   }
>  
>   if (IN6_IS_ADDR_LOOPBACK(>ip6_src) ||
> @@ -391,11 +387,8 @@ ip6_input(struct mbuf *m)
>  
>  #ifdef MROUTING
>   if (ip6_mforwarding && ip6_mrouter) {
> - if (ip6_hbhchcheck(m, , , )) {
> - rtfree(rt);
> - if_put(ifp);
> - return; /* m have already been freed */
> - }
> + if (ip6_hbhchcheck(m, , , ))
> + goto out;
>  
>   ip6 = mtod(m, struct ip6_hdr *);
>  
> @@ -407,14 +400,15 @@ ip6_input(struct mbuf *m)
>* ip6_mforward() returns a non-zero value, the packet
>* must be discarded, else it may be accepted below.
>*/
> - if (ip6_mforward(ip6, ifp, m)) {
> + if (ip6_mforward(ip6, ifp, m)) {
>   ip6stat.ip6s_cantforward++;
>   goto bad;
>   }
>  
>   if (!ours)
>   goto bad;
> - goto ours;
> + ip6_ours(m, off, nxt);
> + goto out;
>   }
>  #endif
>   if (!ours) {
> @@ -484,36 +478,39 @@ ip6_input(struct mbuf *m)
>  
>hbhcheck:
>  
> - if (ip6_hbhchcheck(m, , , )) {
> - rtfree(rt);
> - if_put(ifp);
> - return; /* m have already been freed */
> - }
> + if (ip6_hbhchcheck(m, , , ))
> + goto out;
>  
> - /* adjust pointer */
> - ip6 = mtod(m, struct ip6_hdr *);
> + if (ours) {
> + ip6_ours(m, off, nxt);
> + goto out;
> + }
>  
>   /*
>* Forward if desirable.
>*/
> - if (!ours) {
> - ip6_forward(m, rt, srcrt);
> - if_put(ifp);
> - return;
> - }
> -#ifdef MROUTING
> -  ours:
> -#endif
> + ip6_forward(m, rt, srcrt);
> + if_put(ifp);
> + return;
> + bad:
> + m_freem(m);
> + out:
> + rtfree(rt);
> + if_put(ifp);
> +}
> +
> +void
> +ip6_ours(struct mbuf *m, int off, int nxt)
> +{
> + int nest = 0;
> +
>   /* pf might have changed things */
>   in6_proto_cksum_out(m, NULL);
>  
> - ip6 = mtod(m, struct ip6_hdr *);
> -
>   /*
>* Tell launch routine the next header
>*/
>   ip6stat.ip6s_delivered++;
> - nest = 0;
>  
>   while (nxt != IPPROTO_DONE) {
>   if (ip6_hdrnestlimit && (++nest > ip6_hdrnestlimit)) {
> @@ -543,12 +540,8 @@ ip6_input(struct mbuf *m)
>  
>   nxt = (*inet6sw[ip6_protox[nxt]].pr_input)(, , nxt);
>   }
> - rtfree(rt);
> - if_put(ifp);
>   return;
>   bad:
> - rtfree(rt);
> - if_put(ifp);
>   m_freem(m);
>  }
>  
>