Add versioned lib to system perl's @INC for non-packaged modules

2021-05-16 Thread Andrew Hewus Fresh
This patch is should make it easier to recover from problems that happen
when installing perl modules outside of the package system.  You might
recognize the "loadable library and perl binaries are mismatched" error.

Adding a versioned subdirectory for cpan modules means that when the
perl version changes it will no longer find those old modules and it
will be easy to remove them without disturbing things from packages.

Only slightly related, but we can avoid breaking base tools like pkg_add
and friend by using "no lib '/usr/local/libdata/perl5/site_perl';" to
avoid looking in those directories at all.


The new @INC looks like this.  The first "5.32.1" sitelib is where
external things, like cpan(1), will install.  The current "site_perl"
directory (now vendorlib) will continue to be where ports/packages go.
Finally, "/usr/libdata" privlib is for things that ship with the base
system.

$ perl -V | perl -ne 'print if /INC/..eof'
  @INC:
/usr/local/libdata/perl5/site_perl/5.32.1/sparc64-openbsd
/usr/local/libdata/perl5/site_perl/5.32.1
/usr/local/libdata/perl5/site_perl/sparc64-openbsd
/usr/local/libdata/perl5/site_perl
/usr/libdata/perl5/sparc64-openbsd
/usr/libdata/perl5


One place this might cause temporary issues in the ports tree is
anything that doesn't use the overrides in perl.port.mk and looks up
sitelib itself.  It should be fairly obvious as it should fail to
package because the files in the PLIST will not exist (they'll be in the
versioned subdir).  I didn't run into that in my testing, but I didn't
complete a full bulk build.

There do appear to be some annoyances with still shared directories for
man pages, in that if you install a CPAN module and then attempt to
pkg_add it, it complains because "files already exist" in the man
directory.  We could separate the cpan man pages, or I think un-setting
the site_lib man*dir will mean cpan won't instal them.  I haven't yet
tested that, but I'm not sure what would be best there.


Unfortunately I did do a bunch of testing of different ways to add
things to @INC which meant this patch also does some reorganization of
the contents, I can turn it into a smaller patch if requested and do the
cleanup separately.


Comments, OK?  Should I see if sthen@ will do a full bulk build first?


Index: gnu/usr.bin/perl/config.over
===
RCS file: /cvs/src/gnu/usr.bin/perl/config.over,v
retrieving revision 1.22
diff -u -p -r1.22 config.over
--- gnu/usr.bin/perl/config.over5 Feb 2017 00:33:38 -   1.22
+++ gnu/usr.bin/perl/config.over16 May 2021 20:43:16 -
@@ -9,49 +9,85 @@ archname="`arch -s`-${osname}"
 myarchname="$archname"
 
 # Use correct paths for a distribution
-prefix='/usr'
+# site   is where cpan clients install files
+# vendor is where the ports tree puts packages
+# priv   is where the system installs files
+
+# We set up vendor paths for ports/packages
+usevendorprefix="${define}"
+d_vendorbin="${define}"
+d_vendorlib="${define}"
+d_vendorarch="${define}"
+#d_vendorscript="${define}"
+
+# Things from base go into /usr
 prefixexp='/usr'
+prefix="${prefixexp}"
 
-# But site binaries go in /usr/local/bin for ports
-siteprefix='/usr/local'
+# But vendor and site files go in /usr/local for ports and cpan
 siteprefixexp='/usr/local'
-installsitebin='/usr/local/bin'
+siteprefix="${siteprefixexp}"
+installsitebin='${siteprefix}/bin'
+
+vendorprefixexp='/usr/local'
+vendorprefix="${vendorprefixexp}"
+installvendorbin='${vendorprefix}/bin'
 
-installarchlib="/usr/libdata/perl5/${archname}"
+installprivlib="${prefix}/libdata/perl5"
+privlib="${installprivlib}"
+privlibexp="${privlib}"
+installarchlib="${installprivlib}/${archname}"
 archlib="${installarchlib}"
 archlibexp="${archlib}"
 
 test $useshrplib = "true" && ccdlflags="-Wl,-R${installarchlib}/CORE"   
 
-installprivlib="/usr/libdata/perl5"
-privlib="${installprivlib}"
-privlibexp="${privlib}"
-
-installsitearch="/usr/local/libdata/perl5/site_perl/${archname}"
-sitearch="${installsitearch}"
-sitearchexp="${sitearch}"
 
-installsitelib="/usr/local/libdata/perl5/site_perl"
+# We keep vendor in site_perl so we don't have to bump every perl port
+# otherwise this would be pkg_perl
+# Not versioned here because pkg tools handle that for us.
+installvendorlib="${vendorprefix}/libdata/perl5/site_perl"
+vendorlib="${installvendorlib}"
+vendorlibexp="${vendorlib}"
+installvendorarch="${installvendorlib}/${archname}"
+vendorarch="${installvendorarch}"
+vendorarchexp="${vendorarch}"
+
+# cpan(1) and similar tools install in a $version dir that's easy
+# to remove after upgrade and won't cause issues for packages when
+# perl versions change.
+installsitelib="${siteprefix}/libdata/perl5/site_perl/${version}"
 sitelib="${installsitelib}"
 sitelibexp="${sitelib}"
+installsitearch="${installsitelib}/${archname}"
+sitearch="${installsitearch}"
+sitearchexp="${sitearch}"
 
 installstyle="${privlib}"
 
-# We 

ftpd(8): remove useless parameter of get_line()

2021-05-16 Thread Jan Klemkow
Hi,

This diff removes the useless FILE* parameter of get_line().  In every
call this parameter is always "stdin".  Thus, we can replace ever use of
the variable iop with stdin.

Like every other diff, I tested this diff with the ftpd regression
tests.

OK?

bye,
Jan

Index: extern.h
===
RCS file: /cvs/src/libexec/ftpd/extern.h,v
retrieving revision 1.21
diff -u -p -r1.21 extern.h
--- extern.h15 Jan 2020 22:06:59 -  1.21
+++ extern.h16 May 2021 15:36:27 -
@@ -69,7 +69,7 @@ void  dologout(int);
 void   fatal(char *);
 intftpd_pclose(FILE *, pid_t);
 FILE   *ftpd_ls(const char *, pid_t *);
-int get_line(char *, int, FILE *);
+int get_line(char *, int);
 void   ftpdlogwtmp(char *, char *, char *);
 void   lreply(int, const char *, ...);
 void   makedir(char *);
Index: ftpcmd.y
===
RCS file: /cvs/src/libexec/ftpd/ftpcmd.y,v
retrieving revision 1.69
diff -u -p -r1.69 ftpcmd.y
--- ftpcmd.y4 Mar 2020 20:17:48 -   1.69
+++ ftpcmd.y16 May 2021 15:38:07 -
@@ -1089,10 +1089,9 @@ lookup(p, cmd)
  * get_line - a hacked up version of fgets to ignore TELNET escape codes.
  */
 int
-get_line(s, n, iop)
+get_line(s, n)
char *s;
int n;
-   FILE *iop;
 {
int c;
char *cs;
@@ -,21 +1110,21 @@ get_line(s, n, iop)
if (c == 0)
tmpline[0] = '\0';
}
-   while ((c = getc(iop)) != EOF) {
+   while ((c = getc(stdin)) != EOF) {
c &= 0377;
if (c == IAC) {
-   if ((c = getc(iop)) != EOF) {
+   if ((c = getc(stdin)) != EOF) {
c &= 0377;
switch (c) {
case WILL:
case WONT:
-   c = getc(iop);
+   c = getc(stdin);
printf("%c%c%c", IAC, DONT, 0377);
(void) fflush(stdout);
continue;
case DO:
case DONT:
-   c = getc(iop);
+   c = getc(stdin);
printf("%c%c%c", IAC, WONT, 0377);
(void) fflush(stdout);
continue;
@@ -1144,7 +1143,7 @@ get_line(s, n, iop)
 * This prevents the command to be split up into
 * multiple commands.
 */
-   while (c != '\n' && (c = getc(iop)) != EOF)
+   while (c != '\n' && (c = getc(stdin)) != EOF)
;
return (-2);
}
@@ -1204,7 +1203,7 @@ yylex()
 
case CMD:
(void) alarm((unsigned) timeout);
-   n = get_line(cbuf, sizeof(cbuf)-1, stdin);
+   n = get_line(cbuf, sizeof(cbuf)-1);
if (n == -1) {
reply(221, "You could at least say goodbye.");
dologout(0);
Index: ftpd.c
===
RCS file: /cvs/src/libexec/ftpd/ftpd.c,v
retrieving revision 1.229
diff -u -p -r1.229 ftpd.c
--- ftpd.c  15 Jan 2020 22:06:59 -  1.229
+++ ftpd.c  16 May 2021 15:44:17 -
@@ -2179,7 +2179,7 @@ myoob(void)
if (!transflag)
return;
cp = tmpline;
-   ret = get_line(cp, sizeof(tmpline)-1, stdin);
+   ret = get_line(cp, sizeof(tmpline)-1);
if (ret == -1) {
reply(221, "You could at least say goodbye.");
dologout(0);



[PATCH] [src] etc/services - duplicates

2021-05-16 Thread Raf Czlonka
Hello,

During recent services(5)-related threads, I glanced over the file
and noticed a duplicate - namely(sic!), "nameserver" is being used
both as the a service name, as well as an alias for "domain".

nameserver  42/tcp  name# IEN 116
domain  53/tcp  nameserver  # name-domain server
domain  53/udp  nameserver

The above entries had remained unchanged since the file has been
imported into the tree[0]. As I found out some minutes later, NetBSD
have removed the duplicate in 1999[1].

As you can see from their commit[1], there is another duplicate
which has been removed from that file - "readnews". There, they
have removed it from:

netnews 532/tcp

and, even nowadays, still have it as a local alias[2]:

readnews119/tcp untp

on top of the usual[2]:

nntp119/tcp# Network News Transfer
nntp119/udp# Network News Transfer

while IANA entries look as follows[3]:

nntp119 tcp Network News Transfer
nntp119 udp Network News Transfer
netnews 532 tcp readnews
netnews 532 udp readnews

FreeBSD[4] and DragonFly BSD[5]:

nntp119/tcpusenet   #Network News Transfer Protocol
nntp119/udpusenet   #Network News Transfer Protocol
netnews 532/tcpreadnews
netnews 532/udpreadnews

To sum it up, I wasn't sure whether to remove it from:

nntp119/tcp readnews untp

or:

netnews 532/tcp readnews

Perhaps add "usenet" alias to the "nntp" entry while there...?

Either way, I'm leaving it "as is", at least for now.

In terms of the actual diff, I've also taken the liberty to update
the comment to the more modern/familiar - "Domain Name Server" -
as, nowadays, it is being used universally[2][3][4][5].

[0] https://cvsweb.openbsd.org/~checkout~/src/etc/services?rev=1.1
[1] 
http://cvsweb.netbsd.org/bsdweb.cgi/src/etc/services.diff?r1=1.30=1.31_with_tag=MAIN=h
[2] http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/etc/services?rev=1.103
[3] 
https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.txt
[4] https://cgit.freebsd.org/src/plain/usr.sbin/services_mkdb/services
[5] https://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/etc/services

Regards,

Raf

Index: etc/services
===
RCS file: /cvs/src/etc/services,v
retrieving revision 1.102
diff -u -p -r1.102 services
--- etc/services12 May 2021 06:50:33 -  1.102
+++ etc/services16 May 2021 17:46:38 -
@@ -33,8 +33,8 @@ nameserver42/tcp  name# IEN 116
 whois  43/tcp  nicname
 tacacs 49/tcp  tacas+  # Login Host Protocol (TACACS)
 tacacs 49/udp  tacas+  # Login Host Protocol (TACACS)
-domain 53/tcp  nameserver  # name-domain server
-domain 53/udp  nameserver
+domain 53/tcp  # Domain Name Server
+domain 53/udp  # Domain Name Server
 mtp57/tcp  # deprecated
 bootps 67/tcp  # BOOTP server
 bootps 67/udp



Re: umsm(4)/umb(4) supports for Quectel EC25

2021-05-16 Thread Shawn Chiou
Hi,

Thanks for @kevlo's affort!

It works properly for my EC25 AU on RPI v4.

The following is partial dmesg of my RPI v4 with OpenBSD...

uhub1 at uhub0 port 1 configuration 1 interface 0 "VIA Labs USB2.0 Hub" rev
2.10/4.21 addr 2
bwfm0 at sdmmc0 function 1
manufacturer 0x02d0, product 0xa9a6 at sdmmc0 function 2 not configured
manufacturer 0x02d0, product 0xa9a6 at sdmmc0 function 3 not configured
umb0 at uhub1 port 3 "Android Android" rev 2.00/3.18 addr 3
vscsi0 at root
scsibus1 at vscsi0: 256 targets
softraid0 at root
scsibus2 at softraid0: 256 targets
root on sd0a (21d6779c5fd760f6.a) swap on sd0b dump on sd0b
WARNING: CHECK AND RESET THE DATE!
gpio0 at bcmgpio0: 58 pins
bwfm0: address dc:a6:32:9b:bb:e3

And I can connect to Internet after ifconfig umb0 up with APN setting.

umb0: flags=8851 mtu 1500
   index 5 priority 6 llprio 3
   roaming disabled registration home network
   state up cell-class LTE rssi -99dBm speed 47.7Mbps up 143Mbps down
   SIM initialized PIN valid (3 attempts left)
   subscriber-id 466891003015519 ICC-id 89886891000658005192 provider

   device QUECTEL Mobile Broadband Modul IMEI 8615850 firmware
EC25AUFAR06A03M4G
   APN internet
   dns 172.24.9.21 10.9.121.102
   groups: egress
   status: active
   inet 100.89.128.19 --> 100.89.128.20 netmask 0xfff8

And ping out...

pi4# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: icmp_seq=0 ttl=114 time=187.610 ms
64 bytes from 8.8.8.8: icmp_seq=1 ttl=114 time=25.377 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=114 time=45.676 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=114 time=25.032 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=114 time=44.996 ms
^C
--- 8.8.8.8 ping statistics ---
5 packets transmitted, 5 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 25.032/65.738/187.610/61.598 ms
pi4# ping www.hinet.net
ping: Warning: hinet-hp.cdn.hinet.net has multiple addresses; using
210.61.218.1
PING hinet-hp.cdn.hinet.net (210.61.218.1): 56 data bytes
64 bytes from 210.61.218.1: icmp_seq=0 ttl=53 time=15.506 ms
64 bytes from 210.61.218.1: icmp_seq=1 ttl=53 time=38.806 ms
64 bytes from 210.61.218.1: icmp_seq=2 ttl=53 time=37.107 ms
64 bytes from 210.61.218.1: icmp_seq=3 ttl=53 time=37.045 ms
64 bytes from 210.61.218.1: icmp_seq=4 ttl=53 time=36.841 ms
^C
--- hinet-hp.cdn.hinet.net ping statistics ---
5 packets transmitted, 5 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 15.506/33.061/38.806/8.806 ms


On Sat, May 15, 2021 at 5:12 PM Kevin Lo  wrote:

> Hi,
>
> Attached is a diff for umsm(4)/umb(4) which enables support for Quectel
> EC25.
>
> umsm0 at uhub0 port 2 configuration 1 interface 0 "Android Android" rev
> 2.00/3.18 addr 2
> ucom0 at umsm0
> umsm1 at uhub0 port 2 configuration 1 interface 1 "Android Android" rev
> 2.00/3.18 addr 2
> ucom1 at umsm1
> umsm2 at uhub0 port 2 configuration 1 interface 2 "Android Android" rev
> 2.00/3.18 addr 2
> ucom2 at umsm2
> umsm3 at uhub0 port 2 configuration 1 interface 3 "Android Android" rev
> 2.00/3.18 addr 2
> ucom3 at umsm3
> umsm4 at uhub0 port 2 configuration 1 interface 4 "Android Android" rev
> 2.00/3.18 addr 2
> ucom4 at umsm4
>
> The Quectel EC25 is a MBIM compatible chip, you'll need to switch it into
> MBIM
> mode via a specific AT-command (AT+QCFG="usbnet",2) over the serial port
> cuaU2.
> Need additional quirks to get Quectel to work.
>
> umb0 at uhub0 port 2 "Android Android" rev 2.00/3.18 addr 2
>
> Index: share/man/man4/umb.4
> ===
> RCS file: /cvs/src/share/man/man4/umb.4,v
> retrieving revision 1.12
> diff -u -p -u -p -r1.12 umb.4
> --- share/man/man4/umb.428 Mar 2021 12:10:05 -  1.12
> +++ share/man/man4/umb.415 May 2021 09:05:33 -
> @@ -49,6 +49,7 @@ The following devices should work:
>  .It Fibocom L831-EAU
>  .\" .It Huawei ME906s -- attaches but needs more work
>  .It Medion Mobile S4222 (MediaTek OEM)
> +.It Quectel EC25
>  .It Sierra Wireless EM7345
>  .It Sierra Wireless EM7455
>  .It Sierra Wireless EM8805
> Index: share/man/man4/umsm.4
> ===
> RCS file: /cvs/src/share/man/man4/umsm.4,v
> retrieving revision 1.95
> diff -u -p -u -p -r1.95 umsm.4
> --- share/man/man4/umsm.4   11 Apr 2018 04:23:10 -  1.95
> +++ share/man/man4/umsm.4   15 May 2021 09:05:33 -
> @@ -100,6 +100,7 @@ driver:
>  .It Li "Option iCON 225" Ta "USB"
>  .It Li "Option iCON 505" Ta "USB"
>  .It Li "Option GlobeTrotter HSUPA 380E" Ta "PCI Express Mini Card"
> +.It Li "Quectel EC25" Ta "PCI Express Mini Card"
>  .It Li "Sierra Wireless MC8755" Ta "PCI Express Mini Card"
>  .It Li "Sierra Wireless MC8775" Ta "PCI Express Mini Card"
>  .It Li "Sierra Wireless MC8790" Ta "PCI Express Mini Card"
> Index: sys/dev/usb/if_umb.c
> ===
> RCS file: 

Re: running network stack forwarding in parallel

2021-05-16 Thread Vitaliy Makkoveev



> On 14 May 2021, at 14:43, Martin Pieuchot  wrote:
> 
> On 13/05/21(Thu) 14:50, Vitaliy Makkoveev wrote:
>> On Thu, May 13, 2021 at 01:15:05PM +0200, Hrvoje Popovski wrote:
>>> On 13.5.2021. 1:25, Vitaliy Makkoveev wrote:
 It seems this lock order issue is not parallel diff specific.
>>> 
>>> 
>>> 
>>> Yes,  you are right ... it seemed familiar but i couldn't reproduce it
>>> on lapc trunk or without this diff so i thought that parallel diff is
>>> one to blame ..
>>> 
>>> 
>>> sorry for noise ..
>>> 
>> 
>> Timeout thread and interface destroy thread are both serialized by
>> kernel lock so it's hard to catch this issue. So your report is
>> useful :)
> 
> The use of the NET_LOCK() in *clone_destroy() is problematic.  tpmr(4)
> has a similar problem as reported by Hrvoje in a different thread.  I
> don't know what it is serializing, hopefully David can tell us more.
> 

It serializes detach hook and clone_detach. Detach hooks are executed
with netlock held. Unfortunately this problem is much complicated,
and we can’t just introduce new lock to solve it because this will
introduce lock order issue.


Re: services(5): more cleanup

2021-05-16 Thread Jeremie Courreges-Anglas
On Sat, May 15 2021, Aisha Tammy  wrote:
> On 5/11/21 9:04 PM, Kurt Mosiejczuk wrote:
>> On Wed, May 12, 2021 at 01:13:55AM +0200, Jeremie Courreges-Anglas wrote:
>>
>>> I'd like to drop SWAT, unofficial and dropped by the samba project
>>> around the switch to samba4.
 - moved smtps/465 to the standards section (rfc8314)
>>> The new service was named "submissions".  I guess we should use both
>>> that and the "smtps" alias.
>>> https://datatracker.ietf.org/doc/html/rfc8314#section-7.3
>>> ok?
> A quick question, does this mean that the port in pf.conf will also have
> to be renamed?
> I have a few machines which use something to the effect of `pass in on
> egress proto tcp to port smtps ...`.
> Will that be broken by this? Similarly smtpd.conf? Or do they do this
> port-name translation separately?

I'd suggest you do a quick test. ;)

> Best,
> Aisha
>
>> ok kmos
>>
>> --Kurt
>>
>>> Index: services
>>> ===
>>> RCS file: /d/cvs/src/etc/services,v
>>> retrieving revision 1.100
>>> diff -u -p -p -u -r1.100 services
>>> --- services5 May 2021 11:49:17 -   1.100
>>> +++ services11 May 2021 23:03:12 -
>>> @@ -123,7 +123,7 @@ microsoft-ds445/tcp # 
>>> Microsoft-DS
>>>   microsoft-ds  445/udp # Microsoft-DS
>>>   kpasswd   464/tcp # Kerberos 5 password 
>>> changing
>>>   kpasswd   464/udp # Kerberos 5 password 
>>> changing
>>> -smtps  465/tcp # mail message 
>>> submission (TLS)
>>> +submissions465/tcp smtps   # mail message 
>>> submission (TLS)
>>>   photuris  468/tcp # Photuris Key Management
>>>   photuris  468/udp
>>>   isakmp500/udp # ISAKMP key management
>>> @@ -296,7 +296,6 @@ kerberos_master 751/udp # 
>>> Kerberos 4
>>>   kerberos_master   751/tcp # Kerberos 4 kadmin
>>>   krb_prop  754/tcp hprop   # Kerberos slave propagation
>>>   krbupdate 760/tcp kreg# BSD Kerberos registration
>>> -swat   901/tcp # Samba Web 
>>> Administration Tool
>>>   datametrics   1645/udp
>>>   ekshell2  2106/tcp# Encrypted kshell - UColorado, 
>>> Boulder
>>>   webster   2627/tcp# Network dictionary
>>>
>>> -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE
>>> 1524 E7EE
>>>
>

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE