[Snort-users] yet another unix socket question...

Dr. Richard W. Tibbs ccamp at ...4532...
Sat Jan 12 15:09:05 EST 2002


OOps. Sorry list, I did a little google search and realized my problem.
Please ignore this thread.
What is apparently the problem is that a socket file handle named 
/tmp/yaddafile is created upon first (successful) execution of the bind 
call.
Then, forever thereafter, unless you rm -f /tmp/yaddafile, bind gives 
you error 98, "address in use".

Thx...

Dr. Richard W. Tibbs wrote:

> Dear list :
> 
> After searching the archives (and finding a few postings; thanks to 
> Fyodor) I am still not able to figure out my problem.  I am trying to 
> write a reciever socket program to use with snort using the output 
> alert to unixsock facility.
> 
> The attached code snipet fails upon the bind command, with errno 98.
> I have debugged the code in kdb and the myname struct looks fine, as 
> does the sock variable.
> 
> Any idea what is wrong ?
> 
> Thanks in advance....
> 
> 
> ------------------------------------------------------------------------
> 
> 
> 
> 
>   sock = socket(AF_UNIX, SOCK_DGRAM, 0);
>   if (sock < 0) {
>     printf("socket failure %d\n", errno);
>     exit(1);
>   }
> 
>   myname.sa_family = AF_UNIX;
>   strcpy(myname.sa_data, "/tmp/somefile");
>   addrlen =  strlen(myname.sa_data) + sizeof(myname.sa_family) ;
>   if (bind(sock, (struct sockaddr *) &myname, addrlen ) < 0) {
>     printf("bind failure %d\n", errno);
>     exit(1);
>   }
> 
>   cnt = recvfrom(sock, buf, sizeof(buf),
>     0, &from_name, &fromlen);
> 
> /* etc.... */







More information about the Snort-users mailing list