Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Jan 2001 10:01:41 -0500 (EST)
From:      Alwyn Goodloe <agoodloe@gradient.cis.upenn.edu>
To:        Patrick Bihan-Faou <patrick@netzuno.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Divert Sockets & Fragmentation revisited
Message-ID:  <Pine.SOL.4.21.0101260958340.22683-100000@gradient.cis.upenn.edu>
In-Reply-To: <HJEEKLMFLKEOKHOKNPBMIEGDCJAA.patrick@netzuno.com>

next in thread | previous in thread | raw e-mail | index | archive | help
  Thanks for the suggestion I will give lsof a shot to see.
  
  I think the port binding is correct, otherwise I don't think it would
work when datagrams aren't fragmented. Like I said the code works fine
for datagrams < MTU ==> not fragmented but fails when they are. That being
said it NEVER HURTS TO CHECK.


Alwyn

agoodloe@gradient.cis.upenn.edu



On Fri, 26 Jan 2001, Patrick Bihan-Faou wrote:

> Hi,
> 
> Sorry to state something that is obvious, but when you bind your socket to
> the port, you have the port in the correct (network) order ?
> 
> i.e. do you use htons(DIVERTPort) ?
> 
> If you have lsof installed, run it and look at the port number that your
> program listens on.
> 
> 
> 
> Patrick.
> 
> 
> > Here is the important code fragments:
> >
> > Note: I have played with the MAX_PACKET_SIZE in hopes that it would make
> some
> > difference but to no avail.
> >
> > #define MAX_PACKET_SIZE  300000
> > #define DIVERTPort  4422
> > #define ACTIVE_UDP_PORT 3322
> >
> >
> > if ((divert_sock = socket(PF_INET, SOCK_RAW, IPPROTO_DIVERT)) < 0)
> >    sys_error("divert socket error");
> >  set_sock_data(&server_divert,PF_INET,DIVERTPort,INADDR_ANY);
> >  printf("Step 1  \n");    /* Register address and port with the system */
> >  if (bind(divert_sock, (struct sockaddr*)
> &server_divert,sizeof(server_divert)) < 0)
> >     sys_error("server_divert bind error");
> > for ( ; ; ) {
> >
> >     n = recvfrom (divert_sock,encaped_pkt,MAX_PACKET_SIZE,0,
> > 		  ( struct sockaddr * ) &client_add,&clilen);
> >
> >
> >
> >
> > To Unsubscribe: send mail to majordomo@FreeBSD.org
> > with "unsubscribe freebsd-hackers" in the body of the message
> >
> 
> 



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SOL.4.21.0101260958340.22683-100000>