Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Jul 2000 03:42:01 +0900
From:      itojun@iijlab.net
To:        net@freebsd.org
Subject:   change to struct route
Message-ID:  <25456.963427321@coconut.itojun.org>

next in thread | raw e-mail | index | archive | help
	i'll want to do it for freebsd too (maybe post-4.1 item).
	are you guys happy with this?  the reason why we do not change
	the type for ro_dst (into sockaddr_storage) is that, if we do so,
	it will add too many typecasts in existing code.

itojun


------- Forwarded Message

Return-Path: <tech-net-owner-itojun=netbsd.org@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [155.53.1.253])
	by coconut.itojun.org (8.9.3+3.2W/3.7W) with SMTP id DAA23920
	for <itojun@itojun.org>; Thu, 13 Jul 2000 03:16:19 +0900 (JST)
Received: (qmail 21594 invoked by uid 1176); 12 Jul 2000 18:16:06 -0000
Delivered-To: itojun@netbsd.org
Received: (qmail 21411 invoked by uid 605); 12 Jul 2000 18:16:03 -0000
Received: (qmail 21404 invoked from network); 12 Jul 2000 18:16:02 -0000
Received: from dhcp0.itojun.org (HELO lychee.itojun.org) (210.160.95.106)
  by mail.netbsd.org with SMTP; 12 Jul 2000 18:16:02 -0000
Received: from kiwi.itojun.org (localhost [127.0.0.1])
	by itojun.org (8.10.0/3.7W) with ESMTP id e6CIEkH07639;
	Thu, 13 Jul 2000 03:14:46 +0900 (JST)
To: tech-net@netbsd.org
cc: core@kame.net
Subject: struct route
X-Template-Reply-To: itojun@itojun.org
X-Template-Return-Receipt-To: itojun@itojun.org
X-PGP-Fingerprint: F8 24 B4 2C 8C 98 57 FD  90 5F B4 60 79 54 16 E2
From: Jun-ichiro itojun Hagino <itojun@iijlab.net>
Date: Thu, 13 Jul 2000 03:14:46 +0900
Message-ID: <7637.963425686@localhost>
Sender: tech-net-owner@netbsd.org
Precedence: list
Delivered-To: tech-net@netbsd.org
X-Filter: mailagent [version 3.0 PL68] for itojun@itojun.org

	sys/net/route.h has struct route, which is like this:

struct route {
	struct  rtentry *ro_rt;
	struct  sockaddr ro_dst;
};

	This cannot hold sockaddr_iso or sockaddr_in6 (as sizeof(sockaddr) <
	sizeof(sockaddr_in6)), so there are local declarations for
	struct route-lookalike, in netiso (sys/netiso/iso_pcb.h) and netinet6
	(sys/netinet6/in6.h).  the approach has three issues, I believe:
	(1) maintenance nightmare.
	(2) offsetof(struct route, ro_dst) may not be equal to
	    offsetof(struct route_in6, ro_dst), as we are unsure about
	    struct packing rule by the compiler
	(3) if we mistakenly make a struct route_in6 * point to struct route
	    region, we will easily make a overrun.

	so, we'd like to change it as follows:

struct route {
	struct  rtentry *ro_rt;
	struct  sockaddr ro_dst;
	char padding[sizeof(struct sockaddr_storage) - sizeof(struct sockaddr)];
};

	and nuke special route-like structure in netiso/netinet6.
	the above change should not raise type issue against existing code
	(like sys/netinet), as we do not change the type of ro_dst.
	since struct route is kernel-only structure, the change should not
	raise binary compatibility problem against the userland.

	is it okay for you guys?  we are now testing this in kame tree and
	is working fine.

itojun

------- End of Forwarded Message



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




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