vi: cs_next() return value
Hello, In vi, cs_next() always returns zero so don't check its return value. cs.cs_flags is always checked afterwards; cs.cs_flags seems to be the effective return value. I didn't change two invocations in v_word.c where cs_next() is 2nd operand in && expression and might be skipped. - Michael Index: vi/getc.c === RCS file: /cvs/src/usr.bin/vi/vi/getc.c,v retrieving revision 1.10 diff -u -p -u -r1.10 getc.c --- vi/getc.c 6 Jan 2016 22:28:52 - 1.10 +++ vi/getc.c 27 Apr 2017 03:20:35 - @@ -123,8 +123,7 @@ cs_fspace(SCR *sp, VCS *csp) if (csp->cs_flags != 0 || !isblank(csp->cs_ch)) return (0); for (;;) { - if (cs_next(sp, csp)) - return (1); + cs_next(sp, csp); if (csp->cs_flags != 0 || !isblank(csp->cs_ch)) break; } @@ -141,8 +140,7 @@ int cs_fblank(SCR *sp, VCS *csp) { for (;;) { - if (cs_next(sp, csp)) - return (1); + cs_next(sp, csp); if (csp->cs_flags == CS_EOL || csp->cs_flags == CS_EMP || (csp->cs_flags == 0 && isblank(csp->cs_ch))) continue; Index: vi/v_sentence.c === RCS file: /cvs/src/usr.bin/vi/vi/v_sentence.c,v retrieving revision 1.7 diff -u -p -u -r1.7 v_sentence.c --- vi/v_sentence.c 12 Nov 2014 04:28:41 - 1.7 +++ vi/v_sentence.c 27 Apr 2017 03:20:35 - @@ -82,14 +82,12 @@ v_sentencef(SCR *sp, VICMD *vp) } for (state = NONE;;) { - if (cs_next(sp, )) - return (1); + cs_next(sp, ); if (cs.cs_flags == CS_EOF) break; if (cs.cs_flags == CS_EOL) { if ((state == PERIOD || state == BLANK) && --cnt == 0) { - if (cs_next(sp, )) - return (1); + cs_next(sp, ); if (cs.cs_flags == 0 && isblank(cs.cs_ch) && cs_fblank(sp, )) return (1); @@ -273,8 +271,7 @@ ret:slno = cs.cs_lno; * and special characters. */ do { - if (cs_next(sp, )) - return (1); + cs_next(sp, ); } while (!cs.cs_flags && (cs.cs_ch == ')' || cs.cs_ch == ']' || cs.cs_ch == '"' || cs.cs_ch == '\'')); Index: vi/v_word.c === RCS file: /cvs/src/usr.bin/vi/vi/v_word.c,v retrieving revision 1.7 diff -u -p -u -r1.7 v_word.c --- vi/v_word.c 12 Nov 2014 04:28:41 - 1.7 +++ vi/v_word.c 27 Apr 2017 03:20:35 - @@ -140,8 +140,7 @@ fword(SCR *sp, VICMD *vp, enum which typ if (type == BIGWORD) while (cnt--) { for (;;) { - if (cs_next(sp, )) - return (1); + cs_next(sp, ); if (cs.cs_flags == CS_EOF) goto ret; if (cs.cs_flags != 0 || isblank(cs.cs_ch)) @@ -172,8 +171,7 @@ fword(SCR *sp, VICMD *vp, enum which typ state = cs.cs_flags == 0 && inword(cs.cs_ch) ? INWORD : NOTWORD; for (;;) { - if (cs_next(sp, )) - return (1); + cs_next(sp, ); if (cs.cs_flags == CS_EOF) goto ret; if (cs.cs_flags != 0 || isblank(cs.cs_ch)) @@ -276,8 +274,7 @@ eword(SCR *sp, VICMD *vp, enum which typ * past the current one, it sets word "state" for the 'e' command. */ if (cs.cs_flags == 0 && !isblank(cs.cs_ch)) { - if (cs_next(sp, )) - return (1); + cs_next(sp, ); if (cs.cs_flags == 0 && !isblank(cs.cs_ch)) goto start; } @@ -293,8 +290,7 @@ eword(SCR *sp, VICMD *vp, enum which typ start: if (type == BIGWORD) while (cnt--) { for (;;) { - if (cs_next(sp, )) - return (1); + cs_next(sp, ); if (cs.cs_flags == CS_EOF) goto ret;
arguments in amd64 ddb via -msave-args
this diff takes advantage of -msave-args to allow ddb to print arguments in stack traces on amd64. -msave-args basically pushes the functions register arguments onto the stack, so the code looks before (in memory) the base pointer for them. the rest of the arguments get passed normally, ie, after the base pointer, so ddb looks for them there. without CTF, ddb doesnt know how many arguments there are, so this has it blindly assume there's 6 if there's no CTF. this corresponds to how many register arguments there could be, but it is more about looking for enough arguments generally to be useful rather than too few. as per the mail about the gcc diff, ddb should now look like this: ddb{0}> tr Debugger(ff0866b9d400,7f7c7000,10,80002100dd00,286,8) at Debugger+0 x9 ddb_sysctl(80002100ddb4,1,7f7c5180,80002100dde0,7f7c5174,4) at d db_sysctl+0x1c9 sys_sysctl(800020fb39a0,80002100de60,80002100deb0,1,ca,1) at sys_sy sctl+0x239 syscall() at syscall+0x29f --- syscall (number 202) --- end of kernel end trace frame: 0x7f7c731f, count: -4 0x1c5881d106ea: ddb{0}> tr /p 0t34348 sleep_finish(800020f1ebc0,1,0,118,8194f100,ff0879dacc80) at sle ep_finish+0xc2 utsleep(ff0879dacc80,118,8178fea0,0,0,40) at utsleep+0x133 kqueue_scan(ff0879dacc80,40,1b3605246800,0,800020eb6018,800020f1ede 4) at kqueue_scan+0x19a sys_kevent(800020eb6018,800020f1ee60,800020f1eeb0,1,48,1) at sys_ke vent+0x2c9 syscall() at syscall+0x29f --- syscall (number 72) --- end of kernel end trace frame: 0x1b3605246800, count: -5 0x1b35be687b0a: ddb{0}> ive also tried to handle looking at registers instead of the stack if we're at the top of the current stack. i havent tested this though. id like -msave-args in gcc to be in the tree for a while before committing this. im sending it out now for feedback and review. Index: conf/Makefile.amd64 === RCS file: /cvs/src/sys/arch/amd64/conf/Makefile.amd64,v retrieving revision 1.75 diff -u -p -r1.75 Makefile.amd64 --- conf/Makefile.amd64 25 Jan 2017 11:15:07 - 1.75 +++ conf/Makefile.amd64 24 Apr 2017 21:54:32 - @@ -28,7 +28,7 @@ CWARNFLAGS= -Werror -Wall -Wimplicit-fun -Wframe-larger-than=2047 CMACHFLAGS=-mcmodel=kernel -mno-red-zone -mno-sse2 -mno-sse -mno-3dnow \ - -mno-mmx -msoft-float -fno-omit-frame-pointer + -mno-mmx -msoft-float -msave-args -fno-omit-frame-pointer CMACHFLAGS+= -ffreestanding ${NOPIE_FLAGS} .if ${IDENT:M-DNO_PROPOLICE} CMACHFLAGS+= -fno-stack-protector Index: amd64/db_trace.c === RCS file: /cvs/src/sys/arch/amd64/amd64/db_trace.c,v retrieving revision 1.26 diff -u -p -r1.26 db_trace.c --- amd64/db_trace.c20 Apr 2017 12:41:43 - 1.26 +++ amd64/db_trace.c24 Apr 2017 21:54:32 - @@ -100,7 +100,7 @@ db_numargs(struct callframe *fp, const c #ifdef DDBCTF return db_ctf_func_numargs(sym); #else - return 0; + return 6; #endif /* DDBCTF */ } @@ -175,12 +175,21 @@ db_is_trap(const char *name) return NONE; } +const unsigned long *db_reg_args[6] = { + (unsigned long *)_regs.tf_rdi, + (unsigned long *)_regs.tf_rsi, + (unsigned long *)_regs.tf_rdx, + (unsigned long *)_regs.tf_rcx, + (unsigned long *)_regs.tf_r8, + (unsigned long *)_regs.tf_r9, +}; + void db_stack_trace_print(db_expr_t addr, boolean_t have_addr, db_expr_t count, char *modif, int (*pr)(const char *, ...)) { struct callframe *frame, *lastframe; - long*argp, *arg0; + unsigned long *argp, *arg0; db_addr_t callpc; int is_trap = 0; boolean_t kernel_only = TRUE; @@ -220,7 +229,8 @@ db_stack_trace_print(db_expr_t addr, boo lastframe = 0; while (count && frame != 0) { int narg; - char * name; + unsigned inti; + char * name; db_expr_t offset; db_sym_tsym; @@ -229,7 +239,7 @@ db_stack_trace_print(db_expr_t addr, boo if (lastframe == 0 && sym == NULL) { /* Symbol not found, peek at code */ - longinstr = db_get_value(callpc, 8, FALSE); + unsigned long instr = db_get_value(callpc, 8, FALSE); offset = 1; if ((instr & 0x00ff) == 0x00e58955 || @@ -239,6 +249,7 @@ db_stack_trace_print(db_expr_t addr, boo offset = 0; } } + if (INKERNEL(callpc) && (is_trap = db_is_trap(name)) != NONE) narg = 0; else { @@ -249,22 +260,37 @@ db_stack_trace_print(db_expr_t addr, boo
Re: bin/ed: fix clang warnings
On Wed, 26 Apr 2017 22:56:57 +0200, Christian Weisgerber wrote: > The cases before and after follow the > > if (!interactive) { > if (garrulous) > ... > > pattern. *shrug* Yes, but in this case there is nothing to do if !garrulous which is different from the others. If you prefer to keep it as-is that is OK. - todd
Re: bin/ed: fix clang warnings
On Wed, 26 Apr 2017 22:10:49 +0200, Christian Weisgerber wrote: > This fixes the clang warnings in bin/ed. One extra pair of parentheses > and stop passing empty format strings to printf-family functions. One comment inline. Overall, I find the changes to be an improvement. I see that FreeBSD bungled the glbl.c change in their treee. - todd > Index: glbl.c > === > RCS file: /cvs/src/bin/ed/glbl.c,v > retrieving revision 1.18 > diff -u -p -r1.18 glbl.c > --- glbl.c22 Mar 2016 17:58:28 - 1.18 > +++ glbl.c26 Apr 2017 19:47:43 - > @@ -67,7 +67,7 @@ build_active_list(int isgcmd) > return ERR; > if (isbinary) > NUL_TO_NEWLINE(s, lp->len); > - if (!regexec(pat, s, 0, NULL, 0) == isgcmd && > + if ((!regexec(pat, s, 0, NULL, 0)) == isgcmd && > set_active_node(lp) < 0) > return ERR; > } > Index: io.c > === > RCS file: /cvs/src/bin/ed/io.c,v > retrieving revision 1.19 > diff -u -p -r1.19 io.c > --- io.c 22 Mar 2016 17:58:28 - 1.19 > +++ io.c 26 Apr 2017 19:49:57 - > @@ -63,7 +63,8 @@ read_file(char *fn, int n) > seterrmsg("cannot close input file"); > return ERR; > } > - fprintf(stderr, !scripted ? "%d\n" : "", size); > + if (!scripted) > + fprintf(stderr, "%d\n", size); > return current_addr - n; > } > > @@ -164,7 +165,8 @@ write_file(char *fn, char *mode, int n, > seterrmsg("cannot close output file"); > return ERR; > } > - fprintf(stderr, !scripted ? "%d\n" : "", size); > + if (!scripted) > + fprintf(stderr, "%d\n", size); > return n ? m - n + 1 : 0; > } > > Index: main.c > === > RCS file: /cvs/src/bin/ed/main.c,v > retrieving revision 1.59 > diff -u -p -r1.59 main.c > --- main.c3 Jan 2017 20:24:29 - 1.59 > +++ main.c26 Apr 2017 19:59:58 - > @@ -218,9 +218,10 @@ top: > fputs("?\n", stderr); > seterrmsg("warning: file modified"); > if (!interactive) { > - fprintf(stderr, garrulous ? > - "script, line %d: %s\n" : > - "", lineno, errmsg); > + if (garrulous) > + fprintf(stderr, > + "script, line %d: %s\n", > + lineno, errmsg); > quit(2); > } > clearerr(stdin); > @@ -252,28 +253,30 @@ top: > fputs("?\n", stderr); /* give warning */ > seterrmsg("warning: file modified"); > if (!interactive) { > - fprintf(stderr, garrulous ? > - "script, line %d: %s\n" : > - "", lineno, errmsg); > + if (garrulous) > + fprintf(stderr, > + "script, line %d: %s\n", > + lineno, errmsg); > quit(2); > } > break; > case FATAL: > - if (!interactive) > - fprintf(stderr, garrulous ? > - "script, line %d: %s\n" : "", > - lineno, errmsg); > - else > - fprintf(stderr, garrulous ? "%s\n" : "", > - errmsg); > + if (!interactive) { > + if (garrulous) > + fprintf(stderr, > + "script, line %d: %s\n", > + lineno, errmsg); > + } else if (garrulous) > + fprintf(stderr, "%s\n", errmsg); Would this be better as: if (garrulous) { if (!interactive) fprintf(stderr, "script, line %d: %s\n", lineno, errmsg); else fprintf(stderr, "%s\n", errmsg); } > quit(3); > break; > default: >
bin/ed: fix clang warnings
This fixes the clang warnings in bin/ed. One extra pair of parentheses and stop passing empty format strings to printf-family functions. ok? Index: glbl.c === RCS file: /cvs/src/bin/ed/glbl.c,v retrieving revision 1.18 diff -u -p -r1.18 glbl.c --- glbl.c 22 Mar 2016 17:58:28 - 1.18 +++ glbl.c 26 Apr 2017 19:47:43 - @@ -67,7 +67,7 @@ build_active_list(int isgcmd) return ERR; if (isbinary) NUL_TO_NEWLINE(s, lp->len); - if (!regexec(pat, s, 0, NULL, 0) == isgcmd && + if ((!regexec(pat, s, 0, NULL, 0)) == isgcmd && set_active_node(lp) < 0) return ERR; } Index: io.c === RCS file: /cvs/src/bin/ed/io.c,v retrieving revision 1.19 diff -u -p -r1.19 io.c --- io.c22 Mar 2016 17:58:28 - 1.19 +++ io.c26 Apr 2017 19:49:57 - @@ -63,7 +63,8 @@ read_file(char *fn, int n) seterrmsg("cannot close input file"); return ERR; } - fprintf(stderr, !scripted ? "%d\n" : "", size); + if (!scripted) + fprintf(stderr, "%d\n", size); return current_addr - n; } @@ -164,7 +165,8 @@ write_file(char *fn, char *mode, int n, seterrmsg("cannot close output file"); return ERR; } - fprintf(stderr, !scripted ? "%d\n" : "", size); + if (!scripted) + fprintf(stderr, "%d\n", size); return n ? m - n + 1 : 0; } Index: main.c === RCS file: /cvs/src/bin/ed/main.c,v retrieving revision 1.59 diff -u -p -r1.59 main.c --- main.c 3 Jan 2017 20:24:29 - 1.59 +++ main.c 26 Apr 2017 19:59:58 - @@ -218,9 +218,10 @@ top: fputs("?\n", stderr); seterrmsg("warning: file modified"); if (!interactive) { - fprintf(stderr, garrulous ? - "script, line %d: %s\n" : - "", lineno, errmsg); + if (garrulous) + fprintf(stderr, + "script, line %d: %s\n", + lineno, errmsg); quit(2); } clearerr(stdin); @@ -252,28 +253,30 @@ top: fputs("?\n", stderr); /* give warning */ seterrmsg("warning: file modified"); if (!interactive) { - fprintf(stderr, garrulous ? - "script, line %d: %s\n" : - "", lineno, errmsg); + if (garrulous) + fprintf(stderr, + "script, line %d: %s\n", + lineno, errmsg); quit(2); } break; case FATAL: - if (!interactive) - fprintf(stderr, garrulous ? - "script, line %d: %s\n" : "", - lineno, errmsg); - else - fprintf(stderr, garrulous ? "%s\n" : "", - errmsg); + if (!interactive) { + if (garrulous) + fprintf(stderr, + "script, line %d: %s\n", + lineno, errmsg); + } else if (garrulous) + fprintf(stderr, "%s\n", errmsg); quit(3); break; default: fputs("?\n", stderr); if (!interactive) { - fprintf(stderr, garrulous ? - "script, line %d: %s\n" : "", - lineno, errmsg); + if (garrulous) + fprintf(stderr, + "script, line %d: %s\n", + lineno, errmsg); quit(2); } break; -- Christian "naddy" Weisgerber na...@mips.inka.de
Re: ARM64: attach CPUs for identification purposes.
> From: David Gwynne> Date: Tue, 25 Apr 2017 11:06:52 +1000 > > > On 25 Apr 2017, at 6:18 am, Mark Kettenis wrote: > > > >> Date: Mon, 24 Apr 2017 16:01:39 -0400 > >> From: Dale Rahn > >> > >> The below code is set up to attach and identify processors for arm64 > >> currently it only identifies model, not cache size, but that can be added > >> later. It is set up to attach secondary processors later (for when SMP > >> is present). > > > > I don't think this cpubus(4) device makes much sense. We don't have > > something like that on other FDT/OpenFirmware architectures. > > there's this: > > mainbus0 at root: SPARC Enterprise M4000 Server > cmp0 at mainbus0 > core0 at cmp0 > cpu0 at core0: FJSV,SPARC64-VI (rev 9.3) @ 2150 MHz > cpu0: physical 128K instruction (64 b/l), 128K data (64 b/l), 5120K external > (256 b/l) > cpu1 at core0: FJSV,SPARC64-VI (rev 9.3) @ 2150 MHz > cpu1: physical 128K instruction (64 b/l), 128K data (64 b/l), 5120K external > (256 b/l) > core1 at cmp0 > cpu2 at core1: FJSV,SPARC64-VI (rev 9.3) @ 2150 MHz > cpu2: physical 128K instruction (64 b/l), 128K data (64 b/l), 5120K external > (256 b/l) > cpu3 at core1: FJSV,SPARC64-VI (rev 9.3) @ 2150 MHz > cpu3: physical 128K instruction (64 b/l), 128K data (64 b/l), 5120K external > (256 b/l) > cmp1 at mainbus0 > core2 at cmp1 > cpu4 at core2: FJSV,SPARC64-VI (rev 9.3) @ 2150 MHz > cpu4: physical 128K instruction (64 b/l), 128K data (64 b/l), 5120K external > (256 b/l) > cpu5 at core2: FJSV,SPARC64-VI (rev 9.3) @ 2150 MHz > cpu5: physical 128K instruction (64 b/l), 128K data (64 b/l), 5120K external > (256 b/l) > core3 at cmp1 > cpu6 at core3: FJSV,SPARC64-VI (rev 9.3) @ 2150 MHz > cpu6: physical 128K instruction (64 b/l), 128K data (64 b/l), 5120K external > (256 b/l) > cpu7 at core3: FJSV,SPARC64-VI (rev 9.3) @ 2150 MHz > cpu7: physical 128K instruction (64 b/l), 128K data (64 b/l), 5120K external > (256 b/l) That's a bit of a special case though. For one thing Sun never put the CPUs under /cpus. And on these machines the hierarchy expresses the topology of sockets, cores and threads, where the nodes all have interesting proprties. Cheers, Mark
Re: install man8/arm64/{MAKEDEV,eeprom}.8
> Date: Wed, 26 Apr 2017 14:56:58 +0100 > From: Stuart Henderson> > ok? Sure. > Index: etc/mtree/4.4BSD.dist > === > RCS file: /cvs/src/etc/mtree/4.4BSD.dist,v > retrieving revision 1.297 > diff -u -p -r1.297 4.4BSD.dist > --- etc/mtree/4.4BSD.dist 18 Apr 2017 15:15:09 - 1.297 > +++ etc/mtree/4.4BSD.dist 26 Apr 2017 13:55:56 - > @@ -523,6 +523,8 @@ usr > .. > amd64 > .. > +arm64 > +.. > armv7 > .. > hppa > Index: distrib/sets/lists/base/mi > === > RCS file: /cvs/src/distrib/sets/lists/base/mi,v > retrieving revision 1.835 > diff -u -p -r1.835 mi > --- distrib/sets/lists/base/mi20 Apr 2017 18:30:33 - 1.835 > +++ distrib/sets/lists/base/mi26 Apr 2017 13:55:56 - > @@ -2628,6 +2628,7 @@ > ./usr/share/man/man8/afterboot.8 > ./usr/share/man/man8/alpha > ./usr/share/man/man8/amd64 > +./usr/share/man/man8/arm64 > ./usr/share/man/man8/armv7 > ./usr/share/man/man8/hppa > ./usr/share/man/man8/i386 > Index: distrib/sets/lists/man/mi > === > RCS file: /cvs/src/distrib/sets/lists/man/mi,v > retrieving revision 1.1410 > diff -u -p -r1.1410 mi > --- distrib/sets/lists/man/mi 22 Apr 2017 17:47:21 - 1.1410 > +++ distrib/sets/lists/man/mi 26 Apr 2017 13:55:56 - > @@ -2063,6 +2063,8 @@ > ./usr/share/man/man8/amd64/pxeboot.8 > ./usr/share/man/man8/amd64/wsmoused.8 > ./usr/share/man/man8/amq.8 > +./usr/share/man/man8/arm64/MAKEDEV.8 > +./usr/share/man/man8/arm64/eeprom.8 > ./usr/share/man/man8/armv7/MAKEDEV.8 > ./usr/share/man/man8/armv7/eeprom.8 > ./usr/share/man/man8/armv7/gpioctl.8 > Index: share/man/man8/Makefile > === > RCS file: /cvs/src/share/man/man8/Makefile,v > retrieving revision 1.96 > diff -u -p -r1.96 Makefile > --- share/man/man8/Makefile 3 Sep 2016 13:37:41 - 1.96 > +++ share/man/man8/Makefile 26 Apr 2017 13:55:56 - > @@ -8,7 +8,7 @@ MAN= afterboot.8 autoinstall.8 boot_conf > rc.conf.8 rc.d.8 rc.shutdown.8 rc.subr.8 release.8 \ > security.8 ssl.8 starttls.8 sticky.8 yp.8 > > -SUBDIR= man8.alpha man8.amd64 man8.armv7 \ > +SUBDIR= man8.alpha man8.amd64 man8.arm64 man8.armv7 \ > man8.hppa man8.i386 man8.landisk \ > man8.loongson man8.luna88k man8.macppc \ > man8.octeon man8.sgi man8.socppc man8.sparc64 > Index: share/man/man8/man8.arm64/Makefile > === > RCS file: share/man/man8/man8.arm64/Makefile > diff -N share/man/man8/man8.arm64/Makefile > --- /dev/null 1 Jan 1970 00:00:00 - > +++ share/man/man8/man8.arm64/Makefile26 Apr 2017 13:55:56 - > @@ -0,0 +1,6 @@ > +#$OpenBSD$ > + > +MAN= MAKEDEV.8 > +MANSUBDIR=arm64 > + > +.include > Index: usr.sbin/eeprom/Makefile > === > RCS file: /cvs/src/usr.sbin/eeprom/Makefile,v > retrieving revision 1.17 > diff -u -p -r1.17 Makefile > --- usr.sbin/eeprom/Makefile 23 Jan 2017 12:39:37 - 1.17 > +++ usr.sbin/eeprom/Makefile 26 Apr 2017 13:55:56 - > @@ -14,6 +14,6 @@ NOPROG=yes > .endif > > MAN= eeprom.8 > -MANSUBDIR=armv7 macppc octeon sparc64 > +MANSUBDIR=arm64 armv7 macppc octeon sparc64 > > .include > >
fix unreliable association to hidden SSIDs
The SSID element in beacons contains a length followed by the SSID value. If an AP is configured to hide its SSID it sends a non-zero length SSID which contains only zeroes: tcpdump: listening on iwm0, link-type IEEE802_11_RADIO 15:53:46.250095 802.11 flags=0<>: beacon, \ caps=12021, \ ssid 0x00, rates 1M* 2M* 5M* 11M* 18M 24M 36M 54M, ... The AP sends its actual SSID only in probe responses, i.e. after a client which already knows the SSID includes this SSID in a probe request. Before copying the SSID from a beacon or probe response, our code checks whether a non-zero length SSID was stored previously and if so it does not update the previously stored value. If we happen to receive a beacon before the probe response we store a non-zero-length SSID of zeroes and never update the SSID when the probe response arrives. The client won't find the AP and keeps going around the scan loop until the interface is reset. Association only works if the probe response is received first. This diff fixes the problem (second hunk), and also makes sure to update the SSID if we end up reusing a cached node while a probe response is received (first hunk). Index: ieee80211_input.c === RCS file: /cvs/src/sys/net80211/ieee80211_input.c,v retrieving revision 1.191 diff -u -p -r1.191 ieee80211_input.c --- ieee80211_input.c 11 Apr 2017 14:43:49 - 1.191 +++ ieee80211_input.c 26 Apr 2017 13:29:38 - @@ -1549,9 +1549,24 @@ ieee80211_recv_probe_resp(struct ieee802 * for this APs does not exist or if the new node is the * potential better one. */ - if ((ni = ieee80211_find_node_for_beacon(ic, wh->i_addr2, - >ic_channels[chan], ssid, rxi->rxi_rssi)) != NULL) + ni = ieee80211_find_node_for_beacon(ic, wh->i_addr2, + >ic_channels[chan], ssid, rxi->rxi_rssi); + if (ni != NULL) { + /* +* If we are doing a directed scan for an AP with a hidden SSID +* we must collect the SSID from a probe response to override +* a non-zero-length SSID filled with zeroes that we may have +* received earlier in a beacon. +*/ + if (isprobe && ssid[1] != 0 && ni->ni_essid[0] == '\0') { + ni->ni_esslen = ssid[1]; + memset(ni->ni_essid, 0, sizeof(ni->ni_essid)); + /* we know that ssid[1] <= IEEE80211_NWID_LEN */ + memcpy(ni->ni_essid, [2], ssid[1]); + } + return; + } #ifdef IEEE80211_DEBUG if (ieee80211_debug > 1 && @@ -1711,7 +1726,7 @@ ieee80211_recv_probe_resp(struct ieee802 } } - if (ssid[1] != 0 && ni->ni_esslen == 0) { + if (ssid[1] != 0 && ni->ni_essid[0] == '\0') { ni->ni_esslen = ssid[1]; memset(ni->ni_essid, 0, sizeof(ni->ni_essid)); /* we know that ssid[1] <= IEEE80211_NWID_LEN */
install man8/arm64/{MAKEDEV,eeprom}.8
ok? Index: etc/mtree/4.4BSD.dist === RCS file: /cvs/src/etc/mtree/4.4BSD.dist,v retrieving revision 1.297 diff -u -p -r1.297 4.4BSD.dist --- etc/mtree/4.4BSD.dist 18 Apr 2017 15:15:09 - 1.297 +++ etc/mtree/4.4BSD.dist 26 Apr 2017 13:55:56 - @@ -523,6 +523,8 @@ usr .. amd64 .. +arm64 +.. armv7 .. hppa Index: distrib/sets/lists/base/mi === RCS file: /cvs/src/distrib/sets/lists/base/mi,v retrieving revision 1.835 diff -u -p -r1.835 mi --- distrib/sets/lists/base/mi 20 Apr 2017 18:30:33 - 1.835 +++ distrib/sets/lists/base/mi 26 Apr 2017 13:55:56 - @@ -2628,6 +2628,7 @@ ./usr/share/man/man8/afterboot.8 ./usr/share/man/man8/alpha ./usr/share/man/man8/amd64 +./usr/share/man/man8/arm64 ./usr/share/man/man8/armv7 ./usr/share/man/man8/hppa ./usr/share/man/man8/i386 Index: distrib/sets/lists/man/mi === RCS file: /cvs/src/distrib/sets/lists/man/mi,v retrieving revision 1.1410 diff -u -p -r1.1410 mi --- distrib/sets/lists/man/mi 22 Apr 2017 17:47:21 - 1.1410 +++ distrib/sets/lists/man/mi 26 Apr 2017 13:55:56 - @@ -2063,6 +2063,8 @@ ./usr/share/man/man8/amd64/pxeboot.8 ./usr/share/man/man8/amd64/wsmoused.8 ./usr/share/man/man8/amq.8 +./usr/share/man/man8/arm64/MAKEDEV.8 +./usr/share/man/man8/arm64/eeprom.8 ./usr/share/man/man8/armv7/MAKEDEV.8 ./usr/share/man/man8/armv7/eeprom.8 ./usr/share/man/man8/armv7/gpioctl.8 Index: share/man/man8/Makefile === RCS file: /cvs/src/share/man/man8/Makefile,v retrieving revision 1.96 diff -u -p -r1.96 Makefile --- share/man/man8/Makefile 3 Sep 2016 13:37:41 - 1.96 +++ share/man/man8/Makefile 26 Apr 2017 13:55:56 - @@ -8,7 +8,7 @@ MAN=afterboot.8 autoinstall.8 boot_conf rc.conf.8 rc.d.8 rc.shutdown.8 rc.subr.8 release.8 \ security.8 ssl.8 starttls.8 sticky.8 yp.8 -SUBDIR=man8.alpha man8.amd64 man8.armv7 \ +SUBDIR=man8.alpha man8.amd64 man8.arm64 man8.armv7 \ man8.hppa man8.i386 man8.landisk \ man8.loongson man8.luna88k man8.macppc \ man8.octeon man8.sgi man8.socppc man8.sparc64 Index: share/man/man8/man8.arm64/Makefile === RCS file: share/man/man8/man8.arm64/Makefile diff -N share/man/man8/man8.arm64/Makefile --- /dev/null 1 Jan 1970 00:00:00 - +++ share/man/man8/man8.arm64/Makefile 26 Apr 2017 13:55:56 - @@ -0,0 +1,6 @@ +# $OpenBSD$ + +MAN= MAKEDEV.8 +MANSUBDIR=arm64 + +.include Index: usr.sbin/eeprom/Makefile === RCS file: /cvs/src/usr.sbin/eeprom/Makefile,v retrieving revision 1.17 diff -u -p -r1.17 Makefile --- usr.sbin/eeprom/Makefile23 Jan 2017 12:39:37 - 1.17 +++ usr.sbin/eeprom/Makefile26 Apr 2017 13:55:56 - @@ -14,6 +14,6 @@ NOPROG=yes .endif MAN= eeprom.8 -MANSUBDIR=armv7 macppc octeon sparc64 +MANSUBDIR=arm64 armv7 macppc octeon sparc64 .include
Add no_proxy support to ftp(1)
Hi, This patch adds basic support for the no_proxy environment variable to the ftp(1) tool. So you can get files from internal servers, without unsetting http/ftp_proxy env every time. E.g.: - no_proxy=internal.service.com ./ftp -o bla http://internal.service.com/foo Also usage of asterisks as wildcard is possible to exclude your internal domain from proxying: - no_proxy=*.service.com ./ftp -o bla http://internal.service.com/foo Are you interested in including this feature? Greetz Stefan Index: fetch.c === RCS file: /mount/cvsdev/cvs/openbsd/src/usr.bin/ftp/fetch.c,v retrieving revision 1.163 diff -u -r1.163 fetch.c --- fetch.c 7 Mar 2017 08:00:23 - 1.163 +++ fetch.c 26 Apr 2017 13:10:48 - @@ -57,6 +57,7 @@ #include #include #include +#include #ifndef NOSSL #include @@ -67,7 +68,9 @@ #include "ftp_var.h" #include "cmds.h" -static int url_get(const char *, const char *, const char *, int); +static int url_get(const char *, const char *, const char *, const char *, +int); +static int probe_no_proxy(const char *, const char *); void aborthttp(int); void abortfile(int); char hextochar(const char *); @@ -88,6 +91,7 @@ #define FILE_URL "file:" /* file URL prefix */ #define FTP_PROXY "ftp_proxy" /* env var with ftp proxy location */ #define HTTP_PROXY "http_proxy" /* env var with http proxy location */ +#define NO_PROXY "no_proxy" /* env var with no proxy location */ #define EMPTYSTRING(x) ((x) == NULL || (*(x) == '\0')) @@ -174,12 +178,48 @@ } /* + * Checks if host is in no_proxy + * Returns 1 on host found in no_proxy, otherwise 0 + */ +static int +probe_no_proxy(const char *host, const char *no_proxy) +{ + char *p, *np, *last; + int rval = 0; + + if (no_proxy == NULL) + return 0; + + np = strdup(no_proxy); + if (np == NULL) + errx(1, "Can't allocate memory to parse no_proxy"); + + for ((p = strtok_r(np, ",", )); p; +(p = strtok_r(NULL, ",", ))) { + if (fnmatch(p, host, 0) == 0) { +#ifndef SMALL + if (debug) + fprintf(ttyout, "%s: Matched %s -> %s\n", +__func__, host, p); +#endif + rval = 1; + goto done; + } + } + +done: + free(np); + return (rval); +} + +/* * Retrieve URL, via the proxy in $proxyvar if necessary. * Modifies the string argument given. * Returns -1 on failure, 0 on success */ static int -url_get(const char *origline, const char *proxyenv, const char *outfile, int lastfile) +url_get(const char *origline, const char *proxyenv, const char *noproxy, +const char *outfile, int lastfile) { char pbuf[NI_MAXSERV], hbuf[NI_MAXHOST], *cp, *portnum, *path, ststr[4]; char *hosttail, *cause = "unknown", *newline, *host, *port, *buf = NULL; @@ -304,7 +344,8 @@ } #endif /* !SMALL */ - if (!isfileurl && proxyenv != NULL) { /* use proxy */ + if (!isfileurl && proxyenv != NULL && +!probe_no_proxy(host, noproxy)) { /* use proxy */ #ifndef NOSSL if (ishttpsurl) { sslpath = strdup(path); @@ -916,7 +957,8 @@ fclose(fin); else if (s != -1) close(s); - rval = url_get(redirurl, proxyenv, savefile, lastfile); + rval = url_get(redirurl, proxyenv, noproxy, +savefile, lastfile); free(redirurl); goto cleanup_url_get; } @@ -1101,7 +1143,7 @@ char *xargv[5]; char *cp, *url, *host, *dir, *file, *portnum; char *username, *pass, *pathstart; - char *ftpproxy, *httpproxy; + char *ftpproxy, *httpproxy, *noproxy; int rval, xargc, lastfile; volatile int argpos; int dirhasglob, filehasglob, oautologin; @@ -1121,6 +1163,8 @@ ftpproxy = NULL; if ((httpproxy = getenv(HTTP_PROXY)) != NULL && *httpproxy == '\0') httpproxy = NULL; + if ((noproxy = getenv(NO_PROXY)) != NULL && *noproxy == '\0') + noproxy = NULL; /* * Loop through as long as there's files to fetch. @@ -1153,7 +1197,7 @@ #endif /* !NOSSL */ strncasecmp(url, FILE_URL, sizeof(FILE_URL) - 1) == 0) { redirect_loop = 0; - if (url_get(url, httpproxy, outfile, lastfile) == -1) + if (url_get(url, httpproxy, noproxy, outfile, lastfile) == -1) rval = argpos + 1; continue; } @@ -1168,7 +1212,7 @@ char *passend, *passagain, *userend; if (ftpproxy) { - if (url_get(url, ftpproxy, outfile, lastfile) == -1) + if (url_get(url, ftpproxy, noproxy, outfile, lastfile) == -1) rval = argpos + 1; continue; } Index: ftp.1 === RCS file: /mount/cvsdev/cvs/openbsd/src/usr.bin/ftp/ftp.1,v retrieving revision 1.107 diff -u -r1.107 ftp.1 --- ftp.1 25 Jan 2017 07:21:18 - 1.107 +++ ftp.1 26 Apr 2017 10:23:46 - @@ -1355,6 +1355,9 @@ If .Ev http_proxy is defined, it is used as a URL to an HTTP proxy server. +If +.Ev no_proxy +is defined, it is used to check for ftp or http proxy exceptions. If a .Ar user and @@ -1741,6 +1744,9 @@ (if not defined, use the standard FTP protocol). .It Ev http_proxy URL of HTTP proxy to use when making HTTP or HTTPS URL requests. +.It Ev no_proxy +A comma-separated list which specifies hosts that
Re: uip_socket.c: issues when using sendmsg() with small send buffers and the new 6.1 control message (IP_SENDSRCADDR)
Hi, actually you are right that this issue is related to control messages and not to the send buffer length. But the length of the control message is checked in combination with the data to be sent in uip_socket.c: Let's assume we are sending data with the maximum send buffer size (e.g. 1024). Since clen is NOT evaluated in the first if statement, EMSGSIZE is NOT returned. But the second if statement becomes true, since clen is considered here. Hence either EWOULDBLOCK (snderr) is returned or sbwait() is called. if ((atomic && resid > so->so_snd.sb_hiwat) || (so->so_proto->pr_domain->dom_family != AF_LOCAL && clen > so->so_snd.sb_hiwat)) snderr(EMSGSIZE); if (space < clen || (space - clen < resid && (atomic || space < so->so_snd.sb_lowat))) { if ((so->so_state & SS_NBIO) || (flags & MSG_DONTWAIT)) snderr(EWOULDBLOCK); sbunlock(>so_snd); error = sbwait(>so_snd); I attached a small example, which - sets the sockets maximum buffer length - enables/disables non-blocking IO and - calls sendmsg with the maximum buffer size including a control message (IP_SENDSRCADDR). -Original Message- From: Jeremie Courreges-Anglas [mailto:j...@wxcvbn.org] Sent: Dienstag, 25. April 2017 15:00 To: Markert, Alexander (DF FA AS DH FTH 2) Cc: tech@openbsd.org Subject: Re: uip_socket.c: issues when using sendmsg() with small send buffers and the new 6.1 control message (IP_SENDSRCADDR) "Markert, Alexander"writes: > Hi, Hi, > the length of the data to be sent and in addition the length of the > associated control message (e.g. the source address: IP_SENDSRCADDR) musn't > exceed the maximum size of the socket's send buffer (SO_SNDBUF). > Otherwise EMSGSIZE is returned. That is ok. > > However, if the data to be sent fits into the send buffer, but exceeds in > combination with the control message: > - either EWOULDBLOCK is returned when using non-blocking IO or > - send operation blocks in sbwait when using blocking IO > > It seems that this situation will never dissolve, i.e. the sending > application will be blocked forever. > > In our opinion either EMSGSIZE should be returned instead in this case > (like e.g. FreeBSD 11.0 does) or OpenBSD should reserve some space > (comparable to MSG_OOB) in addition to the maximum size of the > socket's send buffer for the control messages in order to avoid such problems. > > What do you think about that behavior and the described alternatives? Control messages are tricky. One port (net/dnsmasq) is currently failing, and appears to hang like you describe. The issue is related to control messages, but it's not a lack of send buffer space. So how can one reproduce the bug you're talking about? Do you have a test case? -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE #include #include #include #include #include #include #include #include // change configuration data to your needs #define CFG_SOURCE_ADDRESS "192.168.88.135" #define CFG_DESTINATION_ADDRESS "192.168.57.44" #define CFG_PORT5000 #define CFG_SO_MAX_SEND_BUFFER 1024 int main(int argc, char* argv[]) { // open socket int so = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (so < 0) { printf("Opening socket failed: %d\n", errno); return -1; } // set maximum size of socket's send buffer unsigned int max_size_send_buffer = CFG_SO_MAX_SEND_BUFFER; if (setsockopt(so, SOL_SOCKET, SO_SNDBUF, (char*)(_size_send_buffer), sizeof(max_size_send_buffer)) < 0) { printf("Adjusting socket send buffer failed: %d\n", errno); close(so); return -1; } // if non-blocking IO is disabled, sendmsg hangs is returned by sendmsg // unsigned long enable_non_blocking_io = 0; // if non-blocking IO is enabled EWOULDBLOCK is returned by sendmsg unsigned long enable_non_blocking_io = 1; if (ioctl(so, FIONBIO, _non_blocking_io) < 0) { printf("Enabling/disabling non-blocking IO failed: %d\n", errno); close(so); return -1; } msghdr message_header = { 0 }; iovec io = { 0 }; char control_message[CMSG_SPACE(sizeof(struct in_addr))] = { 0 }; sockaddr_in remote = { 0 }; char data[CFG_SO_MAX_SEND_BUFFER] = {0}; // use this buffer, if you want to send a smaller buffer than CFG_SO_MAX_SEND_BUFFER // char data[256] = {0}; // setup buffer to be sent io.iov_base = data; io.iov_len = sizeof(data); message_header.msg_iovlen = 1; message_header.msg_iov = // setup remote address remote.sin_family = AF_INET; remote.sin_addr.s_addr = inet_addr(CFG_DESTINATION_ADDRESS); remote.sin_port = htons(CFG_PORT);
Re: clang: ignore -fno-force-addr
On 2017/04/26 00:47, Jeremie Courreges-Anglas wrote: > "Ted Unangst"writes: > > > Jeremie Courreges-Anglas wrote: > >> > >> clang already recognizes (and ignores) -fforce-addr but errors out > >> on -fno-force-addr. This breaks the build of ports/databases/qdbm: > >> > >> > >> http://build-failures.rhaalovely.net/amd64-clang/2017-04-14/databases/qdbm.log > >> > >> Fixing the port is easy, but so is ignoring -fno-force-addr. > >> -fno-force-addr should probably be pushed upstream if the latter is > >> preferred. > >> > >> Thoughts? > > > > If the option is obsolete, I'd say we'd be doing the world a favor by > > upstreaming a patch to fix qdbm. > > I'm not sure what you mean by obsolete ("ignored"?). A bunch of > packages out there use -fforce-addr but since qdbm seems to be the only > user of -fno-force-addr, I guess there's not much point in adding > support for a no-op. (The port has been fixed since.) 10 years old, so I don't think it's upstream-able. What they're actually doing here is "-fforce-addr" by default and then adding "-fno-force-addr" on BSDs to disable it again.
Re: vmm/i386 __func__
On Fri, Apr 14, 2017 at 12:26:22PM +0800, Michael W. Bombardieri wrote: > Hi, > > Some printf() statements in vmm.c already used __func__ > but some didn't. This diff adds more __func__. > > Also, one printf() statement was missing a space: >"vcpu_run_vmx: can't readprocbased ctls on exit" > > - Michael I went through the whole file and fixed them all. Thanks for pointing this out. I'll do amd64 subsequently. -ml > > > Index: vmm.c > === > RCS file: /cvs/src/sys/arch/i386/i386/vmm.c,v > retrieving revision 1.27 > diff -u -p -u -r1.27 vmm.c > --- vmm.c 12 Apr 2017 05:46:59 - 1.27 > +++ vmm.c 14 Apr 2017 04:11:33 - > @@ -540,7 +540,7 @@ vm_resetcpu(struct vm_resetcpu_params *v > vm->vm_id, vcpu->vc_id); > > if (vcpu_reset_regs(vcpu, >vrp_init_state)) { > - printf("vm_resetcpu: failed\n"); > + printf("%s: failed\n", __func__); > #ifdef VMM_DEBUG > dump_vcpu(vcpu); > #endif /* VMM_DEBUG */ > @@ -1102,7 +1102,7 @@ vm_impl_init_vmx(struct vm *vm, struct p > /* Create a new pmap for this VM */ > pmap = pmap_create(); > if (!pmap) { > - printf("vm_impl_init_vmx: pmap_create failed\n"); > + printf("%s: pmap_create failed\n", __func__); > return (ENOMEM); > } > > @@ -1118,7 +1118,7 @@ vm_impl_init_vmx(struct vm *vm, struct p > VM_MAP_ISVMSPACE | VM_MAP_PAGEABLE); > > if (!vm->vm_map) { > - printf("vm_impl_init_vmx: uvm_map_create failed\n"); > + printf("%s: uvm_map_create failed\n", __func__); > pmap_destroy(pmap); > return (ENOMEM); > } > @@ -1131,7 +1131,7 @@ vm_impl_init_vmx(struct vm *vm, struct p > PROT_READ | PROT_WRITE | PROT_EXEC, > >p_vmspace->vm_map, vmr->vmr_va, vmr->vmr_size); > if (ret) { > - printf("vm_impl_init_vmx: uvm_share failed (%d)\n", > + printf("%s: uvm_share failed (%d)\n", __func__, > ret); > /* uvm_map_deallocate calls pmap_destroy for us */ > uvm_map_deallocate(vm->vm_map); > @@ -1143,7 +1143,7 @@ vm_impl_init_vmx(struct vm *vm, struct p > /* Convert the low 512GB of the pmap to EPT */ > ret = pmap_convert(pmap, PMAP_TYPE_EPT); > if (ret) { > - printf("vm_impl_init_vmx: pmap_convert failed\n"); > + printf("%s: pmap_convert failed\n", __func__); > /* uvm_map_deallocate calls pmap_destroy for us */ > uvm_map_deallocate(vm->vm_map); > vm->vm_map = NULL; > @@ -1181,7 +1181,7 @@ vm_impl_init_svm(struct vm *vm, struct p > /* Create a new pmap for this VM */ > pmap = pmap_create(); > if (!pmap) { > - printf("vm_impl_init_svm: pmap_create failed\n"); > + printf("%s: pmap_create failed\n", __func__); > return (ENOMEM); > } > > @@ -1199,7 +1199,7 @@ vm_impl_init_svm(struct vm *vm, struct p > VM_MAP_ISVMSPACE | VM_MAP_PAGEABLE); > > if (!vm->vm_map) { > - printf("vm_impl_init_svm: uvm_map_create failed\n"); > + printf("%s: uvm_map_create failed\n", __func__); > pmap_destroy(pmap); > return (ENOMEM); > } > @@ -1212,7 +1212,7 @@ vm_impl_init_svm(struct vm *vm, struct p > PROT_READ | PROT_WRITE | PROT_EXEC, > >p_vmspace->vm_map, vmr->vmr_va, vmr->vmr_size); > if (ret) { > - printf("vm_impl_init_svm: uvm_share failed (%d)\n", > + printf("%s: uvm_share failed (%d)\n", __func__, > ret); > /* uvm_map_deallocate calls pmap_destroy for us */ > uvm_map_deallocate(vm->vm_map); > @@ -3447,8 +3447,8 @@ vcpu_run_vmx(struct vcpu *vcpu, struct v > /* Is there an interrupt pending injection? */ > if (irq != 0x) { > if (!vcpu->vc_irqready) { > - printf("vcpu_run_vmx: error - irq injected" > - " while not ready\n"); > + printf("%s: error - irq injected" > + " while not ready\n", __func__); > ret = EINVAL; > break; > } > @@ -3457,8 +3457,8 @@ vcpu_run_vmx(struct vcpu *vcpu, struct v > eii |= (1ULL << 31);/* Valid */ > eii |= (0ULL << 8); /* Hardware Interrupt */ > if (vmwrite(VMCS_ENTRY_INTERRUPTION_INFO, eii)) { > - printf("vcpu_run_vmx: can't vector " > - "interrupt to guest\n"); > +
vi(1): minor nit
Hi, In revision 1.41 of usr.bin/vi/common/exf.c the msg_cat function was removed but it looks like an extraneous argument from one of the removed function calls didn't end up being removed. Found while compiling with clang(1). Index: common/exf.c === RCS file: /cvs/src/usr.bin/vi/common/exf.c,v retrieving revision 1.45 diff -u -p -r1.45 exf.c --- common/exf.c18 Apr 2017 01:45:35 - 1.45 +++ common/exf.c25 Apr 2017 20:35:49 - @@ -909,7 +909,7 @@ file_write(SCR *sp, MARK *fm, MARK *tm, case OLDFILE: msgstr = LF_ISSET(FS_APPEND) ? "%s: appended: %lu lines, %lu characters" : - "%s: %lu lines, %lu characters", NULL; + "%s: %lu lines, %lu characters"; len = snprintf(buf, sizeof(buf), msgstr, p, nlno, nch); if (len >= sizeof(buf)) len = sizeof(buf) - 1;