sockaddr_in initialization in ttcp (possibly other programs affected)

2016-09-06 Thread Héctor Luis Gimbatti
Greetings,

I post this to .misc since some other (than ttcp) programs might not work in
recent versions of OBSD.



In OBSD 5.6 I am able to run ttcp.



$ uname -a

OpenBSD pez.etale.com.ar 5.6 GENERIC.MP#333 amd64

$ ttcp -r -s

ttcp-r: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp

ttcp-r: socket



In OBSD 5.9 and 6.0 I am not able to run it (sadly I do not have running
machines with 5.7 nor 5.8).



$ uname -a

OpenBSD bsd002.vmn.etale.com.ar 6.0 GENERIC.MP#1917 i386

$ ttcp -r -s

ttcp-r: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp

ttcp-r: socket

ttcp-r: bind: Address family not supported by protocol family

errno=47



Looking at the code in ttcp.c the problem seems to be that the field
sin_family in the structure sockaddr_in (sinme) is not initialized.

By adding sinme.sin_family = AF_INET; before bind(...) the program works
fine.





Cheers

--- HLG



Re: sockaddr_in initialization in ttcp (possibly other programs affected)

2016-09-09 Thread Philip Guenther
On Tue, 6 Sep 2016, Héctor Luis Gimbatti wrote:
> I post this to .misc since some other (than ttcp) programs might not 
> work in recent versions of OBSD.
> 
> In OBSD 5.6 I am able to run ttcp.
> 
> $ uname -a
> OpenBSD pez.etale.com.ar 5.6 GENERIC.MP#333 amd64
> $ ttcp -r -s
> ttcp-r: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp
> ttcp-r: socket
>
> In OBSD 5.9 and 6.0 I am not able to run it (sadly I do not have running
> machines with 5.7 nor 5.8).

The change was in 5.9, with this commit to in_pcb.c:


revision 1.178
date: 2015/09/11 13:59:27;  author: vgross;  state: Exp;  lines: +3 -7;  
commitid: NyNuX1q0M9Dwr560;
Stricter checks on sockaddr content when binding PF_INET sockets.

Ok mpi@


Unless this is just the most recent in a series of similar reports, I 
doubt we'll back this out or revise the check; it's just old code, written 
in the slightly sloppy style of the time.


> Looking at the code in ttcp.c the problem seems to be that the field 
> sin_family in the structure sockaddr_in (sinme) is not initialized.
>
> By adding sinme.sin_family = AF_INET; before bind(...) the program works 
> fine.

No specific maintainer on the port, so I suggest you send your diff to 
po...@openbsd.org, so it can be included in ports and packages going 
forward.


Philip Guenther



Re: sockaddr_in initialization in ttcp (possibly other programs affected)

2016-09-12 Thread Jeremie Courreges-Anglas
Philip Guenther  writes:

> On Tue, 6 Sep 2016, Héctor Luis Gimbatti wrote:
>> I post this to .misc since some other (than ttcp) programs might not
>> work in recent versions of OBSD.
>>
>> In OBSD 5.6 I am able to run ttcp.
>>
>> $ uname -a
>> OpenBSD pez.etale.com.ar 5.6 GENERIC.MP#333 amd64
>> $ ttcp -r -s
>> ttcp-r: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp
>> ttcp-r: socket
>>
>> In OBSD 5.9 and 6.0 I am not able to run it (sadly I do not have running
>> machines with 5.7 nor 5.8).
>
> The change was in 5.9, with this commit to in_pcb.c:
>
> 
> revision 1.178
> date: 2015/09/11 13:59:27;  author: vgross;  state: Exp;  lines: +3 -7;
> commitid: NyNuX1q0M9Dwr560;
> Stricter checks on sockaddr content when binding PF_INET sockets.
>
> Ok mpi@
> 
>
> Unless this is just the most recent in a series of similar reports, I
> doubt we'll back this out or revise the check; it's just old code, written
> in the slightly sloppy style of the time.
>
>
>> Looking at the code in ttcp.c the problem seems to be that the field
>> sin_family in the structure sockaddr_in (sinme) is not initialized.
>>
>> By adding sinme.sin_family = AF_INET; before bind(...) the program works
>> fine.
>
> No specific maintainer on the port, so I suggest you send your diff to
> po...@openbsd.org, so it can be included in ports and packages going
> forward.

+1, misc is not for bug reports.

Anyway, I went ahead and deleted net/ttcp.  It was old, unmaintained
code, and showed scary compile-time warnings (implicit declaration of
malloc for example).  For better alternatives, see tcpbench in base or
net/iperf in ports.

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



Re: sockaddr_in initialization in ttcp (possibly other programs affected)

2016-09-13 Thread Héctor Luis Gimbatti
Hi,
The main reason I've notified this ''bug'' to .misc is because other
(important, maintained, in base? , etc) code may fail too.

Cheers

> -Original Message-
> From: Jeremie Courreges-Anglas [mailto:j...@wxcvbn.org]
> Sent: Monday, September 12, 2016 10:30
> To: Héctor Luis Gimbatti 
> Cc: misc@openbsd.org; Philip Guenther 
> Subject: Re: sockaddr_in initialization in ttcp (possibly other programs
affected)
>
> Philip Guenther  writes:
>
> > On Tue, 6 Sep 2016, Héctor Luis Gimbatti wrote:
> >> I post this to .misc since some other (than ttcp) programs might not
> >> work in recent versions of OBSD.
> >>
> >> In OBSD 5.6 I am able to run ttcp.
> >>
> >> $ uname -a
> >> OpenBSD pez.etale.com.ar 5.6 GENERIC.MP#333 amd64 $ ttcp -r -s
> >> ttcp-r: buflen=8192, nbuf=2048, align=16384/0, port=5001  tcp
> >> ttcp-r: socket
> >>
> >> In OBSD 5.9 and 6.0 I am not able to run it (sadly I do not have
> >> running machines with 5.7 nor 5.8).
> >
> > The change was in 5.9, with this commit to in_pcb.c:
> >
> > 
> > revision 1.178
> > date: 2015/09/11 13:59:27;  author: vgross;  state: Exp;  lines: +3
> > -7;
> > commitid: NyNuX1q0M9Dwr560;
> > Stricter checks on sockaddr content when binding PF_INET sockets.
> >
> > Ok mpi@
> > 
> >
> > Unless this is just the most recent in a series of similar reports, I
> > doubt we'll back this out or revise the check; it's just old code,
> > written in the slightly sloppy style of the time.
> >
> >
> >> Looking at the code in ttcp.c the problem seems to be that the field
> >> sin_family in the structure sockaddr_in (sinme) is not initialized.
> >>
> >> By adding sinme.sin_family = AF_INET; before bind(...) the program
> >> works fine.
> >
> > No specific maintainer on the port, so I suggest you send your diff to
> > po...@openbsd.org, so it can be included in ports and packages going
> > forward.
>
> +1, misc is not for bug reports.
>
> Anyway, I went ahead and deleted net/ttcp.  It was old, unmaintained code,
and
> showed scary compile-time warnings (implicit declaration of malloc for
> example).  For better alternatives, see tcpbench in base or net/iperf in
ports.
>
> --
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524
> E7EE

[demime 1.01d removed an attachment of type application/pkcs7-signature which 
had a name of smime.p7s]