From owner-freebsd-hackers Thu Jan 25 19:59:48 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from gradient.cis.upenn.edu (GRADIENT.CIS.UPENN.EDU [158.130.67.48]) by hub.freebsd.org (Postfix) with ESMTP id 0B4A637B400 for ; Thu, 25 Jan 2001 19:59:29 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by gradient.cis.upenn.edu (8.10.1/8.10.1) with ESMTP id f0Q3xRF09275 for ; Thu, 25 Jan 2001 22:59:27 -0500 (EST) Date: Thu, 25 Jan 2001 22:59:27 -0500 (EST) From: Alwyn Goodloe To: hackers@FreeBSD.org Subject: Divert Sockets & Fragmentation revisited Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Guys still having problems with divert sockets and fragmentation. As I said in a previous post the divert operations and corresponding program work fine when the datagram sent have size < MTU (1500) but when the datagram has size > MTU and hence get fragmented the recfrom just waits never receiving anything. I am attaching the relevent code fragments below. tcpdump tells me that the packets arrive on the interface. Hence I know the fragments arrive. Now my ipfw commands are: ipfw add 60000 divert 4422 udp from any to any 3322 in ipfw add 65000 allow ip from any to any Now I thought that that maybe the divert being so specific was a problem so I tried flushing ipfw and using the command: ipfw add 60000 divert 4422 ip from any to any thus diverting any ip packets and still nothing. Now according to the man page on divert: Incomming packets which get diverted are fully reassembled before delivery of any one fragment. Diversion of any one packet causes the entire packet to get diverted. I different fragments get diverted to different ports, then which port ultimately gets diverted is unpredictable. I was under the impression that the packets wern't reassemblembed before diversion. Am I wrong here? If the packets are reassembled before the diversion but as it says about that it may be unpredictable as to where they are sent could explain the case where I was redirecting udp packets heading toward 3322 but not the case where I was redirecting all IP packets. Any suggestions as to what stupid thing I have failed to do here. Alwyn Goodloe agoodloe@gradient.cis.upenn.edu 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