faq/faq6.html#Wireless : nwid vs join

2022-10-17 Thread tux2bsd
> nwid puffyuberalles wpakey passwordhere
> inet autoconf
>
> Or, for multiple access points:
>
> join home-net wpakey passwordhere
> join work-net wpakey passwordhere
> join cafe-wifi
> inet autoconf

It isn't clear why one uses 'nwid' and the other uses 'join',
I think it would be better to be consistent for either use case -
all 'nwid' or all 'join' (I prefer 'join').  

https://www.openbsd.org/faq/faq6.html#Wireless
section: "Configuring a Wireless Adapter"

tux2bsd

p.s. Below has no real point other than to share the tale.  It's how I
ended up noticing the nwid/join difference above (while troubleshooting
the following).

001_wifi bit me hard (OpenBSD 7.1, WIFI status: no network).

Scenario:

- Old laptop (eeepc 1005HA), had OpenBSD 7.0 already installed

- Turned it on for the first time in months

- ran 'sysupgrade', rebooted, was fine

- went far away, suspend kicked in

- wifi would not work after resume, distracted by this I tried to no
avail to remedy my network settings

- reboot wifi worked, sleep, wifi failed again (more useless remedy
attempts)

- reboot wifi worked, ifconfig athn0 down then up; wifi failed again
(ruled out suspend but more useless remedy attempts)

- being so fixated on the wifi not working I'd forgotten all about
'syspatch' until an epiphany I rebooted to try it.

- ran syspatch, 001_wifi installed & rebooted, wifi down/up and it
worked - fantastic

- syspatch again for the rest and fw_update for good measure


Sent with Proton Mail secure email. (tux2bsd note: apologies if Proton
Mail busts formatting, this has been piped through fmt -sw72)



Increase kernel memory

2022-10-17 Thread naveresch

Hi,

I'm running an OpenBSD instance which is handling quite a lot of vlan 
traffic. When trying to replace the currently running ruleset the kernel 
panics.


ddb{0}>  show panic

*cpu0: malloc: out of space in kmem_map

This issue is probably due to too little kernel memory.

How may I increase the amount of available kernel memory?


Best regards,

Nico



OpenPGP_0x8FAE1A392CAEAE38.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Re: ksh: documented substitution behavior contradicts actual behavior

2022-10-17 Thread chohag
Kastus Shchuka writes:
> On Sun, Oct 16, 2022 at 11:48:35AM +0100, cho...@jtan.com wrote:
> > So given $X:
> > 
> > $ X=' A :  B::D'
> > 
> > Parameter substitution:
> > 
> > $ ( IFS=' :'; dump $X )
> > $VAR1 = 'A';
> > $VAR2 = 'B';
> > $VAR3 = '';
> > $VAR4 = 'D';
> > 
> > read substitution:
> > 
> > $ echo "$X" | ( IFS=' :'; read a1 a2 a3 a4; dump "$a1" "$a2" "$a3" 
> > "$a4" )
> > $VAR1 = 'A';
> > $VAR2 = '';
> > $VAR3 = 'B';
> > $VAR4 = ':D';
> > 
> > It does look like read, which uses its own expansion routine, has
> > a bug: a2/VAR2 should be 'B' (or 'B::D') not ''.
>
> Not sure if it is a bug or a feature. 

I can't think of a good reason why the output from these commands
should be different. The manpage section describing read states
clearly that it should be using the same splitting algorithm:
"separates the line into fields using the IFS parameter (see
Substitution above)".

The diff brings them into line with each other and I think accounts
for all the edge cases.

Matthew

Index: c_sh.c
===
RCS file: /src/datum/openbsd/cvs/src/bin/ksh/c_sh.c,v
retrieving revision 1.64
diff -u -p -r1.64 c_sh.c
--- c_sh.c  22 May 2020 07:50:07 -  1.64
+++ c_sh.c  17 Oct 2022 09:59:21 -
@@ -253,6 +253,7 @@ c_read(char **wp)
int expand = 1, savehist = 0;
int expanding;
int ecode = 0;
+   int hardws = 0;
char *cp;
int fd = 0;
struct shf *shf;
@@ -376,9 +377,21 @@ c_read(char **wp)
break;
if (ctype(c, C_IFS)) {
if (Xlength(cs, cp) == 0 && ctype(c, C_IFSWS))
-   continue;
+   continue; /* Trim leading space. */
+   if (!ctype(c, C_IFSWS)) {
+   /* Do not finish this variable
+* on non IFS whitespace if the
+* previous variable has
+* trailing IFS whitespace.
+*/
+   if (hardws) {
+   hardws = false;
+   continue;
+   }
+   } else
+   hardws = true;
if (wp[1])
-   break;
+   break; /* Finish scanning this 
variable. */
}
Xput(cs, cp, c);
}



Re: faq/faq6.html#Wireless : nwid vs join

2022-10-17 Thread Kenneth Gober
On Mon, Oct 17, 2022 at 5:37 AM tux2bsd  wrote:

> > nwid puffyuberalles wpakey passwordhere
> > inet autoconf
> >
> > Or, for multiple access points:
> >
> > join home-net wpakey passwordhere
> > join work-net wpakey passwordhere
> > join cafe-wifi
> > inet autoconf
>
> It isn't clear why one uses 'nwid' and the other uses 'join',
> I think it would be better to be consistent for either use case -
> all 'nwid' or all 'join' (I prefer 'join').
>

Not every detail gets into the FAQ. The difference between
'join' and 'nwid' is described in the ifconfig(8) man page.

'join' is used to add a network to the 'join list' which is a list
of networks the system will try to connect to, when not already
connected to another network.

'nwid' is used when you want to immediately connect to an
access point without disturbing the join list.  For example,
you might use 'nwid' to connect to a public network such as
one provided by a hotel or a cafe, without modifying your
'join' list which might normally have only your private home
and office networks.

-ken