From owner-freebsd-hackers Wed Jan 17 20:45:50 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id UAA10576 for hackers-outgoing; Wed, 17 Jan 1996 20:45:50 -0800 (PST) Received: from syzygy.zytek.com (syzygy.zytek.com [140.174.241.1]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id UAA10561 for ; Wed, 17 Jan 1996 20:45:40 -0800 (PST) Received: (from melvin@localhost) by syzygy.zytek.com (8.6.11/8.6.9) id UAA01261; Wed, 17 Jan 1996 20:45:24 -0800 Date: Wed, 17 Jan 1996 20:45:24 -0800 From: Stephen Melvin Message-Id: <199601180445.UAA01261@syzygy.zytek.com> To: hackers@freebsd.org Subject: How to set DF bit in outgoing packets? Sender: owner-hackers@freebsd.org Precedence: bulk I'm doing some network testing and I'd like to send out packets with the DF (don't fragment) bit set, which is bit 14 in the fragment offset field of the IP header. Here is what I tried that didn't work. I patched the kernel in /usr/src/sys/netinet as follows: 1. I added one line to in.h: -------- 168a169 < #define IP_OFF 17 /* int; IP fragment offset, DF, MF */ -------- 2. I added a few lines to ip_output.c: -------- 546a547 < case IP_OFF: 556a558,561 < < case IP_OFF: < inp->inp_ip.ip_off = optval; < break; -------- These changes should allow the setsockopt() call to set the DF bit as follows: val = IP_DF; setsockopt(s, IPPROTO_IP, IP_OFF, (char *)&val, sizeof(val)) ... sendto(s, ... But, these changes don't work. The call succeeds, and the packet is sent correctly, but the DF bit doesn't actually get set, or perhaps it is cleared somewhere before being sent. The other code in ip_output.c seems like it is preserving the DF bit and this seemed like the most reasonable way to do this but now I'm thinking that there must be a simpler way. ------- Steve Melvin melvin@zytek.com