diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-12-23 17:24:04 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-12-23 17:24:04 +0000 |
commit | e47c1496219f0d6a6f27bc322e56b5a8a327f4b4 (patch) | |
tree | b356c70dbf02069520f41a5192aa9472dc76a48d /usr.sbin | |
parent | 4b49ebbde244ad62ad3352277ed9d920e7201747 (diff) |
introduce getpeerbydesc(), find a peer by its description
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/bgpd/session.c | 14 | ||||
-rw-r--r-- | usr.sbin/bgpd/session.h | 3 |
2 files changed, 15 insertions, 2 deletions
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c index 6fab38bfd8e..fe20bd8151c 100644 --- a/usr.sbin/bgpd/session.c +++ b/usr.sbin/bgpd/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.210 2004/12/23 15:15:55 henning Exp $ */ +/* $OpenBSD: session.c,v 1.211 2004/12/23 17:24:03 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -2390,6 +2390,18 @@ getpeerbyaddr(struct bgpd_addr *addr) } struct peer * +getpeerbydesc(const char *descr) +{ + struct peer *p; + + for (p = peers; p != NULL && strcmp(p->conf.descr, descr); + p = p->next) + ; /* nothing */ + + return (p); +} + +struct peer * getpeerbyip(struct sockaddr *ip) { struct peer *p, *newpeer, *loose = NULL; diff --git a/usr.sbin/bgpd/session.h b/usr.sbin/bgpd/session.h index 103dc5fc368..9d45d121ec9 100644 --- a/usr.sbin/bgpd/session.h +++ b/usr.sbin/bgpd/session.h @@ -1,4 +1,4 @@ -/* $OpenBSD: session.h,v 1.74 2004/12/23 15:15:55 henning Exp $ */ +/* $OpenBSD: session.h,v 1.75 2004/12/23 17:24:03 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -184,6 +184,7 @@ pid_t session_main(struct bgpd_config *, struct peer *, struct mrt_head *, int[2], int[2], int[2]); void bgp_fsm(struct peer *, enum session_events); struct peer *getpeerbyaddr(struct bgpd_addr *); +struct peer *getpeerbydesc(const char *); int imsg_compose_parent(int, pid_t, void *, u_int16_t); int imsg_compose_rde(int, pid_t, void *, u_int16_t); |