bge(4): fix iLO/IPMI remote access problem at bge_attach()
Hi tech@, While booting OpenBSD on HPE ProLiant DL20 Gen9, iLO/IPMI remote access is stopped dozens of seconds, and client app give up the connection. This patch reduces it to few seconds and make the connection online. >From FreeBSD https://svnweb.freebsd.org/base?view=revision&revision=248226 Index: sys/dev/pci/if_bge.c === RCS file: /cvs/src/sys/dev/pci/if_bge.c,v retrieving revision 1.385 diff -u -p -r1.385 if_bge.c --- sys/dev/pci/if_bge.c13 Feb 2017 00:56:32 - 1.385 +++ sys/dev/pci/if_bge.c24 Jul 2017 04:09:15 - @@ -2879,11 +2879,11 @@ bge_attach(struct device *parent, struct /* Try to reset the chip. */ DPRINTFN(5, ("bge_reset\n")); - bge_sig_pre_reset(sc, BGE_RESET_START); + bge_sig_pre_reset(sc, BGE_RESET_SHUTDOWN); bge_reset(sc); - bge_sig_legacy(sc, BGE_RESET_START); - bge_sig_post_reset(sc, BGE_RESET_START); + bge_sig_legacy(sc, BGE_RESET_SHUTDOWN); + bge_sig_post_reset(sc, BGE_RESET_SHUTDOWN); bge_chipinit(sc); @@ -3233,6 +3233,19 @@ bge_reset(struct bge_softc *sc) } else write_op = bge_writereg_ind; + if (BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM5700 && + BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM5701) { + CSR_WRITE_4(sc, BGE_NVRAM_SWARB, BGE_NVRAMSWARB_SET1); + for (i = 0; i < 8000; i++) { + if (CSR_READ_4(sc, BGE_NVRAM_SWARB) & + BGE_NVRAMSWARB_GNT1) + break; + DELAY(20); + } + if (i == 8000) + printf("%s: nvram lock timed out\n", + sc->bge_dev.dv_xname); + } /* Take APE lock when performing reset. */ bge_ape_lock(sc, BGE_APE_LOCK_GRC);
make: efree/free
Hi, Some parts of make(1) use free() and others use efree() but efree is just a define for free. Remove efree? - Michael Index: arch.c === RCS file: /cvs/src/usr.bin/make/arch.c,v retrieving revision 1.88 diff -u -p -u -r1.88 arch.c --- arch.c 21 Jul 2017 09:29:42 - 1.88 +++ arch.c 24 Jul 2017 02:43:08 - @@ -411,7 +411,7 @@ read_archive(const char *archive, const /* Whole archive read ok. */ if (n == 0 && feof(arch)) { - efree(list.fnametab); + free(list.fnametab); fclose(arch); return ar; } @@ -495,7 +495,7 @@ read_archive(const char *archive, const fclose(arch); ohash_delete(&ar->members); - efree(list.fnametab); + free(list.fnametab); free(ar); return NULL; } @@ -762,7 +762,7 @@ ArchFindMember( #endif if (length == sizeof(arHeaderPtr->ar_name) || memberName[length] == ' ') { - efree(list.fnametab); + free(list.fnametab); return arch; } } @@ -786,7 +786,7 @@ ArchFindMember( continue; /* Got the entry. */ if (strcmp(memberName, member) == 0) { - efree(list.fnametab); + free(list.fnametab); return arch; } } @@ -812,7 +812,7 @@ ArchFindMember( printf("ArchFind: Extended format entry for %s\n", ename); /* Found as extended name. */ if (strcmp(ename, member) == 0) { - efree(list.fnametab); + free(list.fnametab); return arch; } } @@ -826,7 +826,7 @@ ArchFindMember( /* We did not find the member, or we ran into an error while reading * the archive. */ #ifdef SVRARCHIVES - efree(list.fnametab); + free(list.fnametab); #endif fclose(arch); return NULL; Index: suff.c === RCS file: /cvs/src/usr.bin/make/suff.c,v retrieving revision 1.91 diff -u -p -u -r1.91 suff.c --- suff.c 21 Oct 2016 16:12:38 - 1.91 +++ suff.c 24 Jul 2017 02:43:09 - @@ -1531,7 +1531,7 @@ sfnd_abort: * path to be the name so Dir_MTime won't go grovelling * for it. */ gn->suffix = targ == NULL ? NULL : targ->suff; - efree(gn->path); + free(gn->path); gn->path = estrdup(gn->name); } @@ -1602,7 +1602,7 @@ sfnd_abort: gn->suffix = src->suff; /* So Dir_MTime doesn't go questing for it... */ - efree(gn->path); + free(gn->path); gn->path = estrdup(gn->name); /* Nuke the transformation path and the Src structures left over in the Index: memory.h === RCS file: /cvs/src/usr.bin/make/memory.h,v retrieving revision 1.9 diff -u -p -u -r1.9 memory.h --- memory.h18 May 2014 08:08:50 - 1.9 +++ memory.h24 Jul 2017 02:43:09 - @@ -45,10 +45,6 @@ extern void *ereallocarray(void *, size_ extern int eunlink(const char *); extern void esetenv(const char *, const char *); -/* efree(x) works when x==NULL. STDC behavior, may need some different - * definition for cross-builds on deficient systems */ -#define efree free - extern void *hash_calloc(size_t, size_t, void *); extern void hash_free(void *, void *); extern void *element_alloc(size_t, void *);
Re: broken base build at src/usr/lib/libpcap?
On Sun, Jul 23, 2017 at 05:40:24PM -0400, Rob Pierce wrote: > yacc -ppcap_yy -d grammar.y > cc -O2 -pipe -g -I. -I/usr/src/lib/libpcap -Dyylval=pcap_yylval > -DHAVE_SYS_IOCCOM_H -DHAVE_SYS_SOCKIO_H -DHAVE_ETHER_HOSTTON -DHAVE_STRERROR > -DHAVE_SOCKADDR_SA_LEN -DLBL_ALIGN -DHAVE_IFADDRS_H -DINET6 > -DHAVE_BSD_IEEE80211 -c -o grammar.o y.tab.c > rm -f y.tab.c > lex -Ppcap_yy scanner.l > cc -O2 -pipe -g -I. -I/usr/src/lib/libpcap -Dyylval=pcap_yylval > -DHAVE_SYS_IOCCOM_H -DHAVE_SYS_SOCKIO_H -DHAVE_ETHER_HOSTTON -DHAVE_STRERROR > -DHAVE_SOCKADDR_SA_LEN -DLBL_ALIGN -DHAVE_IFADDRS_H -DINET6 > -DHAVE_BSD_IEEE80211 -c -o scanner.o lex.yy.c > cc: lex.yy.c: No such file or directory > cc: no input files Building part of source seldom goes well. Especially WITHOUT updating share/mk first.
Re: broken base build at src/usr/lib/libpcap?
> From: "Rob Pierce" > To: "tech" > Sent: Sunday, July 23, 2017 5:40:24 PM > Subject: broken base build at src/usr/lib/libpcap? > My build breaks at usr/lib/libpcap: Sorry, I jumped the gun. Works fine after another update.
broken base build at src/usr/lib/libpcap?
My build breaks at usr/lib/libpcap: cc -O2 -pipe -g -I. -I/usr/src/lib/libpcap -Dyylval=pcap_yylval -DHAVE_SYS_IOCCOM_H -DHAVE_SYS_SOCKIO_H -DHAVE_ETHER_HOSTTON -DHAVE_STRERROR -DHAVE_SOCKADDR_SA_LEN -DLBL_ALIGN -DHAVE_IFADDRS_H -DINET6 -DHAVE_BSD_IEEE80211 -c pcap.c -o pcap.o cc -O2 -pipe -g -I. -I/usr/src/lib/libpcap -Dyylval=pcap_yylval -DHAVE_SYS_IOCCOM_H -DHAVE_SYS_SOCKIO_H -DHAVE_ETHER_HOSTTON -DHAVE_STRERROR -DHAVE_SOCKADDR_SA_LEN -DLBL_ALIGN -DHAVE_IFADDRS_H -DINET6 -DHAVE_BSD_IEEE80211 -c inet.c -o inet.o cc -O2 -pipe -g -I. -I/usr/src/lib/libpcap -Dyylval=pcap_yylval -DHAVE_SYS_IOCCOM_H -DHAVE_SYS_SOCKIO_H -DHAVE_ETHER_HOSTTON -DHAVE_STRERROR -DHAVE_SOCKADDR_SA_LEN -DLBL_ALIGN -DHAVE_IFADDRS_H -DINET6 -DHAVE_BSD_IEEE80211 -c gencode.c -o gencode.o cc -O2 -pipe -g -I. -I/usr/src/lib/libpcap -Dyylval=pcap_yylval -DHAVE_SYS_IOCCOM_H -DHAVE_SYS_SOCKIO_H -DHAVE_ETHER_HOSTTON -DHAVE_STRERROR -DHAVE_SOCKADDR_SA_LEN -DLBL_ALIGN -DHAVE_IFADDRS_H -DINET6 -DHAVE_BSD_IEEE80211 -c optimize.c -o optimize.o cc -O2 -pipe -g -I. -I/usr/src/lib/libpcap -Dyylval=pcap_yylval -DHAVE_SYS_IOCCOM_H -DHAVE_SYS_SOCKIO_H -DHAVE_ETHER_HOSTTON -DHAVE_STRERROR -DHAVE_SOCKADDR_SA_LEN -DLBL_ALIGN -DHAVE_IFADDRS_H -DINET6 -DHAVE_BSD_IEEE80211 -c nametoaddr.c -o nametoaddr.o cc -O2 -pipe -g -I. -I/usr/src/lib/libpcap -Dyylval=pcap_yylval -DHAVE_SYS_IOCCOM_H -DHAVE_SYS_SOCKIO_H -DHAVE_ETHER_HOSTTON -DHAVE_STRERROR -DHAVE_SOCKADDR_SA_LEN -DLBL_ALIGN -DHAVE_IFADDRS_H -DINET6 -DHAVE_BSD_IEEE80211 -c etherent.c -o etherent.o cc -O2 -pipe -g -I. -I/usr/src/lib/libpcap -Dyylval=pcap_yylval -DHAVE_SYS_IOCCOM_H -DHAVE_SYS_SOCKIO_H -DHAVE_ETHER_HOSTTON -DHAVE_STRERROR -DHAVE_SOCKADDR_SA_LEN -DLBL_ALIGN -DHAVE_IFADDRS_H -DINET6 -DHAVE_BSD_IEEE80211 -c savefile.c -o savefile.o cc -O2 -pipe -g -I. -I/usr/src/lib/libpcap -Dyylval=pcap_yylval -DHAVE_SYS_IOCCOM_H -DHAVE_SYS_SOCKIO_H -DHAVE_ETHER_HOSTTON -DHAVE_STRERROR -DHAVE_SOCKADDR_SA_LEN -DLBL_ALIGN -DHAVE_IFADDRS_H -DINET6 -DHAVE_BSD_IEEE80211 -c /usr/src/lib/libpcap/../../sys/net/bpf_filter.c -o bpf_filter.o cc -O2 -pipe -g -I. -I/usr/src/lib/libpcap -Dyylval=pcap_yylval -DHAVE_SYS_IOCCOM_H -DHAVE_SYS_SOCKIO_H -DHAVE_ETHER_HOSTTON -DHAVE_STRERROR -DHAVE_SOCKADDR_SA_LEN -DLBL_ALIGN -DHAVE_IFADDRS_H -DINET6 -DHAVE_BSD_IEEE80211 -c bpf_image.c -o bpf_image.o yacc -ppcap_yy -d grammar.y cc -O2 -pipe -g -I. -I/usr/src/lib/libpcap -Dyylval=pcap_yylval -DHAVE_SYS_IOCCOM_H -DHAVE_SYS_SOCKIO_H -DHAVE_ETHER_HOSTTON -DHAVE_STRERROR -DHAVE_SOCKADDR_SA_LEN -DLBL_ALIGN -DHAVE_IFADDRS_H -DINET6 -DHAVE_BSD_IEEE80211 -c -o grammar.o y.tab.c rm -f y.tab.c lex -Ppcap_yy scanner.l cc -O2 -pipe -g -I. -I/usr/src/lib/libpcap -Dyylval=pcap_yylval -DHAVE_SYS_IOCCOM_H -DHAVE_SYS_SOCKIO_H -DHAVE_ETHER_HOSTTON -DHAVE_STRERROR -DHAVE_SOCKADDR_SA_LEN -DLBL_ALIGN -DHAVE_IFADDRS_H -DINET6 -DHAVE_BSD_IEEE80211 -c -o scanner.o lex.yy.c cc: lex.yy.c: No such file or directory cc: no input files *** Error 1 in /usr/src/lib/libpcap (:196 'scanner.o')
Re: armv7 sunxi i2c+pmic(=shutdown -p)
> Date: Wed, 19 Jul 2017 04:32:45 +0300 > From: Artturi Alm > > On Sun, Jul 16, 2017 at 11:13:35PM +0200, Mark Kettenis wrote: > > > Date: Sun, 9 Jul 2017 20:34:29 +0300 > > > From: Artturi Alm > > > > > > Hi, > > > > > > revived the diff below, i2c tested via pmic's shutdown(), for working > > > "shutdown -p now" operation. > > > there was only two i2c's w/"status: 'okay'" in the FDT, so not all of > > > them do attach. > > > > > > related part of dmesg: > > > > > > com0: console > > > sxitwi0 at simplebus0 > > > iic0 at sxitwi0 > > > axppmic0 at iic0 addr 0x34: AXP209, ACIN > > > sxitwi1 at simplebus0 > > > iic1 at sxitwi1 > > > dwge0 at simplebus0 > > > > > > Comments? > > > -Artturi > > > > It's a pity that the PSCI "firmware" doesn't do an actual shutdown. > > But having i2c support is worth having in its own right. > > > > A bit of a step backwards to add code under the old-style 4-clause BSD > > license, but I believe that is still acceptable. > > > > I don't think we'll ever support the Marvell Discovery hardware, so > > I'd just fold the gttwsi_core.c code into sxitwi.c and get rid of the > > GTTWSI_ALLWINNER hack. > > > > done in diff below, hope i understood correctly what you meant. Pretty much. I've made a few more cleanups and committed it. Thanks! Mark
unused struct in dhcpd.h
This struct appears to be unused at the moment. Regards, Rob Index: dhcpd.h === RCS file: /cvs/src/usr.sbin/dhcpd/dhcpd.h,v retrieving revision 1.64 diff -u -p -r1.64 dhcpd.h --- dhcpd.h 24 Apr 2017 14:58:36 - 1.64 +++ dhcpd.h 23 Jul 2017 15:19:18 - @@ -54,11 +54,6 @@ struct iaddr { unsigned char iabuf[16]; }; -struct iaddrlist { - struct iaddrlist *next; - struct iaddr addr; -}; - #define DEFAULT_HASH_SIZE 97 struct hash_bucket {
Re: apm(8): remove TRUE/FALSE defines
On Sun, Jul 23, 2017 at 03:04:54PM +0200, Anton Lindqvist wrote: > Hi, > Fairly straightforward and no intended functional change. If changes > like this one is not encouraged I would advocate on at least using > stdbool.h instead. > > Comments? OK? why? It might be old school, but there's noting wrong with this code. -Otto > > Index: apm.c > === > RCS file: /cvs/src/usr.sbin/apm/apm.c,v > retrieving revision 1.33 > diff -u -p -r1.33 apm.c > --- apm.c 23 Jul 2017 12:51:20 - 1.33 > +++ apm.c 23 Jul 2017 13:02:38 - > @@ -45,9 +45,6 @@ > #include "pathnames.h" > #include "apm-proto.h" > > -#define FALSE 0 > -#define TRUE 1 > - > extern char *__progname; > > static int do_zzz(int, enum apm_action); > @@ -145,12 +142,12 @@ int > main(int argc, char *argv[]) > { > const char *sockname = _PATH_APM_SOCKET; > - int doac = FALSE; > - int dopct = FALSE; > - int dobstate = FALSE; > - int domin = FALSE; > - int doperf = FALSE; > - int verbose = FALSE; > + int doac = 0; > + int dopct = 0; > + int dobstate = 0; > + int domin = 0; > + int doperf = 0; > + int verbose = 0; > int ch, fd, rval; > enum apm_action action = NONE; > struct apm_command command; > @@ -164,7 +161,7 @@ main(int argc, char *argv[]) > while ((ch = getopt(argc, argv, "ACHLlmbvaPSzZf:")) != -1) { > switch (ch) { > case 'v': > - verbose = TRUE; > + verbose = 1; > break; > case 'f': > sockname = optarg; > @@ -207,31 +204,31 @@ main(int argc, char *argv[]) > case 'b': > if (action != NONE && action != GETSTATUS) > usage(); > - dobstate = TRUE; > + dobstate = 1; > action = GETSTATUS; > break; > case 'l': > if (action != NONE && action != GETSTATUS) > usage(); > - dopct = TRUE; > + dopct = 1; > action = GETSTATUS; > break; > case 'm': > if (action != NONE && action != GETSTATUS) > usage(); > - domin = TRUE; > + domin = 1; > action = GETSTATUS; > break; > case 'a': > if (action != NONE && action != GETSTATUS) > usage(); > - doac = TRUE; > + doac = 1; > action = GETSTATUS; > break; > case 'P': > if (action != NONE && action != GETSTATUS) > usage(); > - doperf = TRUE; > + doperf = 1; > action = GETSTATUS; > break; > default: > @@ -280,7 +277,7 @@ main(int argc, char *argv[]) > goto balony; > case NONE: > action = GETSTATUS; > - verbose = doac = dopct = dobstate = domin = doperf = TRUE; > + verbose = doac = dopct = dobstate = domin = doperf = 1; > /* FALLTHROUGH */ > case GETSTATUS: > if (fd == -1) {
apm(8): remove TRUE/FALSE defines
Hi, Fairly straightforward and no intended functional change. If changes like this one is not encouraged I would advocate on at least using stdbool.h instead. Comments? OK? Index: apm.c === RCS file: /cvs/src/usr.sbin/apm/apm.c,v retrieving revision 1.33 diff -u -p -r1.33 apm.c --- apm.c 23 Jul 2017 12:51:20 - 1.33 +++ apm.c 23 Jul 2017 13:02:38 - @@ -45,9 +45,6 @@ #include "pathnames.h" #include "apm-proto.h" -#define FALSE 0 -#define TRUE 1 - extern char *__progname; static int do_zzz(int, enum apm_action); @@ -145,12 +142,12 @@ int main(int argc, char *argv[]) { const char *sockname = _PATH_APM_SOCKET; - int doac = FALSE; - int dopct = FALSE; - int dobstate = FALSE; - int domin = FALSE; - int doperf = FALSE; - int verbose = FALSE; + int doac = 0; + int dopct = 0; + int dobstate = 0; + int domin = 0; + int doperf = 0; + int verbose = 0; int ch, fd, rval; enum apm_action action = NONE; struct apm_command command; @@ -164,7 +161,7 @@ main(int argc, char *argv[]) while ((ch = getopt(argc, argv, "ACHLlmbvaPSzZf:")) != -1) { switch (ch) { case 'v': - verbose = TRUE; + verbose = 1; break; case 'f': sockname = optarg; @@ -207,31 +204,31 @@ main(int argc, char *argv[]) case 'b': if (action != NONE && action != GETSTATUS) usage(); - dobstate = TRUE; + dobstate = 1; action = GETSTATUS; break; case 'l': if (action != NONE && action != GETSTATUS) usage(); - dopct = TRUE; + dopct = 1; action = GETSTATUS; break; case 'm': if (action != NONE && action != GETSTATUS) usage(); - domin = TRUE; + domin = 1; action = GETSTATUS; break; case 'a': if (action != NONE && action != GETSTATUS) usage(); - doac = TRUE; + doac = 1; action = GETSTATUS; break; case 'P': if (action != NONE && action != GETSTATUS) usage(); - doperf = TRUE; + doperf = 1; action = GETSTATUS; break; default: @@ -280,7 +277,7 @@ main(int argc, char *argv[]) goto balony; case NONE: action = GETSTATUS; - verbose = doac = dopct = dobstate = domin = doperf = TRUE; + verbose = doac = dopct = dobstate = domin = doperf = 1; /* FALLTHROUGH */ case GETSTATUS: if (fd == -1) {
apm(8): static and __dead
Hi, Flag functions as static and __dead when appropriate. Allows apm to be compiled using `clang -Wall`. While here, sort and align function declarations. Comments? OK? Index: apm.c === RCS file: /cvs/src/usr.sbin/apm/apm.c,v retrieving revision 1.32 diff -u -p -r1.32 apm.c --- apm.c 1 Nov 2015 14:13:30 - 1.32 +++ apm.c 23 Jul 2017 09:55:25 - @@ -50,13 +50,13 @@ extern char *__progname; -void usage(void); -void zzusage(void); -int do_zzz(int, enum apm_action action); -int open_socket(const char *pn); -int send_command(int fd, struct apm_command *cmd, struct apm_reply *reply); +static int do_zzz(int, enum apm_action action); +static int open_socket(const char *pn); +static int send_command(int fd, struct apm_command *cmd, struct apm_reply *reply); +static __dead void usage(void); +static __dead void zzusage(void); -void +static __dead void usage(void) { fprintf(stderr,"usage: %s [-AabHLlmPSvZz] [-f sockname]\n", @@ -64,7 +64,7 @@ usage(void) exit(1); } -void +static __dead void zzusage(void) { fprintf(stderr,"usage: %s [-SZz] [-f sockname]\n", @@ -72,7 +72,7 @@ zzusage(void) exit(1); } -int +static int send_command(int fd, struct apm_command *cmd, struct apm_reply *reply) { /* send a command to the apm daemon */ @@ -90,7 +90,7 @@ send_command(int fd, struct apm_command return (0); } -int +static int do_zzz(int fd, enum apm_action action) { struct apm_command command; @@ -119,7 +119,7 @@ do_zzz(int fd, enum apm_action action) exit(send_command(fd, &command, &reply)); } -int +static int open_socket(const char *sockname) { int sock, errr;
Re: getdelim(3): perror -> err in example
Another two cents: err exists on linux as well, so there is zero practical reason not to use it.
Re: Add Diffie-Hellman group negotiation to iked
On 17-07-18 23:20:26, Tim Stewart wrote: > viq writes: > > > On 17-06-25 21:44:24, Tim Stewart wrote: > >> Hi, > >> > >> In this message I've tried to encode everything I've done to allow > >> strongSwan on Android to connect with iked, including the latest patch. > >> I have also verified that it breaks neither initial negotiation nor > >> Child SA rekeying for OpenBSD, Windows, and strongSwan (on Android) > >> clients. > > > > This patch gets my android phone much closer to being able to negotiate > > a connection, but there are still issues. Paraphrasing analysis mikeb > > performed on IRC: > > android sends incorrect (for us) group, and with this patch we now send > > a failure message and android retries. But, we don't increment msgid > > "because we did sa_free and restarted, so we can assume that android > > thinks that negotiation continues, that's why it re-sends the > > IKE_SA_INIT" > > I'm glad it seems to help, though it's too bad that the patch doesn't > work completely for you. > > I haven't really considered msgids--I'll do some more reading to see > what I might be missing there. I do know that resending an IKE_SA_INIT > message with a different DH group is correct, however, and this does > work on my phone. For your reference, the first line of my strongSwan > log tells me that I'm using strongSwan 5.5.3 and Android 7.1.1. > > I see that you forwarded the iked logs in a reply to this email. Is > this the full log after a fresh iked startup with no existing SAs? This is after a fresh startup, there exists an SA but for a separete site-to-site config I have in place. If completely fresh logs are needed I could comment that out. > Also, would it be possible to forward an anonymized config and the > strongSwan logs so that I can compare to mine? (I can also post my > logs, but I'll have to do it in the next day or two as I'm out of time > for today.) First, sorry for the delay with replying to this. Second, I'm not sure how to get to the logs, seeing as I'm using the built-in VPN client that came with Samsung S8.