From owner-freebsd-net@FreeBSD.ORG Thu Aug 14 11:56:32 2003 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 93CFE37B401 for ; Thu, 14 Aug 2003 11:56:32 -0700 (PDT) Received: from hysteria.spc.org (hysteria.spc.org [195.206.69.234]) by mx1.FreeBSD.org (Postfix) with SMTP id 41D7F43FBD for ; Thu, 14 Aug 2003 11:56:31 -0700 (PDT) (envelope-from bms@hysteria.spc.org) Received: (qmail 27963 invoked by uid 5013); 14 Aug 2003 18:53:42 -0000 Date: Thu, 14 Aug 2003 19:53:42 +0100 From: Bruce M Simpson To: Bill Fenner Message-ID: <20030814185342.GK1409@spc.org> Mail-Followup-To: Bruce M Simpson , Bill Fenner , freebsd-net@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i Organization: SPC cc: freebsd-net@freebsd.org Subject: Netmasks and PF_ROUTE rockets X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Aug 2003 18:56:32 -0000 Bill, Thanks for your help the other week. It seems, though, that in order to fix my code, I had to replicate exactly what route(8) did. Specifically, it fills out the netmask sockaddr_in in this way: it counts the number of bytes of netmask set within the sockaddr and sets sin_len accordingly. It is also necessary to pad each sockaddr after the rtmsg header to the nearest longword, otherwise nothing works. I have actually managed to panic the 5.1 kernel by passing a wrongly formatted routing message in. The on-demand routing example now works on its own without the need for the user to configure an interface or a route; they do have to specify a network address in CIDR notation which will be used with the XRESOLVE flag and the disc1 interface. They also need to kldload if_disc, I haven't brought maybeload in from ifconfig(8) [yet]. BMS