Date: Thu, 18 Jan 1996 19:09:51 -0800 (PST) From: Julian Elischer <julian@ref.tfs.com> To: leisner@sdsp.mc.xerox.com (Marty Leisner) Cc: hackers@freebsd.org, samba-bugs@anu.edu.au Subject: Re: sin_len in sockaddr_in? Message-ID: <199601190309.TAA05754@ref.tfs.com> In-Reply-To: <9601181730.AA12865@gnu.mc.xerox.com> from "Marty Leisner" at Jan 18, 96 09:30:58 am
next in thread | previous in thread | raw e-mail | index | archive | help
The length is because a sockaddr_in is just a derived type from sockaddr, and sockaddr needs a length field to accomodate such things as: long ISO addresses unix domain sockets with flesystem addreses. some addresses can be variable length (!) -other new protocols (ipV6?) this is from net/2 and BSD4.4 directly > > > I'm working with samba 1.9.15p8 (on Sunos...) > > I want to close the accepting connections after the fork... > > I noticed: > (in util.c) > > 3688 > 3689 bzero((char *)&sock,sizeof(sock)); > 3690 memcpy((char *)&sock.sin_addr,(char *)hp->h_addr, hp->h_length); > 3691 #if defined(__FreeBSD__) || defined(NETBSD) /* XXX not the right ifdef * > 3692 sock.sin_len = sizeof(sock); > 3693 #endif > 3694 sock.sin_port = htons( port ); > 3695 sock.sin_family = hp->h_addrtype; > 3696 sock.sin_addr.s_addr = INADDR_ANY; > 3697 > > sock is sockaddr_in... > > On sunos Its defined as: > struct sockaddr_in { > short sin_family; > u_short sin_port; > struct in_addr sin_addr; > char sin_zero[8]; > }; > > what's going on? we pass the length in the call anyway.. > > On freebsd it looks like: > struct sockaddr_in { > u_char sin_len; > u_char sin_family; > u_short sin_port; > struct in_addr sin_addr; > char sin_zero[8]; > }; > > > > marty leisner@sdsp.mc.xerox.com > Member of the League for Programming Freedom (http://www.lpf.org) > Any sufficiently advanced technology is indistinguishable from magic > Arthur C. Clarke, The Lost Worlds of 2001 >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199601190309.TAA05754>