Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/ldpd show in neighbour information if peer is MD5 a...



details:   https://anonhg.NetBSD.org/src/rev/6ea37c1a9aaa
branches:  trunk
changeset: 760224:6ea37c1a9aaa
user:      kefren <kefren%NetBSD.org@localhost>
date:      Fri Dec 31 11:29:33 2010 +0000

description:
show in neighbour information if peer is MD5 authenticated

diffstat:

 usr.sbin/ldpd/ldp_command.c |  14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diffs (42 lines):

diff -r 2072a0b51274 -r 6ea37c1a9aaa usr.sbin/ldpd/ldp_command.c
--- a/usr.sbin/ldpd/ldp_command.c       Fri Dec 31 10:56:39 2010 +0000
+++ b/usr.sbin/ldpd/ldp_command.c       Fri Dec 31 11:29:33 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ldp_command.c,v 1.3 2010/12/30 11:29:21 kefren Exp $ */
+/* $NetBSD: ldp_command.c,v 1.4 2010/12/31 11:29:33 kefren Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -32,6 +32,7 @@
 #include <arpa/inet.h>
 
 #include <netinet/in.h>
+#include <netinet/tcp.h>
 
 #include <sys/socket.h>
 #include <sys/queue.h>
@@ -380,6 +381,8 @@
        struct ldp_peer_address *wp;
        struct sockaddr_in ssin;
        socklen_t sin_len = sizeof(struct sockaddr_in);
+       int enc;
+       socklen_t enclen = sizeof(enc);
 
        SLIST_FOREACH(p, &ldp_peer_head, peers) {
                snprintf(sendspace, MAXSEND, "LDP peer: %s\n",
@@ -410,6 +413,15 @@
                        if (getsockname(p->socket,(struct sockaddr *) &ssin,
                            &sin_len))
                                break;
+
+                       if (getsockopt(p->socket, IPPROTO_TCP, TCP_MD5SIG,
+                           &enc, &enclen) == 0) {
+                               snprintf(sendspace, MAXSEND,
+                                   "Authenticated: %s\n",
+                                   enc != 0 ? "YES" : "NO");
+                               writestr(s, sendspace);
+                       }
+
                        snprintf(sendspace, MAXSEND,"Socket: %d\nLocal %s:%d\n",
                            p->socket, inet_ntoa(ssin.sin_addr),
                            ntohs(ssin.sin_port));



Home | Main Index | Thread Index | Old Index