diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-01-02 02:27:58 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-01-02 02:27:58 +0000 |
commit | 9534182c5f1bf1a7ec4e754a2467d8e8381510e1 (patch) | |
tree | 7fb661242d810373a86c21662688292b114bda48 | |
parent | 1a0709d60c1c81392407e590230d9a83e47b75d1 (diff) |
move the socket name #define to bgpd.h and get rid of bgpdctl*
-rw-r--r-- | usr.sbin/bgpd/bgpd.h | 4 | ||||
-rw-r--r-- | usr.sbin/bgpd/bgpdctl.8 | 49 | ||||
-rw-r--r-- | usr.sbin/bgpd/bgpdctl.c | 89 | ||||
-rw-r--r-- | usr.sbin/bgpd/bgpdctl.h | 19 | ||||
-rw-r--r-- | usr.sbin/bgpd/control.c | 3 |
5 files changed, 4 insertions, 160 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h index 0c6f5470fc9..cb552a46977 100644 --- a/usr.sbin/bgpd/bgpd.h +++ b/usr.sbin/bgpd/bgpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.h,v 1.46 2004/01/01 23:46:47 henning Exp $ */ +/* $OpenBSD: bgpd.h,v 1.47 2004/01/02 02:27:57 henning Exp $ */ /* * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> @@ -46,6 +46,8 @@ #define BGPD_LOG_UPDATES 0x0001 +#define SOCKET_NAME "/var/run/bgpd.sock" + enum { PROC_MAIN, PROC_SE, diff --git a/usr.sbin/bgpd/bgpdctl.8 b/usr.sbin/bgpd/bgpdctl.8 deleted file mode 100644 index 99aebb33d7b..00000000000 --- a/usr.sbin/bgpd/bgpdctl.8 +++ /dev/null @@ -1,49 +0,0 @@ -.\" $OpenBSD: bgpdctl.8,v 1.1 2004/01/01 23:51:40 henning Exp $ -.\" -.\" Copyright (c) 2003 Henning Brauer <henning@openbsd.org> -.\" -.\" Permission to use, copy, modify, and distribute this software for any -.\" purpose with or without fee is hereby granted, provided that the above -.\" copyright notice and this permission notice appear in all copies. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -.\" -.Dd December 22, 2003 -.Dt BGPDCTL 8 -.Os -.Sh NAME -.Nm bgpd -.Nd "control the Border Gateway Protocol daemon" -.Sh SYNOPSIS -.Nm bgpdctl -.Bk -words -.Op Fl dnv -.Ek -.Sh DESCRIPTION -The -.Nm -program controls the -.Xr bgpd -daemon. -The options are as follows: -.Bl -tag -width Ds -.El -.Sh SEE ALSO -.Xr bgpd 8 -.Sh FILES -.Bl -tag -width "/etc/bgpd.conf" -compact -.It Pa /etc/bgpd.conf -.Nm -configuration file. -.El -.Sh HISTORY -The -.Nm -program first appeared in -.Ox 3.5 . diff --git a/usr.sbin/bgpd/bgpdctl.c b/usr.sbin/bgpd/bgpdctl.c deleted file mode 100644 index 91e4aed8f36..00000000000 --- a/usr.sbin/bgpd/bgpdctl.c +++ /dev/null @@ -1,89 +0,0 @@ -/* $OpenBSD: bgpdctl.c,v 1.1 2004/01/01 23:51:40 henning Exp $ */ - -/* - * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <sys/types.h> -#include <sys/socket.h> -#include <sys/un.h> -#include <err.h> -#include <stdio.h> -#include <string.h> -#include <unistd.h> - -#include "bgpd.h" -#include "bgpdctl.h" - -int main(int, char *[]); - -struct imsgbuf ibuf; - -static const char *statenames[] = { - "None", - "Idle", - "Connect", - "Active", - "OpenSent", - "OpenConfirm", - "Established" -}; - -int -main(int argc, char *argv[]) -{ - struct sockaddr_un sun; - int fd, n; - struct imsg imsg; - struct peer *p; - - if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) { - err(1, "control_init: socket"); - exit(1); - } - - bzero(&sun, sizeof(sun)); - sun.sun_family = AF_UNIX; - strlcpy(sun.sun_path, SOCKET_NAME, sizeof(sun.sun_path)); - if (connect(fd, (struct sockaddr *)&sun, sizeof(sun)) == -1) { - err(1, "connect: %s", SOCKET_NAME); - exit(1); - } - - imsg_init(&ibuf, fd); - imsg_compose(&ibuf, IMSG_CTL_SHOW_NEIGHBOR, 0, NULL, 0); - imsg_read(&ibuf); - - for (;;) { - if ((n = imsg_get(&ibuf, &imsg)) == -1) - errx(1, "imsg_get error"); - - if (n == 0) - break; - - switch (imsg.hdr.type) { - case IMSG_CTL_SHOW_NEIGHBOR: - p = imsg.data; - printf("%s: %s\n", - inet_ntoa(p->conf.remote_addr.sin_addr), - statenames[p->state]); - break; - default: - break; - } - } - - close(fd); -} diff --git a/usr.sbin/bgpd/bgpdctl.h b/usr.sbin/bgpd/bgpdctl.h deleted file mode 100644 index b4a5b984b49..00000000000 --- a/usr.sbin/bgpd/bgpdctl.h +++ /dev/null @@ -1,19 +0,0 @@ -/* $OpenBSD: bgpdctl.h,v 1.1 2004/01/01 23:51:40 henning Exp $ */ - -/* - * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#define SOCKET_NAME "/var/run/bgpd.sock" diff --git a/usr.sbin/bgpd/control.c b/usr.sbin/bgpd/control.c index 75153ad677a..1ae375c1bdf 100644 --- a/usr.sbin/bgpd/control.c +++ b/usr.sbin/bgpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.1 2004/01/01 23:46:47 henning Exp $ */ +/* $OpenBSD: control.c,v 1.2 2004/01/02 02:27:57 henning Exp $ */ /* * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> @@ -25,7 +25,6 @@ #include <unistd.h> #include "bgpd.h" -#include "bgpdctl.h" #include "session.h" #define CONTROL_BACKLOG 5 |