Re: PC Engines APU2 coming soon - how is OpenBSD's support so far?

2015-11-12 Thread Daniel Ouellet
you got stuck at the same place I did.

For i386/amd64 you have to tell boot you want serial output
either at the boot prompt or via boot.conf.

stty com0 115200
set tty com0

See archive:

http://marc.info/?l=openbsd-misc&m=144531335118929&w=2

And this should be on misc@ anyway.

Take care.

Daniel


On 11/12/15 8:32 AM, Rolf Sommerhalder wrote:
> Got two APU2b4 boards yesterday, and they fail to boot 5.8 or
> -current, i386 or amd64, from USB early in the process (see below).
> 
> So far, I could not figure out if there are differences to your setup
> from your dmesgs. Eventually, did you revceive an earlier hardware
> revision APU2a4, with an earlier version of coreboot?
> 
> Also, I tried to lower serial line speed from the initial 115k of
> coreboot, for the (unlikely) case that the kernel should change it.
> 
> Finally, 'boot -c' dos not get as far as to UKC in order to try with
> ACPI disabled etc.
> 
> What is your serial console output at boot time? Any ideas or
> suggestions what I should try next?
> 
> Thanks,
> Rolf
> 
> 
> console output from power-up:
> 
> Mainboard PCEngines apu2 Enable.
> APIC: 00 missing read_resources
> APIC: 01 missing read_resources
> APIC: 02 missing read_resources
> APIC: 03 missing read_resources
> SeaBIOS (version rel-1.8.0-181-g0af5958)
> BUILD: gcc: (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4 binutils: (GNU Binutils for 
> Ubu4
> SeaBIOS (version rel-1.8.0-181-g0af5958)
> BUILD: gcc: (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4 binutils: (GNU Binutils for 
> Ubu4
> Found coreboot cbmem console @ dffdf000
> Found mainboard PC Engines PCEngines apu2
> Relocating init from 0x000eeb10 to 0xdff66fd0 (size 28576)
> Found CBFS header at 0xfc50
> multiboot: eax=0, ebx=0
> boot order:
> 1: /pci@i0cf8/usb@10/usb-*@1
> 2: /pci@i0cf8/usb@10/usb-*@2
> SeaBIOS (version rel-1.8.0-181-g0af5958)
> XHCI init on dev 00:10.0: regs @ 0xfeb22000, 4 ports, 32 slots, 32 byte 
> contexts
> XHCIextcap 0x1 @ feb22500
> XHCIprotocol USB  3.00, 2 ports (offset 1), def 0
> XHCIprotocol USB  2.00, 2 ports (offset 3), def 10
> XHCIextcap 0xa @ feb22540
> Found 2 serial ports
> Searching bootorder for: /pci@i0cf8/*@14,7
> EHCI init on dev 00:13.0 (regs=0xfeb25420)
> Searching bootorder for: /rom@img/memtest
> Searching bootorder for: /rom@img/setup
> XHCI port #3: 0x00200e03, powered, enabled, pls 0, speed 3 [High]
> Initialized USB HUB (0 ports used)
> WARNING - Timeout at xhci_event_wait:694!
> xhci_send_pipe: xfer failed (cc -1)
> Searching bootorder for: /pci@i0cf8/usb@10/storage@3/*@0/*@0,0
> Searching bootorder for: /pci@i0cf8/usb@10/usb-*@3
> USB MSC vendor='JetFlash' product='Transcend 1GB' rev='8.07' type=0 
> removable=1
> USB MSC blksize=512 sectors=1972224
> All threads complete.
> Scan for option roms
> PCengines Press F10 key now for boot menu:
> Searching bootorder for: HALT
> drive 0x000f5850: PCHS=0/0/0 translation=lba LCHS=978/32/63 s=1972224
> Space available for UMB: c1000-ef000, f-f5850
> Returned 258048 bytes of ZoneHigh
> e820 map has 7 items:
>   0:  - 0009f800 = 1 RAM
>   1: 0009f800 - 000a = 2 RESERVED
>   2: 000f - 0010 = 2 RESERVED
>   3: 0010 - dffad000 = 1 RAM
>   4: dffad000 - e000 = 2 RESERVED
>   5: f800 - fc00 = 2 RESERVED
>   6: 0001 - 00011f00 = 1 RAM
> enter handle_19:
>   NULL
> Booting from Hard Disk...
> Booting from :7c00
> Using drive 0, partition 3.
> Loading.
> probing: pc0 com0 com1 mem[638K 3582M 496M a20=on]
> disk: hd0+
>>> OpenBSD/amd64 BOOT 3.28
> boot>
> cannot open hd0a:/etc/random.seed: No such file or directory
> booting hd0a:/5.8/amd64/bsd.rd: 3251512+1391248+2401280+0+520192 
> [72+360480+23]8
> entry point at 0x1000160 [7205c766, 3404, 24448b12, a680a304]
> (output stops here)
> 



Re: [RFC] Ai_ADDRCONFIG^WAIAIAIAIAIAIAEEEEEEEEE tweaks?

2014-05-03 Thread Daniel Ouellet
>> "Everybody does it" is an argumentum ad populum.  It's not right
>> because all systems do this.  All systems do this because some RFC
>> told them to and apparently nobody considered the downsides (or they
>> dismissed them).
>>
>> I'm arguing it should be different since it is unexpected behavior
>> (keep in mind that you say 'none' to the "IPv6 address for em0? (or
>> 'rtsol' or 'none')" question in the installer - a link-local address
>> is not "none"), it goes against the OpenBSD philosophy and it exposes
>> an extra attack surface.
> 
> Just to remind everybody here. The last time we had to bump the remote
> hole counter in OpenBSD was because of IPv6. Because of that I'm all for
> not having IPv6 link local addresses set by default.
> 
> It will also save us from some troubles with unnumbered interfaces (e.g.
> as part of a bridge(4)) that get an IPv6 address by default unless -inet6
> is used.

Amen!

I am just a user and follow this tread with much interest. I have to say
I wasn't used to OpenBSD lie to me from 2.6 when I started to use it.
When I say None to a question I expect None, not a partial None.

I have no say in the subject, but if I may, please make the question
reflect the truth when asked and KILL IT!

As a side effect of this, I got used to do this in pf.conf in every install.

block in quick inet6 all

Thanks for always considering better setup and default every time.

Daniel



Re: Problem with ciphers and OpenSMTP

2014-02-24 Thread Daniel Ouellet
This should be on misc not tech.

But anyway, I didn't need to upgrade anything to get my iPhone to work
with smtpd

I use

listen on egress port 465 smtps certificate xxx.yy.zzz auth

not optional.

Fix the iphone to use ssl on port 465 and use password authentication in it.

And here is the log for a test email for you.


All setup according to man page, not external upgrades or information
used for the setup.

Feb 24 16:27:51 smtp1 smtpd[16535]: smtp-in: New session
0ce41b1c2010 from host xxx.yyy.zz [xx.xx.xx.xx]
Feb 24 16:27:53 smtp1 smtpd[16535]: smtp-in: Started TLS on session
0ce41b1c2010: version=TLSv1/SSLv3, cipher=AES128-SHA, bits=128
Feb 24 16:27:53 smtp1 smtpd[16535]: smtp-in: Accepted authentication for
user xx on session 0ce41b1c2010
Feb 24 16:27:54 smtp1 smtpd[16535]: smtp-in: Accepted message f9601322
on session 0ce41b1c2010: from=, size=328, nrcpts=1,
proto=ESMTP
Feb 24 16:27:55 smtp1 smtpd[5092]: smtp-out: Connecting to
smtp://xx.xx.xx.xx:25 (xxx.xxx.xxx) on session 3892d2dc0581...
Feb 24 16:27:55 smtp1 smtpd[5092]: smtp-out: Connected on session
3892d2dc0581
Feb 24 16:27:55 smtp1 smtpd[5092]: relay: Ok for f96013222045fc19:
from=, to=, relay=xx.xx.xx.xx (xxx.xxx.xxx),
delay=1s, stat=250 2.0.0 Ok: queued as 0DA1B5F9E1
Feb 24 16:27:55 smtp1 smtpd[5092]: smtp-out: Closing session
3892d2dc0581: 1 message sent.

And you really should post this to misc@ not tech.

Best,

Daniel


On 2/24/14, 3:40 PM, Vladimir Támara Patiño wrote:
> Hi.
> 
> I have an OpenSTMP server on OpenBSD 5.4 working fine, the configuration
> (/etc/mail/smtpd.conf) includes:
> 
>  listen on all port 465 smtps certificate example.com auth-optional
> 
> Sending email from thunderbird, roundcubemail and an android MUA works
> fine, however I'm having problems to send email from an iPhone with its
> default MUA.
> The failed connections from the iPhone reported in /var/log/maillog show:
> 
> Feb 24 15:31:32 www smtpd[20008]: smtp-in: New session 0046b1672c2d
>  from host 191.71.116.146 [191.71.116.146]
> Feb 24 15:31:33 www smtpd[20008]: smtp-in: Bad input on session
>  0046b1672c2d: 500 Pipelining not supported
> Feb 24 15:31:33 www smtpd[20008]: smtp-in: Closing session
>  0046b1672c2d
> Feb 24 15:31:35 www smtpd[20008]: smtp-in: New session 0047fd78e967
>  from host 191.71.116.146 [191.71.116.146]
> Feb 24 15:31:36 www smtpd[20008]: smtp-in: Disconnecting session
>  0047fd78e967: IO error: error:1408A0C1:SSL
>  routines:SSL3_GET_CLIENT_HELLO:no shared cipher
> 
> 
> I wonder if the problem is with the ciphers that OpenSMTPD offers.
> Following the procedure of
> https://www.owasp.org/index.php/Testing_for_Weak_SSL/TSL_Ciphers,_Insufficient_Transport_Layer_Protection_(OWASP-EN-002)
> 
> with nmap --script ssl-cert,ssl-enum-ciphers -p 465 www.example.com
> 
> I can see the following list of ciphers :
> 
> Starting Nmap 6.25 ( http://nmap.org ) at 2014-02-24 15:16 COT
> Nmap scan report for example.com (ip.ip.ip.ip)
> Host is up (0.15s latency).
> PORTSTATE SERVICE
> 465/tcp open  smtps
> | ssl-cert: Subject:
> commonName=www.example.com/organizationName=Example/stateOrProvinceName=Cundinamarca/countryName=co
> 
> | Issuer:
> commonName=www.example.com/organizationName=Example/stateOrProvinceName=Cundinamarca/countryName=co
> 
> | Public Key type: dsa
> | Public Key bits: 1024
> | Not valid before: 2010-11-08T13:43:04+00:00
> | Not valid after:  2020-11-05T13:43:04+00:00
> | MD5:   0b51 f652 8410 a427 8147 bc8f d917 e774
> |_SHA-1: c12d fe2c bca9 c186 98cb 2392 c21b 02db af90 726f
> | ssl-enum-ciphers: |   SSLv3: | ciphers: |  
> TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA - strong
> |   TLS_DHE_DSS_WITH_AES_256_CBC_SHA - strong
> | compressors: |   NULL
> |   TLSv1.0: | ciphers: |   TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA -
> strong
> |   TLS_DHE_DSS_WITH_AES_128_CBC_SHA - strong
> |   TLS_DHE_DSS_WITH_AES_256_CBC_SHA - strong
> | compressors: |   NULL
> |   TLSv1.1: | ciphers: |   TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA -
> strong
> |   TLS_DHE_DSS_WITH_AES_128_CBC_SHA - strong
> |   TLS_DHE_DSS_WITH_AES_256_CBC_SHA - strong
> | compressors: |   NULL
> |   TLSv1.2: | ciphers: |   TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA -
> strong
> |   TLS_DHE_DSS_WITH_AES_128_CBC_SHA - strong
> |   TLS_DHE_DSS_WITH_AES_128_CBC_SHA256 - strong
> |   TLS_DHE_DSS_WITH_AES_128_GCM_SHA256 - strong
> |   TLS_DHE_DSS_WITH_AES_256_CBC_SHA - strong
> |   TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 - strong
> |   TLS_DHE_DSS_WITH_AES_256_GCM_SHA384 - strong
> | compressors: |   NULL
> |_  least strength: strong
> 
> Could the problem be in the OpenSSL library? Even in OpenBSD-current it
> is still in version 1.0.0c --while the most recent is 1.0.0l
> Has anyone had this problem?  The solution is to upgrade OpenSSL?
> 
> Best regards.



Diff on ANSI for games/gomoku/bdinit.c (Take 2 using mutt)

2009-06-04 Thread Daniel Ouellet
OK,

Here we go. Hopefully it will be good now as no more Thunderbird, but mutt 
instead directly from OpenBSD kind of work station for now. (;>

Best,

Daniel

Index: bdinit.c
===
RCS file: /cvs/src/games/gomoku/bdinit.c,v
retrieving revision 1.5
diff -u -p -r1.5 bdinit.c
--- bdinit.c3 Jun 2003 03:01:39 -   1.5
+++ bdinit.c4 Jun 2009 13:55:17 -
@@ -43,8 +43,7 @@ static char rcsid[] = "$OpenBSD: bdinit.
 #include 
 
 void
-bdinit(bp)
-   struct spotstr *bp;
+bdinit(struct spotstr *bp)
 {
int i, j, r;
struct spotstr *sp;
@@ -170,7 +169,7 @@ bdinit(bp)
  * common open spaces shared between the two frames.
  */
 void
-init_overlap()
+init_overlap(void)
 {
struct spotstr *sp1, *sp2;
struct combostr *cbp;



Re: Diff for ANSI and KNF on src/games/gomoku/main.c

2009-06-03 Thread Daniel Ouellet

Stuart Henderson wrote:

User-Agent: Thunderbird 2.0.0.21 (Windows/20090302)
Content-Type: text/plain; charset=ISO-8859-1; format=flowed


if you want to send diffs with thunderbird, you need to disable
format=flowed.


Darnit! I thought I did that, Sorry!

I guess I will just use mutt then.

Should I resent them then, or are they still OK as is?



Diff for ANSI and style on src/games/gomoku/stoc.c

2009-06-03 Thread Daniel Ouellet

Index: stoc.c
===
RCS file: /cvs/src/games/gomoku/stoc.c,v
retrieving revision 1.7
diff -N -u -p stoc.c
--- stoc.c  10 Jul 2003 00:03:01 -  1.7
+++ stoc.c  4 Jun 2009 01:54:38 -
@@ -61,45 +61,42 @@ static  struct  mvstr   mv[] = {
  * Turn the spot number form of a move into the character form.
  */
 char *
-stoc(s)
-   int s;
+stoc(int s)
 {
static char buf[32];
int i;

for (i = 0; mv[i].m_code >= 0; i++)
if (s == mv[i].m_code)
-   return(mv[i].m_text);
+   return (mv[i].m_text);
snprintf(buf, sizeof buf, "%c%d", letters[s % BSZ1], s / BSZ1);
-   return(buf);
+   return (buf);
 }

 /*
  * Turn the character form of a move into the spot number form.
  */
 int
-ctos(mp)
-   char *mp;
+ctos(char *mp)
 {
int i;

for (i = 0; mv[i].m_code >= 0; i++)
if (strcmp(mp, mv[i].m_text) == 0)
-   return(mv[i].m_code);
+   return (mv[i].m_code);
if (!isalpha(mp[0]))
-   return(ILLEGAL);
+   return (ILLEGAL);
i = atoi(&mp[1]);
if (i < 1 || i > 19)
-   return(ILLEGAL);
-   return(PT(lton(mp[0]), i));
+   return (ILLEGAL);
+   return (PT(lton(mp[0]), i));
 }

 /*
  * Turn a letter into a number.
  */
 int
-lton(c)
-   int c;
+lton(int c)
 {
int i;

@@ -107,5 +104,5 @@ lton(c)
c = toupper(c);
for (i = 1; i <= BSZ && letters[i] != c; i++)
;
-   return(i);
+   return (i);
 }



Diff for ANSI and KNF on src/games/gomoku/main.c

2009-06-03 Thread Daniel Ouellet

Index: main.c
===
RCS file: /cvs/src/games/gomoku/main.c,v
retrieving revision 1.21
diff -N -u -p main.c
--- main.c  17 Mar 2008 09:17:56 -  1.21
+++ main.c  4 Jun 2009 01:37:44 -
@@ -81,9 +81,7 @@ char  *plyr[2];   /* who's who */
 static char you[MAXLOGNAME];   /* username */

 int
-main(argc, argv)
-   int argc;
-   char **argv;
+main(int argc, char *argv[])
 {
char buf[128];
char fname[MAXPATHLEN];
@@ -162,7 +160,7 @@ again:
if (inputfp == NULL && test == 0) {
ask("black or white? ");
while (((ch = getchar()) != 'b') && (ch != 'B') &&
-   (ch != 'w') && (ch != 'W')) {
+   (ch != 'w') && (ch != 'W')) {
move(BSZ3, 0);
printw("Black moves first. Please enter `black' or 
`white'\n");
refresh();
@@ -217,7 +215,7 @@ again:
}

for (color = BLACK; ; color = !color) {
-   top:
+top:
switch (input[color]) {
case INPUTF: /* input comes from a file */
curmove = readinput(inputfp);
@@ -245,7 +243,7 @@ again:
goto top;

case USER: /* input comes from standard input */
-   getinput:
+getinput:
if (interactive) {
ask("Enter move (hjklyubn/S/Q)");
curmove = getcoord();
@@ -289,7 +287,7 @@ again:
}
if (interactive) {
snprintf(fmtbuf, sizeof fmtbuf,
-   fmt[color], movenum, stoc(curmove));
+   fmt[color], movenum, stoc(curmove));
logit(fmtbuf);
}
if ((i = makemove(color, curmove)) != MOVEOK)
@@ -319,7 +317,7 @@ again:
clrtoeol();
bdisp();
if (i != RESIGN) {
-   replay:
+replay:
ask("replay? ");
if (getline(buf, sizeof(buf)) &&
(buf[0] == 'y' || buf[0] == 'Y'))
@@ -335,7 +333,7 @@ again:
}
for (i = 0; i < movenum - 1; i++)
fprintf(fp, "%s\n",
-   stoc(movelog[i]));
+   stoc(movelog[i]));
fclose(fp);
goto replay;
}
@@ -346,8 +344,7 @@ again:
 }

 int
-readinput(fp)
-   FILE *fp;
+readinput(FILE *fp)
 {
char *cp;
int c;
@@ -364,8 +361,7 @@ readinput(fp)
  * Handle strange situations.
  */
 void
-whatsup(signum)
-   int signum;
+whatsup(int signum)
 {
int i, pnum, n, s1, s2, d1, d2;
struct spotstr *sp;
@@ -388,7 +384,7 @@ top:
case 'd':   /* set debug level */
debug = fmtbuf[1] - '0';
snprintf(fmtbuf, sizeof fmtbuf,
-   "Debug set to %d", debug);
+   "Debug set to %d", debug);
dlog(fmtbuf);
sleep(1);
case 'c':
@@ -403,8 +399,8 @@ top:
case 's':   /* suggest a move */
i = fmtbuf[1] == 'b' ? BLACK : WHITE;
snprintf(fmtbuf, sizeof fmtbuf,
-   "suggest %c %s", i == BLACK ? 'B' : 'W',
-   stoc(pickmove(i)));
+   "suggest %c %s", i == BLACK ? 'B' : 'W',
+   stoc(pickmove(i)));
dlog(fmtbuf);
goto top;
case 'f':   /* go forward a move */
@@ -513,10 +509,8 @@ syntax:
  * Display debug info.
  */
 void
-dlog(str)
-   char *str;
+dlog(char *str)
 {
-
if (debugfp)
fprintf(debugfp, "%s\n", str);
if (interactive)
@@ -526,10 +520,8 @@ dlog(str)
 }

 void
-logit(str)
-   char *str;
+logit(char *str)
 {
-
if (debugfp)
fprintf(debugfp, "%s\n", str);
if (interactive)
@@ -542,8 +534,7 @@ logit(str)
  * Deal with a fatal error.
  */
 void
-qlog(str)
-   char *str;
+qlog(char *str)
 {
dlog(str);
if (interactive)
@@ -554,8 +545,7 @@ qlog(str)

 /* ARGSUSED */
 void
-quit(sig)
-   int sig;
+quit(int sig)
 {
if (interactive) {
bdisp();/* show final board */
@@ -568,8 +558,7 @@ quit(sig)
  * Die gracefully.
  */
 void
-panic(str)
-   char *str;
+panic(char *str)
 {
fprintf(stderr, "%s: %s\n", prog, str);
fputs("resign\n", stdout);



diff on ANSI + Style + KNF for src/games/gomoku/bdisp.c

2009-06-03 Thread Daniel Ouellet

Index: bdisp.c
===
RCS file: /cvs/src/games/gomoku/bdisp.c,v
retrieving revision 1.9
diff -u -p -r1.9 bdisp.c
--- bdisp.c 14 Dec 2006 10:15:09 -  1.9
+++ bdisp.c 4 Jun 2009 00:17:36 -
@@ -54,12 +54,12 @@ static  charpcolor[] = "*O.?";
  * Initialize screen display.
  */
 void
-cursinit()
+cursinit(void)
 {
initscr();
if ((LINES < SCRNH) || (COLS < SCRNW)) {
endwin();
-   errx(1,"Screen too small (need %dx%d)",SCRNW,SCRNH);
+   errx(1, "Screen too small (need %dx%d)", SCRNW,SCRNH);
}
 #ifdef KEY_MIN
keypad(stdscr, TRUE);
@@ -77,7 +77,7 @@ cursinit()
  * Restore screen display.
  */
 void
-cursfini()
+cursfini(void)
 {
move(BSZ4, 0);
clrtoeol();
@@ -90,7 +90,7 @@ cursfini()
  * Initialize board display.
  */
 void
-bdisp_init()
+bdisp_init(void)
 {
int i, j;

@@ -99,6 +99,7 @@ bdisp_init()
move(0, 2 * i + 1);
addch(letters[i]);
}
+
/* left and right edges */
for (j = BSZ1; --j > 0; ) {
move(20 - j, 0);
@@ -106,6 +107,7 @@ bdisp_init()
move(20 - j, 2 * BSZ1 + 1);
printw("%d ", j);
}
+
/* bottom border */
for (i = 1; i < BSZ1; i++) {
move(20, 2 * i + 1);
@@ -122,8 +124,7 @@ bdisp_init()
  * Update who is playing whom.
  */
 void
-bdwho(update)
-   int update;
+bdwho(int update)
 {
int i, j;
extern char *plyr[];
@@ -133,7 +134,7 @@ bdwho(update)
i = strlen(plyr[BLACK]);
j = strlen(plyr[WHITE]);
if (i + j <= 20) {
-   move(21, 10 - (i + j)/2);
+   move(21, 10 - (i + j) / 2);
printw("BLACK/%s (*) vs. WHITE/%s (O)",
plyr[BLACK], plyr[WHITE]);
} else {
@@ -155,7 +156,7 @@ bdwho(update)
  * Update the board display after a move.
  */
 void
-bdisp()
+bdisp(void)
 {
int i, j, c;
struct spotstr *sp;
@@ -183,8 +184,7 @@ bdisp()
 /*
  * Dump board display to a file.
  */
-void bdump(fp)
-   FILE *fp;
+void bdump(FILE *fp)
 {
int i, j, c;
struct spotstr *sp;
@@ -222,10 +222,8 @@ void bdump(fp)
  * Display a transcript entry
  */
 void
-dislog(str)
-   char *str;
+dislog(char *str)
 {
-
if (++lastline >= SCRNH - 1) {
/* move 'em up */
lastline = 1;
@@ -243,8 +241,7 @@ dislog(str)
  * Display a question.
  */
 void
-ask(str)
-   char *str;
+ask(char *str)
 {
int len = strlen(str);

@@ -256,9 +253,7 @@ ask(str)
 }

 int
-getline(buf, size)
-   char *buf;
-   int size;
+getline(char *buf, int size)
 {
char *cp, *end;
int c = EOF;
@@ -299,11 +294,11 @@ getline(buf, size)
}
}
*cp = '\0';
-   return(c != EOF);
+   return (c != EOF);
 }

-
-/* Decent (n)curses interface for the game, based on Eric S. Raymond's
+/*
+ * Decent (n)curses interface for the game, based on Eric S. Raymond's
  * modifications to the battleship (bs) user interface.
  */
 int getcoord(void)
@@ -312,89 +307,115 @@ int getcoord(void)
static int cury = BSZ / 2;
int ny, nx, c;

-   BGOTO(cury,curx);
+   BGOTO(cury, curx);
refresh();
-   nx = curx; ny = cury;
+   nx = curx;
+   ny = cury;
for (;;) {
-   mvprintw(BSZ3, (BSZ -6)/2, "(%c %d)",
-   'A'+ ((curx > 7) ? (curx+1) : curx), cury + 1);
+   mvprintw(BSZ3, (BSZ - 6) / 2, "(%c %d)",
+   'A' + ((curx > 7) ? (curx + 1) : curx), cury + 1);
BGOTO(cury, curx);

switch(c = getch()) {
-   case 'k': case '8':
+   case 'k':
+   case '8':
 #ifdef KEY_MIN
case KEY_UP:
 #endif /* KEY_MIN */
-   ny = cury + 1;   nx = curx;
+   ny = cury + 1;
+   nx = curx;
break;
-   case 'j': case '2':
+   case 'j':
+   case '2':
 #ifdef KEY_MIN
case KEY_DOWN:
 #endif /* KEY_MIN */
-   ny = BSZ + cury - 1; nx = curx;
+   ny = BSZ + cury - 1;
+   nx = curx;
break;
-   case 'h': case '4':
+   case 'h':
+   case '4':
 #ifdef KEY_MIN
case KEY_LEFT:
 #endif /* KEY_MIN */
-   ny = cury;  nx = BSZ + curx - 1;
+   ny = cury;
+   nx = BSZ + curx - 1;
break;
-   case 'l': case '6':
+   case 'l':
+   case '6':
 #ifdef KEY_MIN
case KEY_RIGHT:
 #endif /* KEY_MIN */
-   ny = cury;  nx = curx + 1;
+   

Ansi diff for games/gomoku/bdinit.c

2009-06-03 Thread Daniel Ouellet

Index: bdinit.c
===
RCS file: /cvs/src/games/gomoku/bdinit.c,v
retrieving revision 1.5
diff -u -p -r1.5 bdinit.c
--- bdinit.c3 Jun 2003 03:01:39 -   1.5
+++ bdinit.c3 Jun 2009 23:33:19 -
@@ -43,8 +43,7 @@ static char rcsid[] = "$OpenBSD: bdinit.
 #include 

 void
-bdinit(bp)
-   struct spotstr *bp;
+bdinit(struct spotstr *bp)
 {
int i, j, r;
struct spotstr *sp;
@@ -170,7 +169,7 @@ bdinit(bp)
  * common open spaces shared between the two frames.
  */
 void
-init_overlap()
+init_overlap(void)
 {
struct spotstr *sp1, *sp2;
struct combostr *cbp;



Re: man page diff for bgpd.conf addressing the short version of network usage statement

2009-06-03 Thread Daniel Ouellet

Stuart Henderson wrote:

On 2009/06/02 22:38, Daniel Ouellet wrote:

+deny from any prefix { 192.168.0.0/16, 10/8 }


deny from any prefix { 192.168/16, 10/8 }


+good="{ 192.168.0.0/16, 172.16.0.0/12, 10/8 }"
+bad="{ 224.0.0.0/4, 240/4 }"
+ugly="{ 127.0.0.1/8, 169.254/16 }"


good="{ 192.168/16, 172.16/12, 10/8 }"
bad="{ 224/4, 240/4 }"
ugly="{ 127.0.0.1/8, 169.254/16 }"

if these are changed, the sample config file should also be
changed for consistency.


That would be good too and if agreed, I sure can send the patch for that 
as well if needed.



I'm not sure though. I imagine it might create a bit of
confusion to people who aren't used to this notation.
What's anyone else think?


Example in pf use the short version, so it's not really new however and 
along the man page it does not mix as I did on the same line for sure, I 
thought to show both examples and keep it simple that way, witch I guess 
could be confusion may be, but pf.conf however does use both variations 
in the man page at various places. Not on the same line however, that's 
true. But bgpd.conf do not, however it is supported and possible.


May be just the short version would be good then? As if you can use the 
short version, you sure can use the long one. Not having it there did 
push me to asked to confirmed if it was officially supported or not.




man page diff for bgpd.conf addressing the short version of network usage statement

2009-06-02 Thread Daniel Ouellet

Hi,

I meant to send this a while ago, but better to be late then never.

If I may, I would suggest to following changes in the example in the 
bgpd.conf man page that actually reflect the possible use of shorter 
version of filter statement in the configuration just like we have it in 
pf.conf as well.


This is to follow up on a question that I had about it and that Henning 
confirmed as it was possible, intended as such and that it was going to 
stay as well.


Reference and confirmation here:

http://marc.info/?l=openbsd-misc&m=123840595931523&w=2

So, may as well add the possibility in the example in the bgpd.conf no?

I did the changes as small as possible, but that would show the 
possibility as being there for sure.




Index: bgpd.conf.5
===
RCS file: /cvs/src/usr.sbin/bgpd/bgpd.conf.5,v
retrieving revision 1.92
diff -N -u -p bgpd.conf.5
--- bgpd.conf.5 27 May 2009 04:18:21 -  1.92
+++ bgpd.conf.5 3 Jun 2009 02:27:07 -
@@ -941,15 +941,15 @@ entries may be specified,
 separated by commas or whitespace,
 if enclosed in curly brackets:
 .Bd -literal -offset indent
-deny from any prefix { 192.168.0.0/16, 10.0.0.0/8 }
+deny from any prefix { 192.168.0.0/16, 10/8 }
 .Ed
 .Pp
 Multiple lists can also be specified, which is useful for
 macro expansion:
 .Bd -literal -offset indent
-good="{ 192.168.0.0/16, 172.16.0.0/12, 10.0.0.0/8 }"
-bad="{ 224.0.0.0/4, 240.0.0.0/4 }"
-ugly="{ 127.0.0.1/8, 169.254.0.0/16 }"
+good="{ 192.168.0.0/16, 172.16.0.0/12, 10/8 }"
+bad="{ 224.0.0.0/4, 240/4 }"
+ugly="{ 127.0.0.1/8, 169.254/16 }"

 deny from any prefix { $good $bad $ugly }
 .Ed



Re: usr.sbin/smtpd/aliases.c diif

2009-05-12 Thread Daniel Ouellet

Jacek Masiulaniec wrote:

You have a point there, although aliases_get is not the only place
that could benefit from this.


That looked even cleaner. (;>

I would also have suggested this below too, but not sure you would agree.

The ret integer is define and assign a value a few times, however, never 
used, so could also be removed as well.


Just a thought as you are looking into it.

Best,

Daniel

Index: aliases.c
===
RCS file: /cvs/src/usr.sbin/smtpd/aliases.c,v
retrieving revision 1.17
diff -N -u -p aliases.c
--- aliases.c   24 Apr 2009 10:02:35 -  1.17
+++ aliases.c   12 May 2009 15:42:00 -
@@ -64,20 +64,16 @@ aliases_exist(struct smtpd *env, char *username)
key.data = buf;
key.size = strlen(key.data) + 1;

-   if ((ret = aliasesdb->get(aliasesdb, &key, &val, 0)) == -1) {
-   aliasesdb->close(aliasesdb);
-   return 0;
-   }
+   ret = aliasesdb->get(aliasesdb, &key, &val, 0);
aliasesdb->close(aliasesdb);

-   return ret == 0 ? 1 : 0;
+   return (ret == 0);
 }

 int
 aliases_get(struct smtpd *env, struct aliaseslist *aliases, char 
*username)

 {
char buf[MAXLOGNAME];
-   int ret;
DBT key;
DBT val;
DB *aliasesdb;
@@ -100,7 +96,7 @@ aliases_get(struct smtpd *env, struct aliaseslist *ali
key.data = buf;
key.size = strlen(key.data) + 1;

-   if ((ret = aliasesdb->get(aliasesdb, &key, &val, 0)) != 0) {
+   if (aliasesdb->get(aliasesdb, &key, &val, 0) != 0) {
aliasesdb->close(aliasesdb);
return 0;
}
@@ -171,21 +167,17 @@ aliases_virtual_exist(struct smtpd *env, struct path *
key.data = strkey;
key.size = strlen(key.data) + 1;

-   if ((ret = aliasesdb->get(aliasesdb, &key, &val, 0)) != 0) {
-   aliasesdb->close(aliasesdb);
-   return 0;
-   }
+   ret = aliasesdb->get(aliasesdb, &key, &val, 0);
}
aliasesdb->close(aliasesdb);

-   return ret == 0 ? 1 : 0;
+   return (ret == 0);
 }

 int
 aliases_virtual_get(struct smtpd *env, struct aliaseslist *aliases,
struct path *path)
 {
-   int ret;
DBT key;
DBT val;
DB *aliasesdb;
@@ -215,7 +207,7 @@ aliases_virtual_get(struct smtpd *env, struct aliasesl
key.data = strkey;
key.size = strlen(key.data) + 1;

-   if ((ret = aliasesdb->get(aliasesdb, &key, &val, 0)) != 0) {
+   if (aliasesdb->get(aliasesdb, &key, &val, 0) != 0) {

if (! bsnprintf(strkey, sizeof(strkey), "@%s", path->domain)) {
aliasesdb->close(aliasesdb);
@@ -227,7 +219,7 @@ aliases_virtual_get(struct smtpd *env, struct aliasesl
key.data = strkey;
key.size = strlen(key.data) + 1;

-   if ((ret = aliasesdb->get(aliasesdb, &key, &val, 0)) != 0) {
+   if (aliasesdb->get(aliasesdb, &key, &val, 0) != 0) {
aliasesdb->close(aliasesdb);
return 0;
}



usr.sbin/smtpd/aliases.c diif

2009-05-11 Thread Daniel Ouellet

Hi,

Looking at the man page for the db get function, it return -1 on error 
and 1 if the key is not present and finally 0 on success.


In the aliases_exist() function there is the check for the errors there 
yes and close of the BD regardless if errors are there or not as it 
needs to be close anyway.


Then the function needs to return and want to return 1 on success and 0 
in any other cases, errors or not present key regardless.


So, wouldn't it be cleaner to have it shortened to this then?

This makes it more readable and shorten the code as well with the same 
outcome of returning1 only on success as intended.


Just something I came across reading it tonight. The possible error 
check are done in both cases this way.


Am I missing something obvious that I am not thinking about?

Best,

Daniel

Index: aliases.c
===
RCS file: /cvs/src/usr.sbin/smtpd/aliases.c,v
retrieving revision 1.17
diff -N -u -p aliases.c
--- aliases.c   24 Apr 2009 10:02:35 -  1.17
+++ aliases.c   12 May 2009 06:29:20 -
@@ -64,10 +64,7 @@ aliases_exist(struct smtpd *env, char *username)
key.data = buf;
key.size = strlen(key.data) + 1;

-   if ((ret = aliasesdb->get(aliasesdb, &key, &val, 0)) == -1) {
-   aliasesdb->close(aliasesdb);
-   return 0;
-   }
+   ret = aliasesdb->get(aliasesdb, &key, &val, 0);
aliasesdb->close(aliasesdb);

return ret == 0 ? 1 : 0;