Move RTF_ANNOUNCE flag so that it no longer conflicts with RTF_PROTO2.

RTF_ANNOUNCE was defined as RTF_PROTO2.  The flag is used to indicated
that host should act as a proxy for a link level arp or ndp request.
(If RTF_PROTO2 is used as an experimental flag (as advertised),
various problems can occur.)

This commit provides a first-class definition with its own bit for
RTF_ANNOUNCE, removes the old aliasing definitions, and adds support
for the new RTF_ANNOUNCE flag to netstat(8) and route(8).,

Also, remove unused RTF_ flags that collide with RTF_PROTO1:
  netinet/icmp6.h defined RTF_PROBEMTU as RTF_PROTO1
  netinet/if_inarp.h defined RTF_USETRAILERS as RTF_PROTO1
  (Neither of these flags are used anywhere.  Both have been removed
  to reduce chances of collision with RTF_PROTO1.)

Figuring this out and the diff are the work of Beverly Schwartz of
BBN.

(Passed release build, boot in VM, with no apparently related atf
failures.)

Approved for Public Release, Distribution Unlimited
This material is based upon work supported by the Defense Advanced
Research Projects Agency and Space and Naval Warfare Systems Center,
Pacific, under Contract No. N66001-09-C-2073.
This commit is contained in:
gdt 2011-11-11 15:09:32 +00:00
parent 7b2c1e970a
commit c9bfbf1142
12 changed files with 26 additions and 28 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: keywords.c,v 1.8 2010/06/26 14:29:36 kefren Exp $ */
/* $NetBSD: keywords.c,v 1.9 2011/11/11 15:09:32 gdt Exp $ */
/* WARNING! This file was generated by keywords.sh */
@ -61,6 +61,7 @@ struct keytab keywords[] = {
{"noreject", K_NOREJECT},
{"mpls", K_MPLS},
{"tag", K_TAG},
{"proxy", K_PROXY},
{0, 0}
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: keywords.h,v 1.11 2010/06/26 14:29:36 kefren Exp $ */
/* $NetBSD: keywords.h,v 1.12 2011/11/11 15:09:32 gdt Exp $ */
/* WARNING! This file was generated by keywords.sh */
@ -63,3 +63,4 @@ extern struct keytab {
#define K_NOREJECT 53
#define K_MPLS 54
#define K_TAG 55
#define K_PROXY 56

View File

@ -1,5 +1,5 @@
#!/bin/sh
# $NetBSD: keywords.sh,v 1.9 2010/06/26 14:29:36 kefren Exp $
# $NetBSD: keywords.sh,v 1.10 2011/11/11 15:09:32 gdt Exp $
# @(#)keywords 8.2 (Berkeley) 3/19/94
#
# WARNING! If you change this file, re-run it!
@ -63,6 +63,7 @@ noblackhole
noreject
mpls
tag
proxy
_EOF_

View File

@ -1,4 +1,4 @@
.\" $NetBSD: route.8,v 1.45 2011/07/17 23:46:53 dholland Exp $
.\" $NetBSD: route.8,v 1.46 2011/11/11 15:09:32 gdt Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -295,6 +295,7 @@ by indicating the following corresponding modifiers:
-proto1 RTF_PROTO1 - set protocol specific routing flag #1
-proto2 RTF_PROTO2 - set protocol specific routing flag #2
-llinfo RTF_LLINFO - validly translates proto addr to link addr
-proxy RTF_ANNOUNCE - make entry a link level proxy
.Ed
.Pp
The optional modifiers

View File

@ -1,4 +1,4 @@
/* $NetBSD: route.c,v 1.133 2011/10/07 09:56:15 joerg Exp $ */
/* $NetBSD: route.c,v 1.134 2011/11/11 15:09:32 gdt Exp $ */
/*
* Copyright (c) 1983, 1989, 1991, 1993
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1989, 1991, 1993\
#if 0
static char sccsid[] = "@(#)route.c 8.6 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: route.c,v 1.133 2011/10/07 09:56:15 joerg Exp $");
__RCSID("$NetBSD: route.c,v 1.134 2011/11/11 15:09:32 gdt Exp $");
#endif
#endif /* not lint */
@ -922,6 +922,9 @@ newroute(int argc, char *const *argv)
case K_PROTO2:
flags |= RTF_PROTO2;
break;
case K_PROXY:
flags |= RTF_ANNOUNCE;
break;
case K_CLONING:
flags |= RTF_CLONING;
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: show.c,v 1.43 2011/02/04 14:31:23 martin Exp $ */
/* $NetBSD: show.c,v 1.44 2011/11/11 15:09:32 gdt Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94";
#else
__RCSID("$NetBSD: show.c,v 1.43 2011/02/04 14:31:23 martin Exp $");
__RCSID("$NetBSD: show.c,v 1.44 2011/11/11 15:09:32 gdt Exp $");
#endif
#endif /* not lint */
@ -70,7 +70,7 @@ __RCSID("$NetBSD: show.c,v 1.43 2011/02/04 14:31:23 martin Exp $");
* Definitions for showing gateway flags.
*/
struct bits {
short b_mask;
int b_mask;
char b_val;
};
static const struct bits bits[] = {
@ -90,6 +90,7 @@ static const struct bits bits[] = {
{ RTF_CLONED, 'c' },
{ RTF_PROTO1, '1' },
{ RTF_PROTO2, '2' },
{ RTF_ANNOUNCE, 'p' },
{ 0, '\0' }
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: route.h,v 1.79 2011/03/31 19:40:52 dyoung Exp $ */
/* $NetBSD: route.h,v 1.80 2011/11/11 15:09:32 gdt Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -154,6 +154,7 @@ struct ortentry {
#define RTF_PROTO2 0x4000 /* protocol specific routing flag */
#define RTF_PROTO1 0x8000 /* protocol specific routing flag */
#define RTF_SRC 0x10000 /* route has fixed source address */
#define RTF_ANNOUNCE 0x20000 /* announce new arp or ndp entry */
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: icmp6.h,v 1.42 2011/05/24 18:07:11 spz Exp $ */
/* $NetBSD: icmp6.h,v 1.43 2011/11/11 15:09:32 gdt Exp $ */
/* $KAME: icmp6.h,v 1.84 2003/04/23 10:26:51 itojun Exp $ */
@ -641,8 +641,6 @@ struct icmp6_filter {
{ "nd6_maxqueuelen", CTLTYPE_INT }, \
}
#define RTF_PROBEMTU RTF_PROTO1
#ifdef _KERNEL
struct rtentry;
struct rttimer;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_inarp.h,v 1.42 2009/02/18 13:17:50 yamt Exp $ */
/* $NetBSD: if_inarp.h,v 1.43 2011/11/11 15:09:33 gdt Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -52,12 +52,6 @@ struct sockaddr_inarp {
#define SIN_PROXY 1
};
/*
* IP and ethernet specific routing flags
*/
#define RTF_USETRAILERS RTF_PROTO1 /* use trailers */
#define RTF_ANNOUNCE RTF_PROTO2 /* announce new arp entry */
#ifdef _KERNEL
extern struct ifqueue arpintrq;
void arp_ifinit(struct ifnet *, struct ifaddr *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: nd6.h,v 1.54 2011/05/24 18:07:11 spz Exp $ */
/* $NetBSD: nd6.h,v 1.55 2011/11/11 15:09:33 gdt Exp $ */
/* $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $ */
/*
@ -33,11 +33,6 @@
#ifndef _NETINET6_ND6_H_
#define _NETINET6_ND6_H_
/* see net/route.h, or net/if_inarp.h */
#ifndef RTF_ANNOUNCE
#define RTF_ANNOUNCE RTF_PROTO2
#endif
#include <sys/queue.h>
#include <sys/callout.h>

View File

@ -1,4 +1,4 @@
.\" $NetBSD: netstat.1,v 1.61 2011/06/21 20:51:27 wiz Exp $
.\" $NetBSD: netstat.1,v 1.62 2011/11/11 15:09:33 gdt Exp $
.\"
.\" Copyright (c) 1983, 1990, 1992, 1993
.\" The Regents of the University of California. All rights reserved.
@ -348,6 +348,7 @@ The mapping between letters and flags is:
.It H RTF_HOST Host entry (net otherwise)
.It L RTF_LLINFO Valid protocol to link address translation.
.It M RTF_MODIFIED Modified dynamically (by redirect)
.It p RTF_ANNOUNCE Link level proxy
.It R RTF_REJECT Host or net unreachable
.It S RTF_STATIC Manually added
.It U RTF_UP Route usable

View File

@ -1,4 +1,4 @@
/* $NetBSD: show.c,v 1.14 2011/06/21 19:42:45 kefren Exp $ */
/* $NetBSD: show.c,v 1.15 2011/11/11 15:09:33 gdt Exp $ */
/* $OpenBSD: show.c,v 1.1 2006/05/27 19:16:37 claudio Exp $ */
/*
@ -90,6 +90,7 @@ static const struct bits bits[] = {
/* { RTF_PROTO3, '3' }, */
{ RTF_CLONED, 'c' },
/* { RTF_JUMBO, 'J' }, */
{ RTF_ANNOUNCE, 'p' },
{ 0, 0 }
};