From owner-freebsd-hackers Mon Jan 26 02:05:14 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id CAA04569 for hackers-outgoing; Mon, 26 Jan 1998 02:05:14 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from ifi.uio.no (0@ifi.uio.no [129.240.64.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id CAA04561 for ; Mon, 26 Jan 1998 02:05:09 -0800 (PST) (envelope-from dag-erli@ifi.uio.no) Received: from gjallarhorn.ifi.uio.no (2602@gjallarhorn.ifi.uio.no [129.240.65.40]) by ifi.uio.no (8.8.8/8.8.7/ifi0.2) with ESMTP id LAA08068; Mon, 26 Jan 1998 11:05:00 +0100 (MET) Received: (from dag-erli@localhost) by gjallarhorn.ifi.uio.no ; Mon, 26 Jan 1998 11:04:59 +0100 (MET) To: marc@bowtie.nl Cc: hackers@FreeBSD.ORG Subject: Re: Is it possible to .. References: <199801260935.KAA27363@bowtie.nl> Organization: Gutteklubben Terrasse X-url: http://www.ifi.uio.no/~dag-erli/ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit From: dag-erli@ifi.uio.no (Dag-Erling Coidan Smørgrav) Date: 26 Jan 1998 11:04:59 +0100 In-Reply-To: Marc van Kempen's message of "Mon, 26 Jan 1998 10:35:11 +0100" Message-ID: Lines: 29 X-Mailer: Gnus v5.5/Emacs 19.34 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk Marc van Kempen writes: > send/receive udp (broadcast) packets when you don't know > your IP nr. yet? It must be possible since bootp does it, > but how? According to RFC 951 (Bootstrap protocol), a client which does not know its own IP address sets the source address of the bootrequest to 0.0.0.0. The server sets the yiaddr (Your Ip ADDRess) field in the bootreply packet to the client's IP address. The reply is sent to the broadcast address at a reserved port so that other hosts that see the bootreply are not confused by it. Obviously, if you know the underlying hardware protocol, you can do better than that. In most cases (take Ethernet as an example), the server shouldn't need to actually broadcast the bootreply, since it knows the MAC address of the requesting host; but the destination IP address should still be set to the broadcast address, otherwise the client will drop the packet as 'not for me'. If what you really meant to ask is "how do I use a network interface before it's configured", you can always ifconfig with a bogus address (0.0.0.0), enable promiscuous mode, and then use bpf to bypass the TCP/IP stack and "roll your own packets". Again, this requires knowledge of the underlying hardware protocol. Ethernet should be simple enough; read /sys/net/ethernet.h and /sys/net/if_ethersubr.c. -- * Finrod (INTJ) * Unix weenie * dag-erli@ifi.uio.no * cellular +47-92835919 * RFC1123: "Be liberal in what you accept, and conservative in what you send"