1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-06 13:09:50 +00:00

Collapse two fields so that we have space for another 32 flags.

NB: You will have to recompile programs which use the `rt_use' member in
order to get the correct values.  This should not cause incorrect operation,
but the statistics may look a little confusing.
This commit is contained in:
Garrett Wollman 1994-11-03 01:04:32 +00:00
parent 512dc52632
commit f084e01477
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=4104
2 changed files with 10 additions and 3 deletions

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)route.c 8.2 (Berkeley) 11/15/93
* $Id: route.c,v 1.9 1994/10/11 23:16:27 wollman Exp $
* $Id: route.c,v 1.10 1994/11/02 04:41:25 wollman Exp $
*/
#include <sys/param.h>
@ -349,6 +349,7 @@ rtrequest(req, dst, gateway, netmask, flags, ret_nrt)
register struct radix_node_head *rnh;
struct ifaddr *ifa;
struct sockaddr *ndst;
u_long prflags = 0UL;
#define senderr(x) { error = x ; goto bad; }
if ((rnh = rt_tables[dst->sa_family]) == 0)
@ -383,6 +384,7 @@ rtrequest(req, dst, gateway, netmask, flags, ret_nrt)
senderr(EINVAL);
ifa = rt->rt_ifa;
flags = rt->rt_flags & ~RTF_CLONING;
prflags = rt->rt_prflags | RTPRF_WASCLONED;
gateway = rt->rt_gateway;
if ((netmask = rt->rt_genmask) == 0)
flags |= RTF_HOST;
@ -405,6 +407,7 @@ rtrequest(req, dst, gateway, netmask, flags, ret_nrt)
senderr(ENOBUFS);
Bzero(rt, sizeof(*rt));
rt->rt_flags = RTF_UP | flags;
rt->rt_prflags = prflags;
if (rt_setgate(rt, dst, gateway)) {
Free(rt);
senderr(ENOBUFS);

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)route.h 8.3 (Berkeley) 4/19/94
* $Id: route.h,v 1.3 1994/08/02 07:46:42 davidg Exp $
* $Id: route.h,v 1.4 1994/08/21 05:11:46 paul Exp $
*/
#ifndef _NET_ROUTE_H_
@ -95,9 +95,10 @@ struct rtentry {
#define rt_key(r) ((struct sockaddr *)((r)->rt_nodes->rn_key))
#define rt_mask(r) ((struct sockaddr *)((r)->rt_nodes->rn_mask))
struct sockaddr *rt_gateway; /* value */
/* XXX - rt_flags should be unified with rt_prflags */
short rt_flags; /* up/down?, host/net */
short rt_refcnt; /* # held references */
u_long rt_use; /* raw # packets forwarded */
u_long rt_prflags; /* protocol-specific flags */
struct ifnet *rt_ifp; /* the answer: interface to use */
struct ifaddr *rt_ifa; /* the answer: interface to use */
struct sockaddr *rt_genmask; /* for generation of cloned routes */
@ -120,6 +121,8 @@ struct ortentry {
struct ifnet *rt_ifp; /* the answer: interface to use */
};
#define rt_use rt_rmx.rmx_pksent
#define RTF_UP 0x1 /* route usable */
#define RTF_GATEWAY 0x2 /* destination is a gateway */
#define RTF_HOST 0x4 /* host entry (net otherwise) */
@ -136,6 +139,7 @@ struct ortentry {
#define RTF_PROTO2 0x4000 /* protocol specific routing flag */
#define RTF_PROTO1 0x8000 /* protocol specific routing flag */
#define RTPRF_WASCLONED 0x1 /* route generated through cloning */
/*
* Routing statistics.