-.\" $OpenBSD: bgpctl.8,v 1.82 2018/09/09 12:53:00 benno Exp $
+.\" $OpenBSD: bgpctl.8,v 1.83 2018/10/03 11:36:39 denis Exp $
.\"
.\" Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
.\"
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: September 9 2018 $
+.Dd $Mdocdate: October 3 2018 $
.Dt BGPCTL 8
.Os
.Sh NAME
Show all entries with
.Ar as
anywhere but rightmost.
+.It Cm ovs Pq Ic valid | not-found | invalid
+Show all entries with matching Origin Validation State (OVS).
.El
.Pp
Additionally, the following
-/* $OpenBSD: parser.c,v 1.85 2018/09/07 05:47:02 claudio Exp $ */
+/* $OpenBSD: parser.c,v 1.86 2018/10/03 11:36:39 denis Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
static const struct token t_show_summary[];
static const struct token t_show_fib[];
static const struct token t_show_rib[];
+static const struct token t_show_ovs[];
static const struct token t_show_mrt[];
static const struct token t_show_mrt_file[];
static const struct token t_show_rib_neigh[];
{ KEYWORD, "table", NONE, t_show_rib_rib},
{ KEYWORD, "summary", SHOW_SUMMARY, t_show_summary},
{ KEYWORD, "memory", SHOW_RIB_MEM, NULL},
+ { KEYWORD, "ovs", NONE, t_show_ovs},
{ FAMILY, "", NONE, t_show_rib},
{ PREFIX, "", NONE, t_show_prefix},
{ ENDTOKEN, "", NONE, NULL}
};
+static const struct token t_show_ovs[] = {
+ { FLAG, "valid" , F_CTL_OVS_VALID, t_show_rib},
+ { FLAG, "invalid", F_CTL_OVS_INVALID, t_show_rib},
+ { FLAG, "not-found", F_CTL_OVS_NOTFOUND, t_show_rib},
+ { ENDTOKEN, "", NONE, NULL}
+};
static const struct token t_show_mrt[] = {
{ NOTOKEN, "", NONE, NULL},
-/* $OpenBSD: bgpd.h,v 1.348 2018/10/01 23:09:53 job Exp $ */
+/* $OpenBSD: bgpd.h,v 1.349 2018/10/03 11:36:39 denis Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
#define F_RTLABEL 0x10000
#define F_CTL_SSV 0x20000 /* only used by bgpctl */
#define F_CTL_INVALID 0x40000 /* only used by bgpctl */
+#define F_CTL_OVS_VALID 0x80000
+#define F_CTL_OVS_INVALID 0x100000
+#define F_CTL_OVS_NOTFOUND 0x200000
/*
* Note that these numeric assignments differ from the numbers commonly
-/* $OpenBSD: rde.c,v 1.432 2018/10/01 23:09:53 job Exp $ */
+/* $OpenBSD: rde.c,v 1.433 2018/10/03 11:36:39 denis Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
void rde_shutdown(void);
int sa_cmp(struct bgpd_addr *, struct sockaddr *);
+int ovs_match(struct prefix *, u_int32_t);
volatile sig_atomic_t rde_quit = 0;
struct bgpd_config *conf, *nconf;
!community_large_match(asp, req->large_community.as,
req->large_community.ld1, req->large_community.ld2))
return;
+ if (!ovs_match(p, req->flags))
+ return;
rde_dump_rib_as(p, asp, req->pid, req->flags);
}
}
r = trie_roa_check(&ps->th, prefix, plen, as);
return (r & ROA_MASK);
}
+
+int
+ovs_match(struct prefix *p, u_int32_t flag)
+{
+ if (flag & (F_CTL_OVS_VALID|F_CTL_OVS_INVALID|F_CTL_OVS_NOTFOUND)) {
+ switch (prefix_vstate(p)) {
+ case ROA_VALID:
+ if (!(flag & F_CTL_OVS_VALID))
+ return 0;
+ break;
+ case ROA_INVALID:
+ if (!(flag & F_CTL_OVS_INVALID))
+ return 0;
+ break;
+ case ROA_NOTFOUND:
+ if (!(flag & F_CTL_OVS_NOTFOUND))
+ return 0;
+ break;
+ default:
+ break;
+ }
+ }
+
+ return 1;
+}