Re: WireGuard, keepalive time doubled?

2021-04-15 Thread Jan Johansson
Alexander Hall  wrote:
> > Is this to be expected or am I missing something?
> > 
> > Both sides run OpenBSD 6.8 amd64 if that affects anything.
> 
> Just a random thought; are you running on actual hardware or
> testing with some sort of virtualization involved? VMM and
> friends are known to sometimes double delays...

That would be it, the side with wgpka set is a virutal machine
running on a OpenBSD 6.8 host.

I will just stick with the documented suggestion of 25 (which
gives me 50 seconds) and works well with the default of 60
seconds for PF udp.multiple states.

Thanks a lot!



How to split (A/B) test landing pages using httpd(8)

2021-04-15 Thread Clint Pachl
Does anyone know if it's possible to rotate/alternate between two
files for the same given request path, using just httpd?

For example, I want to split test two pages: /test/A & /test/B. I would
like to serve half of the traffic to each for the request path /test/.

Ideally, I would like to do an internal rewrite of the request. And be
able to log which file was actually served to the client.

Here's what I have so far, but I would like to avoid the redirect and
URL change on the client.

# httpd.conf: A/B test

location "/test/*[0-4]" {
request rewrite "/test/A"
}
location "/test/*[5-9]" {
request rewrite "/test/B"
}
location "/test/" {
block return 302 "$DOCUMENT_URI$REMOTE_PORT"
}


I'm using OpenBSD 6.8. I see there is a "not found" directive in 6.9.
Maybe something like that could provide possibilities?



Re: WireGuard, keepalive time doubled?

2021-04-15 Thread Alexander Hall
On Wed, Apr 14, 2021 at 01:14:47PM +0200, Jan Johansson wrote:
> Hello!
> 
> I was experimenting with wireguard keepalive and noticed that
> keepalive packets seems to be sent on double the time that I have
> set which I find a bit unintuitive.
> 

...

> 
> Is this to be expected or am I missing something?
> 
> Both sides run OpenBSD 6.8 amd64 if that affects anything.

Just a random thought; are you running on actual hardware or testing
with some sort of virtualization involved? VMM and friends are known
to sometimes double delays...

/Alexander



Re: TouchPad, right clicking, and cwm

2021-04-15 Thread mgraves
There is probably a better way, but I use the following script run from my 
.xsession file.  This works for almost everything except for Chrome.  For 
Chrome the scrolling is still non-natural.
 

Script XFixMouse.sh
-
#!/bin/sh

#ID Button
#-
#1  Left click
#2  Middle click
#3  Right click
#4  Wheel up
#5  Wheel down
#6  Wheel left
#7  Wheel right
#8  Thumb1
#9  Thumb2
#10 ExtBt7
#11 ExtBt8

DEV=`xinput --list | grep wsmouse0 | sed -r 's/.*id=([0-9]+).*/\1/'`
if [ ! -z $DEV ]; then
# swap right and left mouse buttons and change scrolling to "natural"
xinput set-button-map $DEV 3 2 1 5 4 6 7 8 9 10 11 12
fi



Regards



Re: TouchPad, right clicking, and cwm

2021-04-15 Thread Ulf Brosziewski
Could you remove the "ClickPad" option from the configuration file and
try two-finger clicks again?

The combination of that option with the "ClickFinger" mechanism is broken,
and you probably don't need it if you don't use "soft-button areas".

Three-finger clicks should work - if your hardware detects the number of
fingers reliably.


On 4/14/21 11:42 PM, tetrahe...@danwin1210.me wrote:
> Hi,
> I'm trying to get my TouchPad/trackpad to right click. I put the following in 
> my /etc/X11/xorg.conf.d/70-synaptics.conf:
> 
> Section "InputClass"
> Identifier "touchpad"
> Driver "synaptics"
> MatchIsTouchpad "on"
> Option "ClickPad" "on"
> Option "VertEdgeScroll" "off"
> Option "VertTwoFingerScroll" "on"
> Option "ClickFinger2" "2"
> Option "ClickFinger3" "3"
> EndSection
> 
> However, this was not enough to get two- or three-finger clicking working.
> 
> I'd even be satisfied with Ctrl-Click mapping to right-click.
> 
> Has anyone got any ideas how to make either option work?
> 



libedit history size required

2021-04-15 Thread Björn Gohla


hi all,

i came across this little problem when using the edit library
(https://github.com/openbsd/src/tree/master/lib/libedit): when using the
history facility one needs to explicitly set a size, e.g., 

history(hist, , H_SETSIZE, 100);

otherwise history will not work. the man page history(3) makes no
mention of this fact. this leads me to three questions:

0. is this an oversight or by design?
1. shouldn't this requirement be documented?
2. shouldn't there be a reasonable default?

if the answers to 1. or 2. are yes, i'd be willing to send patches.

--
cheers,
björn



Re: pkg_add fails: 6.9 no such directory

2021-04-15 Thread Stefan Sperling
On Thu, Apr 15, 2021 at 09:25:31PM +0100, Björn Gohla wrote:
> 
> hi all,
> 
> i'm on 6.9 current. installing any package (example below) fails since there 
> is
> apparently no 6.9 release directory. what am i doin wrong?
> 
> thanks for any hints.

Try again like this: pkg_add -Dsnap gbc
This forces installation from snapshots/packages instead of 6.9/packages.

> titanic# pkg_add gbc
> https://cdn.openbsd.org/pub/OpenBSD/6.9/packages/amd64/: no such dir
> Can't find gbc



pkg_add fails: 6.9 no such directory

2021-04-15 Thread Björn Gohla


hi all,

i'm on 6.9 current. installing any package (example below) fails since there is
apparently no 6.9 release directory. what am i doin wrong?

thanks for any hints.

---

titanic# pkg_add gbc
https://cdn.openbsd.org/pub/OpenBSD/6.9/packages/amd64/: no such dir
Can't find gbc
titanic# uname  -a
OpenBSD titanic.my.domain 6.9 GENERIC.MP#457 amd64
titanic# curl https://cdn.openbsd.org/pub/OpenBSD/
[...]
../
06-Jan-2019 18:35   -
6.4/
29-Oct-2018 10:29   -
6.5/
11-Aug-2019 08:18   -
6.6/
23-Oct-2019 10:54   -
6.7/
18-May-2020 08:55   -
6.8/
07-Feb-2021 18:58   -
Changelogs/
15-Apr-2021 11:32   -
[...]
titanic#



Re: Another potential awk or xargs bug?

2021-04-15 Thread Otto Moerbeek
On Thu, Apr 15, 2021 at 04:29:17PM +0200, Christian Weisgerber wrote:

> Jordan Geoghegan:
> 
> > --- /tmp/bad.txt  Wed Apr 14 21:06:51 2021
> > +++ /tmp/good.txt  Wed Apr 14 21:06:41 2021
> 
> I'll note that no characters have been lost between the two files.
> Only the order is different.
> 
> > The only thing that changed between these runs was me using either xargs -P 
> > 1 or -P 2.
> 
> What do you expect?  You run two processes in parallel that write
> to the same file.  Obviously their output will be interspersed in
> unpredictable order.
> 
> You seem to imagine that awk's output is line-buffered.  But when
> it writes to a pipe or file, its output is block-buffered.  This
> is default stdio behavior.  Output is written in block-size increments
> (16 kB in practice) without regard to lines.  So, yes, you can end
> up with a fragment from a line written by process #1, followed by
> lines from process #2, followed by the remainder of the line from
> #1, etc.
> 
> -- 
> Christian "naddy" Weisgerber  na...@mips.inka.de
> 

Right, a fflush() call after the printf makes the issue go away, but
only since awk is being nice and issues a single write call for that
single printf. Since awk afaik does not give such a guarantee, it is
better to have each parallel invocation write to a separate file and
then cat them together after all the awk runs are done.

-Otto



Re: Another potential awk or xargs bug?

2021-04-15 Thread Christian Weisgerber
Jordan Geoghegan:

> --- /tmp/bad.txt  Wed Apr 14 21:06:51 2021
> +++ /tmp/good.txt  Wed Apr 14 21:06:41 2021

I'll note that no characters have been lost between the two files.
Only the order is different.

> The only thing that changed between these runs was me using either xargs -P 1 
> or -P 2.

What do you expect?  You run two processes in parallel that write
to the same file.  Obviously their output will be interspersed in
unpredictable order.

You seem to imagine that awk's output is line-buffered.  But when
it writes to a pipe or file, its output is block-buffered.  This
is default stdio behavior.  Output is written in block-size increments
(16 kB in practice) without regard to lines.  So, yes, you can end
up with a fragment from a line written by process #1, followed by
lines from process #2, followed by the remainder of the line from
#1, etc.

-- 
Christian "naddy" Weisgerber  na...@mips.inka.de



Another potential awk or xargs bug?

2021-04-15 Thread Jordan Geoghegan
Hello,

I've found some very interesting behaviour when subjecting various awk 
implementations to some very specific circumstances.

I'm basically looking for a sanity check here to confirm if I'm just wildly 
flailing, or if I am indeed onto something here.

Here's my situation:

When parsing some RIR data in parallel using awk with xargs, I seem to have 
found a way to reliable lose and/or mangle output with parallel xargs. My 
google-fu seems to be failing me. I understand that xargs does not buffer 
output and that lines may arrive out of order, but in this case I am reliably 
and reproducibly losing data and receiving mangled output. But wait, it gets 
stranger.

I don't want to lose you guys here with a long winded explanation, so I'm going 
to show you a diff that shows reproducibly mangled output when using xargs in 
parallel mode:

--- /tmp/bad.txt  Wed Apr 14 21:06:51 2021
+++ /tmp/good.txt  Wed Apr 14 21:06:41 2021
@@ -1,5 +1,3 @@
-267386
-A264890
 AS262399
 AS262400
 AS262401
@@ -1774,6 +1772,7 @@
 AS264887
 AS264888
 AS264889
+AS264890
 AS264891
 AS264892
 AS264893
@@ -3552,6 +3551,7 @@
 AS267383
 AS267384
 AS267385
+AS267386
 AS267387
 AS267388
 AS267389
@@ -4220,6 +4220,7 @@
 AS268318
 AS268319
 AS268320
+AS268320
 AS268321
 AS268321
 AS268323
@@ -7785,6 +7786,7 @@
 AS270633
 AS270633
 AS270634
+AS270634
 AS270635
 AS270635
 AS270636
@@ -10277,5 +10279,3 @@
 AS46210
 AS46280
 AS46280
-ASAS268320
-ASS270634

The only thing that changed between these runs was me using either xargs -P 1 
or -P 2.

To allow folks to follow along with me at home, I've included the two files 
(gzipped for politeness) I used to trigger this behaviour.

Once you've extracted the attached text files into your working directory, 
here's a snippet that should reproduce my issue:

$ printf 'BR\nCA\n' > cc.txt

$ find . -type f -name "[12].txt" -print0 | xargs -0 -n 1 -P 2 -- awk -F '|' 
'NR==FNR { A[$1]=1 ; next } $1 in A && $2 == "asn" { printf("AS%s\n", $3) }' 
cc.txt

What does this 1 liner do, well it's supposed to slurp the country codes 
specified in cc.txt into an array where we then check the first field of each 
row of the RIR data against. If the first field matches a country code in the 
array and the second field indicates that this row is an ASN record, then we 
print the 3rd field prepended with 'AS'. As you can see, if you grep the output 
of the above command for the string "ASAS", "ASS" or 'A2' you should see some 
mangled ASNs. If you change "-P 2" to "-P 1" this mangling will not occur.

Here's where things get very weird. While parsing this data (as part of a 
larger dataset comprising an aggregation of all the registrar delegation 
statistics) I've been using this snippet for a while to quickly fetch ASN 
records. It is not until I have BOTH the BR and CA country codes in the array 
that I can trigger this bug. I can have any number of country codes in the 
array, but if Brazil AND Canada happen to be specified in the array, then I get 
mangled output, but ONLY if executed with parallel xargs. This reproducibly 
happens when using awk, gawk or mawk. To further melt your brain, this 
behaviour has NOT been observed when using goawk, a POSIX compliant awk 
implementation written in go.

Just to prove my point, here's me testing the hash outputs between various awk 
implementations with my above 1 liner:

$ find . -type f -name "[12].txt" -print0 | xargs -0 -n 1 -P 2 -- awk -F '|' 
'NR==FNR { A[$1]=1 ; next } $1 in A && $2 == "asn" { printf("AS%s\n", $3) }' 
cc.txt | sort | md5
    2a20f44ce6a23d5c49b05b9f2689ef93

$ find . -type f -name "[12].txt" -print0 | xargs -0 -n 1 -P 1 -- awk -F '|' 
'NR==FNR { A[$1]=1 ; next } $1 in A && $2 == "asn" { printf("AS%s\n", $3) }' 
cc.txt | sort | md5
    9ab3dbfbff5746f059cdb35221ff73b1
---
$ find . -type f -name "[12].txt" -print0 | xargs -0 -n 1 -P 2 -- mawk -F '|' 
'NR==FNR { A[$1]=1 ; next } $1 in A && $2 == "asn" { printf("AS%s\n", $3) }' 
cc.txt | sort | md5
    2a20f44ce6a23d5c49b05b9f2689ef93

$ find . -type f -name "[12].txt" -print0 | xargs -0 -n 1 -P 1 -- mawk -F '|' 
'NR==FNR { A[$1]=1 ; next } $1 in A && $2 == "asn" { printf("AS%s\n", $3) }' 
cc.txt | sort | md5 >
    9ab3dbfbff5746f059cdb35221ff73b1
---
$ find . -type f -name "[12].txt" -print0 | xargs -0 -n 1 -P 2 -- 
~/go/bin/goawk -F '|' 'NR==FNR { A[$1]=1 ; next } $1 in A && $2 == "asn" { 
printf("AS%s\n", $3) }' cc.txt | sort | md>
    9ab3dbfbff5746f059cdb35221ff73b1

$ find . -type f -name "[12].txt" -print0 | xargs -0 -n 1 -P 1 -- 
~/go/bin/goawk -F '|' 'NR==FNR { A[$1]=1 ; next } $1 in A && $2 == "asn" { 
printf("AS%s\n", $3) }' cc.txt | sort | md
    9ab3dbfbff5746f059cdb35221ff73b1

I've racked my brain and the internet for hours, I've tested and toiled, and 
I'm left thoroughly perplexed. I now humbly ask the fine folks here in OpenBSD 
Land for guidance, insight or suggestions.

As always, is this a bug, or am I holding it wrong?

Regards,

Jordan



1.txt.gz
Description: 

Re: Last shutdown date of old OpenBSD machine

2021-04-15 Thread Otto Moerbeek
On Thu, Apr 15, 2021 at 11:42:14AM +0200, Ales Tepina wrote:

> Hi!
> 
> I have a really old machine (it has DIN keyboard connector) with OpenBSD 
> installed on it that was used as a router and its been sitting 
> in the basement for quite a few years. I would like to find out the date 
> when the machine was last shutdown.
> 
> What would be the best way to go about looking for that info?
> 
> I have two options as far as i can see but have not tried any of them to
> avoid messing up the date of last boot/shutdown:
> 1. Boot the machine and check the log files in /var/log
> 2. Attach the disk drive to another machine and mount the partition and
>   also check the info on some files
> 
> Also, one important caveat. There is a good chance i won't be able to
> guess the password anymore. I think i know what it is, but i'm not sure
> since it was so long ago.
> Therefore booting into single user mode is probably the only choice for
> option 1.
> 
> Thank you for your suggestions.
> 
> Br, Ales
> 

check last(1). Can be used with option 1 and 2 above.

-Otto



Re: X11 Freeze and Crash on Lenovo Thinkpad T14 AMD GEN1

2021-04-15 Thread niamkik
> It seems a user with a T14s with similar hardware reported issues with
> hibernate. [1] Does your system properly suspend/resume and
> hibernate/resume?

Yes, without any issue. I was thinking at first it should have been due to 
suspend/resume, but it's not the case. issue [1] seems not to be the same.

> I'm sadly no eXpert on X or drm...but if you're getting a segfault, it
> might be helpful to get the core dump and see what the stack was via
> gdb.

Yes... Totally forgot to do that! Like you, I am not an expert in X and drm. ;)



Re: Last shutdown date of old OpenBSD machine

2021-04-15 Thread Tom Smyth
Check dmesg i think that will have the boot time / date in it



On Thursday, 15 April 2021, Ales Tepina  wrote:

> Hi!
>
> I have a really old machine (it has DIN keyboard connector) with OpenBSD
> installed on it that was used as a router and its been sitting
> in the basement for quite a few years. I would like to find out the date
> when the machine was last shutdown.
>
> What would be the best way to go about looking for that info?
>
> I have two options as far as i can see but have not tried any of them to
> avoid messing up the date of last boot/shutdown:
> 1. Boot the machine and check the log files in /var/log
> 2. Attach the disk drive to another machine and mount the partition and
>   also check the info on some files
>
> Also, one important caveat. There is a good chance i won't be able to
> guess the password anymore. I think i know what it is, but i'm not sure
> since it was so long ago.
> Therefore booting into single user mode is probably the only choice for
> option 1.
>
> Thank you for your suggestions.
>
> Br, Ales
>
>

-- 
Kindest regards,
Tom Smyth.


Re: WireGuard, keepalive time doubled?

2021-04-15 Thread Stuart Henderson
On 2021-04-14, Jan Johansson  wrote:
> Hello!
>
> I was experimenting with wireguard keepalive and noticed that
> keepalive packets seems to be sent on double the time that I have
> set which I find a bit unintuitive.

FWIW I'm using wgpka 75 with one peer in one place, and wgpka 50 with several 
peers
in another place, all work as expected here (fairly recent -current). Not sure 
what
might be different with your setup.




Last shutdown date of old OpenBSD machine

2021-04-15 Thread Ales Tepina
Hi!

I have a really old machine (it has DIN keyboard connector) with OpenBSD 
installed on it that was used as a router and its been sitting 
in the basement for quite a few years. I would like to find out the date 
when the machine was last shutdown.

What would be the best way to go about looking for that info?

I have two options as far as i can see but have not tried any of them to
avoid messing up the date of last boot/shutdown:
1. Boot the machine and check the log files in /var/log
2. Attach the disk drive to another machine and mount the partition and
  also check the info on some files

Also, one important caveat. There is a good chance i won't be able to
guess the password anymore. I think i know what it is, but i'm not sure
since it was so long ago.
Therefore booting into single user mode is probably the only choice for
option 1.

Thank you for your suggestions.

Br, Ales



TouchPad, right clicking, and cwm

2021-04-15 Thread tetrahedra

Hi,
I'm trying to get my TouchPad/trackpad to right click. I put the 
following in my /etc/X11/xorg.conf.d/70-synaptics.conf:


Section "InputClass"
Identifier "touchpad"
Driver "synaptics"
MatchIsTouchpad "on"
Option "ClickPad" "on"
Option "VertEdgeScroll" "off"
Option "VertTwoFingerScroll" "on"
Option "ClickFinger2" "2"
Option "ClickFinger3" "3"
EndSection

However, this was not enough to get two- or three-finger clicking 
working.


I'd even be satisfied with Ctrl-Click mapping to right-click.

Has anyone got any ideas how to make either option work?