Module Name:    src
Committed By:   kefren
Date:           Fri Dec 31 11:29:34 UTC 2010

Modified Files:
        src/usr.sbin/ldpd: ldp_command.c

Log Message:
show in neighbour information if peer is MD5 authenticated


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/ldpd/ldp_command.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/ldpd/ldp_command.c
diff -u src/usr.sbin/ldpd/ldp_command.c:1.3 src/usr.sbin/ldpd/ldp_command.c:1.4
--- src/usr.sbin/ldpd/ldp_command.c:1.3	Thu Dec 30 11:29:21 2010
+++ src/usr.sbin/ldpd/ldp_command.c	Fri Dec 31 11:29:33 2010
@@ -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));

Reply via email to