Re: ospfd: allow specifying area by number as well as id

2019-04-28 Thread Remi Locherer
Hi David

On Mon, Apr 29, 2019 at 11:53:27AM +1000, David Gwynne wrote:
> it's always bothered me that i config areas on a crisco using a number,
> but then have to think hard to convert that number to an address for use
> in openbsd. eg, i was given area 700 in one place, which is 0.0.2.188
> as an address. super annoying.
> 
> so this changes the ospfd parser so it accepts both a number or address.
> i also changed it so it prints the number by default, which may be
> contentious. the manpage is slightly tweaked too.
> 
> thoughts?

I like it to be able to use a number instead of an address!

It worked fine in my short test I performed.

The output with the comment looks a bit strange to me.

typhoon ..sbin/ospfd$ doas obj/ospfd -nv 

router-id 0.0.0.7
fib-update yes
fib-priority 32
rfc1583compat no
spf-delay msec 1000
spf-holdtime msec 5000

area 7 { # 0.0.0.7
 ^
interface pair7:10.77.77.1 {
metric 10
retransmit-interval 5
router-dead-time 40


I'd prefer if we settle for one output format and then use only that. The
number format is more common but that would be a change for the users. I'm
fine with either format for outputs.

There is also "ospfctl show database area 0.0.0.0" and ospf6d. ;-)

Regards,
Remi


> 
> with this diff, i can do the following and things keep
> working:
> 
> --- /etc/ospfd.conf   Mon Apr 29 11:29:56 2019
> +++ /etc/ospfd.conf.new   Mon Apr 29 11:39:45 2019
> @@ -7,5 +7,5 @@
>  redistribute rtlabel "backup" set metric 65535
>  
> -area 0.0.2.188 {
> +area 700 {
>   router-dead-time minimal
>   fast-hello-interval msec 300
> 
> Index: ospfd.conf.5
> ===
> RCS file: /cvs/src/usr.sbin/ospfd/ospfd.conf.5,v
> retrieving revision 1.55
> diff -u -p -r1.55 ospfd.conf.5
> --- ospfd.conf.5  28 Dec 2018 19:25:10 -  1.55
> +++ ospfd.conf.5  29 Apr 2019 01:45:40 -
> @@ -68,7 +68,7 @@ Macros are not expanded inside quotes.
>  For example:
>  .Bd -literal -offset indent
>  hi="5"
> -area 0.0.0.0 {
> +area 0 {
>   interface em0 {
>   hello-interval $hi
>   }
> @@ -257,10 +257,10 @@ Areas are used for grouping interfaces.
>  All interface-specific parameters can
>  be configured per area, overruling the global settings.
>  .Bl -tag -width Ds
> -.It Ic area Ar address
> +.It Ic area Ar id Ns | Ns Ar address
>  Specify an area section, grouping one or more interfaces.
>  .Bd -literal -offset indent
> -area 0.0.0.0 {
> +area 0 {
>   interface em0
>   interface em1 {
>   metric 10
> Index: parse.y
> ===
> RCS file: /cvs/src/usr.sbin/ospfd/parse.y,v
> retrieving revision 1.95
> diff -u -p -r1.95 parse.y
> --- parse.y   13 Feb 2019 22:57:08 -  1.95
> +++ parse.y   29 Apr 2019 01:45:40 -
> @@ -120,6 +120,7 @@ typedef struct {
>   int64_t  number;
>   char*string;
>   struct redistribute *redist;
> + struct in_addr   id;
>   } v;
>   int lineno;
>  } YYSTYPE;
> @@ -145,6 +146,7 @@ typedef struct {
>  %type  deadtime
>  %type  string dependon
>  %type  redistribute
> +%type  areaid
>  
>  %%
>  
> @@ -588,15 +590,8 @@ comma: ','
>   | /*empty*/
>   ;
>  
> -area : AREA STRING {
> - struct in_addr  id;
> - if (inet_aton($2, &id) == 0) {
> - yyerror("error parsing area");
> - free($2);
> - YYERROR;
> - }
> - free($2);
> - area = conf_get_area(id);
> +area : AREA areaid {
> + area = conf_get_area($2);
>  
>   memcpy(&areadefs, defs, sizeof(areadefs));
>   md_list_copy(&areadefs.md_list, &defs->md_list);
> @@ -610,6 +605,23 @@ area : AREA STRING {
>  
>  demotecount  : NUMBER{ $$ = $1; }
>   | /*empty*/ { $$ = 1; }
> + ;
> +
> +areaid   : NUMBER {
> + if ($1 < 0 || $1 > 0x) {
> + yyerror("invalid area id");
> + YYERROR;
> + }
> + $$.s_addr = htonl($1);
> + }
> + | STRING {
> + if (inet_aton($1, &$$) == 0) {
> + yyerror("error parsing area");
> + free($1);
> + YYERROR;
> + }
> + free($1);
> + }
>   ;
>  
>  areaopts_l   : areaopts_l areaoptsl nl
> Index: printconf.c
> ===
> RCS file

ospfd: allow specifying area by number as well as id

2019-04-28 Thread David Gwynne
it's always bothered me that i config areas on a crisco using a number,
but then have to think hard to convert that number to an address for use
in openbsd. eg, i was given area 700 in one place, which is 0.0.2.188
as an address. super annoying.

so this changes the ospfd parser so it accepts both a number or address.
i also changed it so it prints the number by default, which may be
contentious. the manpage is slightly tweaked too.

thoughts?

with this diff, i can do the following and things keep
working:

--- /etc/ospfd.conf Mon Apr 29 11:29:56 2019
+++ /etc/ospfd.conf.new Mon Apr 29 11:39:45 2019
@@ -7,5 +7,5 @@
 redistribute rtlabel "backup" set metric 65535
 
-area 0.0.2.188 {
+area 700 {
router-dead-time minimal
fast-hello-interval msec 300

Index: ospfd.conf.5
===
RCS file: /cvs/src/usr.sbin/ospfd/ospfd.conf.5,v
retrieving revision 1.55
diff -u -p -r1.55 ospfd.conf.5
--- ospfd.conf.528 Dec 2018 19:25:10 -  1.55
+++ ospfd.conf.529 Apr 2019 01:45:40 -
@@ -68,7 +68,7 @@ Macros are not expanded inside quotes.
 For example:
 .Bd -literal -offset indent
 hi="5"
-area 0.0.0.0 {
+area 0 {
interface em0 {
hello-interval $hi
}
@@ -257,10 +257,10 @@ Areas are used for grouping interfaces.
 All interface-specific parameters can
 be configured per area, overruling the global settings.
 .Bl -tag -width Ds
-.It Ic area Ar address
+.It Ic area Ar id Ns | Ns Ar address
 Specify an area section, grouping one or more interfaces.
 .Bd -literal -offset indent
-area 0.0.0.0 {
+area 0 {
interface em0
interface em1 {
metric 10
Index: parse.y
===
RCS file: /cvs/src/usr.sbin/ospfd/parse.y,v
retrieving revision 1.95
diff -u -p -r1.95 parse.y
--- parse.y 13 Feb 2019 22:57:08 -  1.95
+++ parse.y 29 Apr 2019 01:45:40 -
@@ -120,6 +120,7 @@ typedef struct {
int64_t  number;
char*string;
struct redistribute *redist;
+   struct in_addr   id;
} v;
int lineno;
 } YYSTYPE;
@@ -145,6 +146,7 @@ typedef struct {
 %typedeadtime
 %typestring dependon
 %typeredistribute
+%typeareaid
 
 %%
 
@@ -588,15 +590,8 @@ comma  : ','
| /*empty*/
;
 
-area   : AREA STRING {
-   struct in_addr  id;
-   if (inet_aton($2, &id) == 0) {
-   yyerror("error parsing area");
-   free($2);
-   YYERROR;
-   }
-   free($2);
-   area = conf_get_area(id);
+area   : AREA areaid {
+   area = conf_get_area($2);
 
memcpy(&areadefs, defs, sizeof(areadefs));
md_list_copy(&areadefs.md_list, &defs->md_list);
@@ -610,6 +605,23 @@ area   : AREA STRING {
 
 demotecount: NUMBER{ $$ = $1; }
| /*empty*/ { $$ = 1; }
+   ;
+
+areaid : NUMBER {
+   if ($1 < 0 || $1 > 0x) {
+   yyerror("invalid area id");
+   YYERROR;
+   }
+   $$.s_addr = htonl($1);
+   }
+   | STRING {
+   if (inet_aton($1, &$$) == 0) {
+   yyerror("error parsing area");
+   free($1);
+   YYERROR;
+   }
+   free($1);
+   }
;
 
 areaopts_l : areaopts_l areaoptsl nl
Index: printconf.c
===
RCS file: /cvs/src/usr.sbin/ospfd/printconf.c,v
retrieving revision 1.20
diff -u -p -r1.20 printconf.c
--- printconf.c 28 Dec 2018 19:25:10 -  1.20
+++ printconf.c 29 Apr 2019 01:45:40 -
@@ -181,7 +181,8 @@ print_config(struct ospfd_conf *conf)
printf("\n");
 
LIST_FOREACH(area, &conf->area_list, entry) {
-   printf("area %s {\n", inet_ntoa(area->id));
+   printf("area %u { # %s\n", ntohl(area->id.s_addr),
+   inet_ntoa(area->id));
if (area->stub) {
printf("\tstub");
if (SIMPLEQ_EMPTY(&area->redist_list))



Re: Conditional sysupgrade

2019-04-28 Thread Marco Bonetti
On 04/27, Christian Weisgerber wrote:
> On 2019-04-27, Marco Bonetti  wrote:
> 
> > +unpriv -f SHA256.sig.tmp ftp -Vmo SHA256.sig.tmp ${URL}SHA256.sig
> > +TMP_SHA=$(sha256 -q SHA256.sig.tmp)
> > +
> > +unpriv touch SHA256.sig
> 
> This fails if SHA256.sig doesn't exist yet.  The unprivileged user
> cannot create files in $SETSDIR.
> 
> > +unpriv cat SHA256.sig.tmp >SHA256.sig
> 
> Do you understand that the I/O redirection is performed before
> calling unpriv?
> 
> -- 
> Christian "naddy" Weisgerber  na...@mips.inka.de
> 

Thanks for the suggestions, I've incorporated them in the new version of the
patch.

Cheers,
Marco



Re: Conditional sysupgrade

2019-04-28 Thread Marco Bonetti
On 04/27, Andreas Kusalananda K?h?ri wrote:
> On Sat, Apr 27, 2019 at 01:23:20PM +0100, Marco Bonetti wrote:
> > Hello folks,
> > 
> > First of all congratulations on a new OpenBSD release and thanks for
> > introducing sysupgrade in -current.
> > 
> > Before sysupgrade, I was using a custom script for achieving the same
> > result with only difference that I was checking if a new snapshot (or
> > release) is available by looking at BUILDINFO before starting the
> > upgrade process.
> > 
> > Patch below introduce the same behaviour using SHA256.sig as control
> > file. If you believe there is a valid use case for reinstalling already
> > applied sets to the running system please let me know and I can add a
> > -f force option.
> > 
> > Cheers,
> > Marco
> 
> I was going to suggest something similar.
> 
> See comment below.
> 
> > 
> > Index: usr.sbin/sysupgrade/sysupgrade.8
> > ===
> > RCS file: /cvs/src/usr.sbin/sysupgrade/sysupgrade.8,v
> > retrieving revision 1.2
> > diff -u -p -u -r1.2 sysupgrade.8
> > --- usr.sbin/sysupgrade/sysupgrade.826 Apr 2019 05:54:49 -  
> > 1.2
> > +++ usr.sbin/sysupgrade/sysupgrade.827 Apr 2019 11:54:40 -
> > @@ -28,7 +28,7 @@
> >  .Nm
> >  is a utility to upgrade
> >  .Ox
> > -to the next release or a new snapshot.
> > +to the next release or a new snapshot if available.
> >  .Pp
> >  .Nm
> >  downloads the necessary files to
> > 
> > Index: usr.sbin/sysupgrade/sysupgrade.sh
> > ===
> > RCS file: /cvs/src/usr.sbin/sysupgrade/sysupgrade.sh,v
> > retrieving revision 1.6
> > diff -u -p -u -r1.6 sysupgrade.sh
> > --- usr.sbin/sysupgrade/sysupgrade.sh   26 Apr 2019 21:52:39 -  
> > 1.6
> > +++ usr.sbin/sysupgrade/sysupgrade.sh   27 Apr 2019 11:54:48 -
> > @@ -110,7 +110,19 @@ fi
> >  
> >  cd ${SETSDIR}
> >  
> > -unpriv -f SHA256.sig ftp -Vmo SHA256.sig ${URL}SHA256.sig
> > +unpriv -f SHA256.sig.tmp ftp -Vmo SHA256.sig.tmp ${URL}SHA256.sig
> > +TMP_SHA=$(sha256 -q SHA256.sig.tmp)
> > +
> > +unpriv touch SHA256.sig
> > +CUR_SHA=$(sha256 -q SHA256.sig)
> > +
> > +if [[ "${TMP_SHA}" = "${CUR_SHA}" ]]; then
> 
> Why compare checksums?
> 
> if cmp -s SHA256.sig SHA256.sig.tmp; then

cmp exits 1 on different files, thus killing the script

> 
> > +   rm SHA256.sig.tmp
> > +   return 0
> > +fi
> > +
> > +unpriv cat SHA256.sig.tmp >SHA256.sig
> > +rm SHA256.sig.tmp
> >  
> >  _KEY=openbsd-${_KERNV[0]%.*}${_KERNV[0]#*.}-base.pub
> >  _NEXTKEY=openbsd-${NEXT_VERSION%.*}${NEXT_VERSION#*.}-base.pub
> 
> -- 
> Andreas Kusalananda K?h?ri,
> National Bioinformatics Infrastructure Sweden (NBIS),
> Uppsala University, Sweden.



Re: Conditional sysupgrade

2019-04-28 Thread Marco Bonetti
On 04/27, Florian Obser wrote:
> On Sat, Apr 27, 2019 at 01:23:20PM +0100, Marco Bonetti wrote:
> > Hello folks,
> > 
> > First of all congratulations on a new OpenBSD release and thanks for
> > introducing sysupgrade in -current.
> > 
> > Before sysupgrade, I was using a custom script for achieving the same
> > result with only difference that I was checking if a new snapshot (or
> > release) is available by looking at BUILDINFO before starting the
> > upgrade process.
> > 
> > Patch below introduce the same behaviour using SHA256.sig as control
> > file. If you believe there is a valid use case for reinstalling already
> > applied sets to the running system please let me know and I can add a
> > -f force option.
> 
> I see a need for the feature and also for the -f flag. One idea was if
> you messed up your shared libs you just type sysupgrade to
> unbreak things. (Doesn't quite work since not all the tools are
> statically linked).

Added

> 
> I'm not happy with comparing the sha256 file, could you please use
> what(1) to compare the downloaded kernel with the running kernel?
> 
> $ sysctl -n kern.version | head -1
> OpenBSD 6.5-current (GENERIC.MP) #32: Fri Apr 26 10:37:48 MDT 2019
> $ what /home/_sysupgrade/bsd.mp | tail -1
>   OpenBSD 6.5-current (GENERIC.MP) #32: Fri Apr 26 10:37:48 MDT 2019
> 
> You need to check if you are running MP or SP though.
> 
> I have also suggested this to Mischa, added to Cc.

This has already been mentioned in the rest of the thread and doesn't
feel too right for me: the kernel can be modified and as a rule of thumb
a package manager or similar doesn't upgrade something if you changed
the content of a file locally. On the other hand if you applied local
modifications and run sysupgrade you robably want to overwrite the disk
contents :)

Maybe the -f option is enough for this?

Anyway, following patches also incorporate suggestions from the rest of
the thread.

Index: usr.sbin/sysupgrade/sysupgrade.8
===
RCS file: /cvs/src/usr.sbin/sysupgrade/sysupgrade.8,v
retrieving revision 1.2
diff -u -p -u -r1.2 sysupgrade.8
--- usr.sbin/sysupgrade/sysupgrade.826 Apr 2019 05:54:49 -  1.2
+++ usr.sbin/sysupgrade/sysupgrade.828 Apr 2019 22:59:52 -
@@ -23,12 +23,13 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl c
+.Op Fl f
 .Op Ar installurl
 .Sh DESCRIPTION
 .Nm
 is a utility to upgrade
 .Ox
-to the next release or a new snapshot.
+to the next release or a new snapshot if available.
 .Pp
 .Nm
 downloads the necessary files to
@@ -52,6 +53,10 @@ The default is to find out if the system
 In case of release
 .Nm
 downloads the next release.
+.It Fl f
+force an already applied upgrade.
+The default is to upgrade to latest snapshot only if available.
+This option has no effect on releases.
 .El
 .Sh FILES
 .Bl -tag -width "/home/_sysupgrade" -compact

Index: usr.sbin/sysupgrade/sysupgrade.sh
===
RCS file: /cvs/src/usr.sbin/sysupgrade/sysupgrade.sh,v
retrieving revision 1.7
diff -u -p -u -r1.7 sysupgrade.sh
--- usr.sbin/sysupgrade/sysupgrade.sh   28 Apr 2019 07:21:28 -  1.7
+++ usr.sbin/sysupgrade/sysupgrade.sh   28 Apr 2019 22:59:45 -
@@ -63,10 +63,12 @@ rmel() {
 }
 
 CURRENT=false
+FORCE=false
 
-while getopts c arg; do
+while getopts cf arg; do
 case ${arg} in
 c)  CURRENT=true;;
+f)  FORCE=true;;
 *)  usage;;
 esac
 done
@@ -110,7 +112,21 @@ fi
 
 cd ${SETSDIR}
 
-unpriv -f SHA256.sig ftp -Vmo SHA256.sig ${URL}SHA256.sig
+unpriv -f SHA256.sig.tmp ftp -Vmo SHA256.sig.tmp ${URL}SHA256.sig
+TMP_SHA=$(sha256 -q SHA256.sig.tmp)
+
+if [[ ! -f SHA256.sig ]]; then
+   unpriv -f SHA256.sig touch SHA256.sig
+fi
+CUR_SHA=$(sha256 -q SHA256.sig)
+
+if [[ "${TMP_SHA}" = "${CUR_SHA}"  && ${FORCE} != "true" ]]; then
+   rm SHA256.sig.tmp
+   return 0
+fi
+
+cat SHA256.sig.tmp >SHA256.sig
+rm SHA256.sig.tmp
 
 _KEY=openbsd-${_KERNV[0]%.*}${_KERNV[0]#*.}-base.pub
 _NEXTKEY=openbsd-${NEXT_VERSION%.*}${NEXT_VERSION#*.}-base.pub

Enjoy,
Marco

> 
> > 
> > Cheers,
> > Marco
> > 
> > Index: usr.sbin/sysupgrade/sysupgrade.8
> > ===
> > RCS file: /cvs/src/usr.sbin/sysupgrade/sysupgrade.8,v
> > retrieving revision 1.2
> > diff -u -p -u -r1.2 sysupgrade.8
> > --- usr.sbin/sysupgrade/sysupgrade.826 Apr 2019 05:54:49 -  
> > 1.2
> > +++ usr.sbin/sysupgrade/sysupgrade.827 Apr 2019 11:54:40 -
> > @@ -28,7 +28,7 @@
> >  .Nm
> >  is a utility to upgrade
> >  .Ox
> > -to the next release or a new snapshot.
> > +to the next release or a new snapshot if available.
> >  .Pp
> >  .Nm
> >  downloads the necessary files to
> > 
> > Index: usr.sbin/sysupgrade/sysupgrade.sh
> > ===
> > RCS file: /cvs/src/usr.sbin/sysupgrade/sysupgrade.sh,v
> > retrieving revision 1

Re: ospf(6)d: check rdomain for depend on interfaces

2019-04-28 Thread Sebastian Benoit
Remi Locherer(remi.loche...@relo.ch) on 2019.04.28 11:43:41 +0200:
> Hi,
> 
> the parser in ospf(6)d accepts depend on interfaces that are in a
> different rdomain. This works on startup of the daemon. But since it
> filters route messages based on it's rdomain it will not get notified
> if the depend on interface changes link state.
> 
> Below diff extends the existing conf_check_rdomain to also check the
> depend on interfaces.

I can think of examples where you could (ab)use this to redistribute a route
based on the availablility of some service running in a different rdomain
(but reachable through pf rtable tricks).

But then, not getting overwhelmed by route messages is more important. If
someone really needs it, we could make the filter configurable.

> OK?

ok benno@

> 
> Remi
> 
> 
> Index: ospfd/parse.y
> ===
> RCS file: /cvs/src/usr.sbin/ospfd/parse.y,v
> retrieving revision 1.95
> diff -u -p -r1.95 parse.y
> --- ospfd/parse.y 13 Feb 2019 22:57:08 -  1.95
> +++ ospfd/parse.y 28 Apr 2019 09:29:00 -
> @@ -1371,18 +1371,45 @@ conf_get_if(struct kif *kif, struct kif_
>  int
>  conf_check_rdomain(unsigned int rdomain)
>  {
> - struct area *a;
> - struct iface*i;
> - int  errs = 0;
> + struct area *a;
> + struct iface*i;
> + struct in_addr   addr;
> + struct kif  *kif;
> + struct redistribute *r;
> + int  errs = 0;
> +
> + SIMPLEQ_FOREACH(r, &conf->redist_list, entry)
> + if (r->dependon[0] != '\0') {
> + bzero(&addr, sizeof(addr));
> + kif = kif_findname(r->dependon, addr, NULL);
> + if (kif->rdomain != rdomain) {
> + logit(LOG_CRIT,
> + "depend on %s: interface not in rdomain %u",
> + kif->ifname, rdomain);
> + errs++;
> + }
> + }
>  
>   LIST_FOREACH(a, &conf->area_list, entry)
> - LIST_FOREACH(i, &a->iface_list, entry)
> + LIST_FOREACH(i, &a->iface_list, entry) {
>   if (i->rdomain != rdomain) {
>   logit(LOG_CRIT,
>   "interface %s not in rdomain %u",
>   i->name, rdomain);
>   errs++;
>   }
> + if (i->dependon[0] != '\0') {
> + bzero(&addr, sizeof(addr));
> + kif = kif_findname(i->dependon, addr, NULL);
> + if (kif->rdomain != rdomain) {
> + logit(LOG_CRIT,
> + "depend on %s: interface not in "
> + "rdomain %u",
> + kif->ifname, rdomain);
> + errs++;
> + }
> + }
> + }
>  
>   return (errs);
>  }
> Index: ospf6d/parse.y
> ===
> RCS file: /cvs/src/usr.sbin/ospf6d/parse.y,v
> retrieving revision 1.42
> diff -u -p -r1.42 parse.y
> --- ospf6d/parse.y13 Feb 2019 22:57:08 -  1.42
> +++ ospf6d/parse.y28 Apr 2019 09:28:33 -
> @@ -1151,18 +1151,41 @@ conf_get_area(struct in_addr id)
>  int
>  conf_check_rdomain(u_int rdomain)
>  {
> - struct area *a;
> - struct iface*i;
> - int  errs = 0;
> + struct area *a;
> + struct iface*i, *idep;
> + struct redistribute *r;
> + int  errs = 0;
> +
> + SIMPLEQ_FOREACH(r, &conf->redist_list, entry)
> + if (r->dependon[0] != '\0') {
> + idep = if_findname(r->dependon);
> + if (idep->rdomain != rdomain) {
> + logit(LOG_CRIT,
> + "depend on %s: interface not in rdomain %u",
> + idep->name, rdomain);
> + errs++;
> + }
> + }
>  
>   LIST_FOREACH(a, &conf->area_list, entry)
> - LIST_FOREACH(i, &a->iface_list, entry)
> + LIST_FOREACH(i, &a->iface_list, entry) {
>   if (i->rdomain != rdomain) {
>   logit(LOG_CRIT,
>   "interface %s not in rdomain %u",
>   i->name, rdomain);
>   errs++;
>   }
> + if (i->dependon[0] != '\0') {
> + idep = if_findname(i->dependon);
> + if (idep

Re: ld.so speedup (part 2)

2019-04-28 Thread Brian Callahan




On 4/28/19 6:01 AM, Matthieu Herrb wrote:

On Sun, Apr 28, 2019 at 08:55:16AM +0100, Stuart Henderson wrote:

On Sat, Apr 27, 2019 at 09:55:33PM +0800, Nathanael Rensen wrote:

The diff below speeds up ld.so library intialisation where the

dependency

tree is broad and deep, such as samba's smbd which links over 100

libraries.

Past experience with ld.so changes suggests it would be good to have
test reports from multiple arches, *especially* hppa.

The regress test seem to pass here on hppa.



Pass here too on hppa and macppc and armv7.

~Brian



Re: ld.so speedup (part 2)

2019-04-28 Thread Charlene Wendling
On Sun, 28 Apr 2019 13:04:22 +0200
Robert Nagy  wrote:

> On 28/04/19 12:01 +0200, Matthieu Herrb wrote:
> > On Sun, Apr 28, 2019 at 08:55:16AM +0100, Stuart Henderson wrote:
> > > > >> > On Sat, Apr 27, 2019 at 09:55:33PM +0800, Nathanael Rensen
> > > > >> > wrote:
> > > > >> > > The diff below speeds up ld.so library intialisation
> > > > >> > > where the
> > > > >>dependency
> > > > >> > > tree is broad and deep, such as samba's smbd which links
> > > > >> > > over 100
> > > > >>libraries.
> > > 
> > > Past experience with ld.so changes suggests it would be good to
> > > have test reports from multiple arches, *especially* hppa.
> > 
> > The regress test seem to pass here on hppa.

It seems good on macppc as well, here is the log [0]. Startup time for
clang has been reduced from 3.2s to 0.11s with the two diff applied!

> > -- 
> > Matthieu Herrb
> > 
> 
> This also fixes the component FLAVOR of chromium which uses a
> gazillion shared objects. Awesome work!
> 

Charlène.

[0] http://0x0.st/zbUa.txt



Re: ld.so speedup (part 2)

2019-04-28 Thread Robert Nagy
On 28/04/19 12:01 +0200, Matthieu Herrb wrote:
> On Sun, Apr 28, 2019 at 08:55:16AM +0100, Stuart Henderson wrote:
> > > >> > On Sat, Apr 27, 2019 at 09:55:33PM +0800, Nathanael Rensen wrote:
> > > >> > > The diff below speeds up ld.so library intialisation where the
> > > >>dependency
> > > >> > > tree is broad and deep, such as samba's smbd which links over 100
> > > >>libraries.
> > 
> > Past experience with ld.so changes suggests it would be good to have
> > test reports from multiple arches, *especially* hppa.
> 
> The regress test seem to pass here on hppa.
> 
> -- 
> Matthieu Herrb
> 

This also fixes the component FLAVOR of chromium which uses a gazillion
shared objects. Awesome work!



Re: ld.so speedup (part 2)

2019-04-28 Thread Matthieu Herrb
On Sun, Apr 28, 2019 at 08:55:16AM +0100, Stuart Henderson wrote:
> > >> > On Sat, Apr 27, 2019 at 09:55:33PM +0800, Nathanael Rensen wrote:
> > >> > > The diff below speeds up ld.so library intialisation where the
> > >>dependency
> > >> > > tree is broad and deep, such as samba's smbd which links over 100
> > >>libraries.
> 
> Past experience with ld.so changes suggests it would be good to have
> test reports from multiple arches, *especially* hppa.

The regress test seem to pass here on hppa.

-- 
Matthieu Herrb



ospf(6)d: check rdomain for depend on interfaces

2019-04-28 Thread Remi Locherer
Hi,

the parser in ospf(6)d accepts depend on interfaces that are in a
different rdomain. This works on startup of the daemon. But since it
filters route messages based on it's rdomain it will not get notified
if the depend on interface changes link state.

Below diff extends the existing conf_check_rdomain to also check the
depend on interfaces.

OK?

Remi


Index: ospfd/parse.y
===
RCS file: /cvs/src/usr.sbin/ospfd/parse.y,v
retrieving revision 1.95
diff -u -p -r1.95 parse.y
--- ospfd/parse.y   13 Feb 2019 22:57:08 -  1.95
+++ ospfd/parse.y   28 Apr 2019 09:29:00 -
@@ -1371,18 +1371,45 @@ conf_get_if(struct kif *kif, struct kif_
 int
 conf_check_rdomain(unsigned int rdomain)
 {
-   struct area *a;
-   struct iface*i;
-   int  errs = 0;
+   struct area *a;
+   struct iface*i;
+   struct in_addr   addr;
+   struct kif  *kif;
+   struct redistribute *r;
+   int  errs = 0;
+
+   SIMPLEQ_FOREACH(r, &conf->redist_list, entry)
+   if (r->dependon[0] != '\0') {
+   bzero(&addr, sizeof(addr));
+   kif = kif_findname(r->dependon, addr, NULL);
+   if (kif->rdomain != rdomain) {
+   logit(LOG_CRIT,
+   "depend on %s: interface not in rdomain %u",
+   kif->ifname, rdomain);
+   errs++;
+   }
+   }
 
LIST_FOREACH(a, &conf->area_list, entry)
-   LIST_FOREACH(i, &a->iface_list, entry)
+   LIST_FOREACH(i, &a->iface_list, entry) {
if (i->rdomain != rdomain) {
logit(LOG_CRIT,
"interface %s not in rdomain %u",
i->name, rdomain);
errs++;
}
+   if (i->dependon[0] != '\0') {
+   bzero(&addr, sizeof(addr));
+   kif = kif_findname(i->dependon, addr, NULL);
+   if (kif->rdomain != rdomain) {
+   logit(LOG_CRIT,
+   "depend on %s: interface not in "
+   "rdomain %u",
+   kif->ifname, rdomain);
+   errs++;
+   }
+   }
+   }
 
return (errs);
 }
Index: ospf6d/parse.y
===
RCS file: /cvs/src/usr.sbin/ospf6d/parse.y,v
retrieving revision 1.42
diff -u -p -r1.42 parse.y
--- ospf6d/parse.y  13 Feb 2019 22:57:08 -  1.42
+++ ospf6d/parse.y  28 Apr 2019 09:28:33 -
@@ -1151,18 +1151,41 @@ conf_get_area(struct in_addr id)
 int
 conf_check_rdomain(u_int rdomain)
 {
-   struct area *a;
-   struct iface*i;
-   int  errs = 0;
+   struct area *a;
+   struct iface*i, *idep;
+   struct redistribute *r;
+   int  errs = 0;
+
+   SIMPLEQ_FOREACH(r, &conf->redist_list, entry)
+   if (r->dependon[0] != '\0') {
+   idep = if_findname(r->dependon);
+   if (idep->rdomain != rdomain) {
+   logit(LOG_CRIT,
+   "depend on %s: interface not in rdomain %u",
+   idep->name, rdomain);
+   errs++;
+   }
+   }
 
LIST_FOREACH(a, &conf->area_list, entry)
-   LIST_FOREACH(i, &a->iface_list, entry)
+   LIST_FOREACH(i, &a->iface_list, entry) {
if (i->rdomain != rdomain) {
logit(LOG_CRIT,
"interface %s not in rdomain %u",
i->name, rdomain);
errs++;
}
+   if (i->dependon[0] != '\0') {
+   idep = if_findname(i->dependon);
+   if (idep->rdomain != rdomain) {
+   logit(LOG_CRIT,
+   "depend on %s: interface not in "
+   "rdomain %u",
+   idep->name, rdomain);
+   errs++;
+   }
+   }
+   }
 
return (errs);
 }



Re: ld.so speedup (part 2)

2019-04-28 Thread Stuart Henderson
> >> > On Sat, Apr 27, 2019 at 09:55:33PM +0800, Nathanael Rensen wrote:
> >> > > The diff below speeds up ld.so library intialisation where the
> >>dependency
> >> > > tree is broad and deep, such as samba's smbd which links over 100
> >>libraries.

Past experience with ld.so changes suggests it would be good to have
test reports from multiple arches, *especially* hppa.

On 2019/04/28 01:57, Ian McWilliam wrote:
> Using both patches on old hardware helps speed up the process but I still
> see the rc script timeout before smbd is loaded causing the rest of the
> samba processes to fail to load. This did not happen under 6.4 (amd64) so
> the change of linker / compiler update is still potentially where the
> problem may lie. 
> 
> Starting smbd with both patches
>  0m46.55s real 0m46.47s user 0m00.07s system

This doesn't match my experience:

$ time sudo rcctl start samba
smbd(ok)
nmbd(ok)
0m00.81s real 0m00.31s user 0m00.31s system



Re: Conditional sysupgrade

2019-04-28 Thread Mischa
On 27 Apr at 22:57, Florian Obser  wrote:
> On Sat, Apr 27, 2019 at 09:53:08PM +0200, Mischa Peters wrote:
> > Let me know if this needs more work. Love the idea of sysupgrade!
> 
> Please shelf this for now, there is a lot of churn going on in the
> tool in private and we are moving very fast.
> 
> There are more subtleties to consider.

Ok. Did get some good suggestions on my shell use, so might be able to put them 
to use at a later stage.

Mischa