Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/ldpd * add initial IPv6 support - still incomplete ...
details: https://anonhg.NetBSD.org/src/rev/a19fef6032b8
branches: trunk
changeset: 782653:a19fef6032b8
user: kefren <kefren%NetBSD.org@localhost>
date: Mon Nov 12 18:39:00 2012 +0000
description:
* add initial IPv6 support - still incomplete at this moment, but it sends
out there IPv6 hellos. Interoperability not yet tested.
* sync man page with reality
diffstat:
usr.sbin/ldpd/Makefile | 6 +-
usr.sbin/ldpd/conffile.c | 16 +-
usr.sbin/ldpd/fsm.c | 13 +-
usr.sbin/ldpd/ldp.h | 5 +-
usr.sbin/ldpd/ldp_peer.c | 5 +-
usr.sbin/ldpd/ldp_peer.h | 4 +-
usr.sbin/ldpd/ldpd.8 | 41 +++--
usr.sbin/ldpd/main.c | 4 +-
usr.sbin/ldpd/notifications.h | 4 +-
usr.sbin/ldpd/socketops.c | 301 ++++++++++++++++++++++++++++++++---------
usr.sbin/ldpd/socketops.h | 8 +-
usr.sbin/ldpd/tlv.h | 7 +-
usr.sbin/ldpd/tlv_stack.c | 9 +-
13 files changed, 306 insertions(+), 117 deletions(-)
diffs (truncated from 846 to 300 lines):
diff -r b1fb54fbb546 -r a19fef6032b8 usr.sbin/ldpd/Makefile
--- a/usr.sbin/ldpd/Makefile Mon Nov 12 18:00:34 2012 +0000
+++ b/usr.sbin/ldpd/Makefile Mon Nov 12 18:39:00 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.3 2010/12/30 11:29:21 kefren Exp $
+# $NetBSD: Makefile,v 1.4 2012/11/12 18:39:00 kefren Exp $
.include <bsd.own.mk>
@@ -22,4 +22,8 @@
LDADD+= -lcrypt
+.if (${USE_INET6} != "no")
+CPPFLAGS+=-DINET6
+.endif
+
.include <bsd.prog.mk>
diff -r b1fb54fbb546 -r a19fef6032b8 usr.sbin/ldpd/conffile.c
--- a/usr.sbin/ldpd/conffile.c Mon Nov 12 18:00:34 2012 +0000
+++ b/usr.sbin/ldpd/conffile.c Mon Nov 12 18:39:00 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: conffile.c,v 1.3 2011/06/14 11:28:51 kefren Exp $ */
+/* $NetBSD: conffile.c,v 1.4 2012/11/12 18:39:00 kefren Exp $ */
/*
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
#define LINEMAXSIZE 1024
extern int ldp_hello_time, ldp_keepalive_time, ldp_holddown_time, command_port,
- min_label, max_label, no_default_route;
+ min_label, max_label, no_default_route, loop_detection;
int confh;
struct in_addr conf_ldp_id;
@@ -62,6 +62,7 @@
static int Fneighbour(char*);
static int Gneighbour(struct conf_neighbour *, char *);
static int Fnodefault(char*);
+static int Floopdetection(char*);
struct conf_func {
char com[64];
@@ -79,6 +80,7 @@
{ "neighbor", Fneighbour },
{ "neighbour", Fneighbour },
{ "no-default-route", Fnodefault },
+ { "loop-detection", Floopdetection },
{ "", NULL },
};
@@ -312,3 +314,13 @@
no_default_route = nd;
return 0;
}
+
+int
+Floopdetection(char *line)
+{
+ int loopd = atoi(line);
+ if (loopd < 0)
+ return E_CONF_PARAM;
+ loop_detection = loopd;
+ return 0;
+}
diff -r b1fb54fbb546 -r a19fef6032b8 usr.sbin/ldpd/fsm.c
--- a/usr.sbin/ldpd/fsm.c Mon Nov 12 18:00:34 2012 +0000
+++ b/usr.sbin/ldpd/fsm.c Mon Nov 12 18:39:00 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fsm.c,v 1.5 2011/06/16 14:48:30 kefren Exp $ */
+/* $NetBSD: fsm.c,v 1.6 2012/11/12 18:39:00 kefren Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -56,6 +56,7 @@
{
struct ldp_peer *peer = NULL;
struct in_addr peer_addr;
+ struct in6_addr peer_addr6;
struct transport_address_tlv *trtlv;
struct hello_info *hi;
@@ -113,16 +114,20 @@
if (trtlv->type == TLV_IPV4_TRANSPORT)
memcpy(&peer_addr, &trtlv->address,
sizeof(struct in_addr));
+ else if (trtlv->type == TLV_IPV6_TRANSPORT)
+ memcpy(&peer_addr6, &trtlv->address,
+ sizeof(struct in6_addr));
} else
trtlv = NULL;
/*
- * RFC says: If A1 > A2, LSR1 plays the active role;
+ * RFC 5036 2.5.2: If A1 > A2, LSR1 plays the active role;
* otherwise it is passive.
*/
if (ntohl(peer_addr.s_addr) < ntohl(ladd->s_addr)) {
-#define TRADDR (trtlv && trtlv->type == TLV_IPV4_TRANSPORT) ? &peer_addr : NULL
+#define TR_INET4_ADDR (trtlv && trtlv->type == TLV_IPV4_TRANSPORT) ? &peer_addr : NULL
+#define TR_INET6_ADDR NULL
peer = ldp_peer_new(&pduid->ldp_id, padd,
- TRADDR, ht->ch.holdtime, 0);
+ TR_INET4_ADDR, TR_INET6_ADDR, ht->ch.holdtime, 0);
if (!peer)
return;
if (peer && peer->state == LDP_PEER_CONNECTED)
diff -r b1fb54fbb546 -r a19fef6032b8 usr.sbin/ldpd/ldp.h
--- a/usr.sbin/ldpd/ldp.h Mon Nov 12 18:00:34 2012 +0000
+++ b/usr.sbin/ldpd/ldp.h Mon Nov 12 18:39:00 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ldp.h,v 1.3 2011/06/16 14:48:30 kefren Exp $ */
+/* $NetBSD: ldp.h,v 1.4 2012/11/12 18:39:00 kefren Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -36,10 +36,11 @@
#include <netinet/in.h>
#define ALL_ROUTERS "224.0.0.2"
+#define ALL_ROUTERS6 "FF02::2"
#define LDP_PORT 646
#define LDP_COMMAND_PORT 2626
-#define LDPD_VER "0.3.0"
+#define LDPD_VER "0.4.0"
#define CONFFILE "/etc/ldpd.conf"
diff -r b1fb54fbb546 -r a19fef6032b8 usr.sbin/ldpd/ldp_peer.c
--- a/usr.sbin/ldpd/ldp_peer.c Mon Nov 12 18:00:34 2012 +0000
+++ b/usr.sbin/ldpd/ldp_peer.c Mon Nov 12 18:39:00 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ldp_peer.c,v 1.3 2010/12/30 11:29:21 kefren Exp $ */
+/* $NetBSD: ldp_peer.c,v 1.4 2012/11/12 18:39:00 kefren Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -68,7 +68,8 @@
*/
struct ldp_peer *
ldp_peer_new(struct in_addr * ldp_id, struct in_addr * a,
- struct in_addr * tradd, uint16_t holdtime, int soc)
+ struct in_addr * tradd, struct in6_addr * tradd6,
+ uint16_t holdtime, int soc)
{
struct ldp_peer *p;
int s = soc;
diff -r b1fb54fbb546 -r a19fef6032b8 usr.sbin/ldpd/ldp_peer.h
--- a/usr.sbin/ldpd/ldp_peer.h Mon Nov 12 18:00:34 2012 +0000
+++ b/usr.sbin/ldpd/ldp_peer.h Mon Nov 12 18:39:00 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ldp_peer.h,v 1.1 2010/12/08 07:20:14 kefren Exp $ */
+/* $NetBSD: ldp_peer.h,v 1.2 2012/11/12 18:39:00 kefren Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -86,7 +86,7 @@
void ldp_peer_init(void);
struct ldp_peer * ldp_peer_new(struct in_addr *, struct in_addr *,
- struct in_addr *, uint16_t, int);
+ struct in_addr *, struct in6_addr *, uint16_t, int);
void ldp_peer_holddown(struct ldp_peer *);
void ldp_peer_delete(struct ldp_peer *);
struct ldp_peer * get_ldp_peer(struct in_addr *);
diff -r b1fb54fbb546 -r a19fef6032b8 usr.sbin/ldpd/ldpd.8
--- a/usr.sbin/ldpd/ldpd.8 Mon Nov 12 18:00:34 2012 +0000
+++ b/usr.sbin/ldpd/ldpd.8 Mon Nov 12 18:39:00 2012 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: ldpd.8,v 1.5 2011/07/07 05:20:16 kefren Exp $
+.\" $NetBSD: ldpd.8,v 1.6 2012/11/12 18:39:00 kefren Exp $
.\"
.\" Copyright (c) 2010 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -38,35 +38,40 @@
.Sh DESCRIPTION
.Nm
is a utility used to automatically distribute labels between two MPLS LSRs
-almost conforming to RFC3036.
-Right now it is in BETA stage and many features
-are not implemented or may not work.
-As a security measure you SHOULD filter the LDP well-known (646)
+almost conforming to RFC5036.
+Right now some features requested by RFC5036 are not fully implemented.
+For more information please consult the
+.Sx BUGS
+section. As a security measure you SHOULD filter the LDP well-known (646)
TCP and UDP ports using your favourite packet filter before starting
.Nm .
-Also this is the current measure used to filter neighbours.
-You should see some logs reported via
+This is the current way used to filter neighbours and to protect the
+system of external attacks like route injections.
+.Pp
+.Nm
+logs information using the
.Xr syslog 3
interface.
-.Pp
You can increase the log verbosity using the
.Fl W
and
.Fl D
flags.
-Also you can telnet to the control port (default: 2626) and use
-this interface in order to get informations about protocol, neighbours
-etc. but also to set runtime parameters.
-The required password is the same as the root password.
+.Pp
+Administrators can use
+.Xr telnet 1
+to connect to the control port (default: 2626) and use
+this interface in order to get informations about protocol status,
+neighbours et cetera but also to set runtime parameters.
+The password required for connecting is the same as the root password.
.Pp
.Nm
computes existing routes and tries to match them on MPLS labels
announced by other LDP peers.
-This means that
-.Dq normal
+This means that usual IP
routes will be changed into tagged routes, and MPLS routing table
will be populated.
-It will also announce its mappings to its peers.
+Any change in MPLS topology will also be announced to LDP neighbors.
.Nm
will listen on a route socket and compute the necessary changes in
order to change untagged routes into tagged routes.
@@ -86,6 +91,8 @@
Enable debug mode.
.It Fl d
Don't use route interception code.
+.Nm
+will not make any changes to routing table if started with this option.
.It Fl f
Run in foreground.
Use STDOUT for warning and debug messages.
@@ -99,8 +106,8 @@
.Sh SEE ALSO
.Rs
.%R RFC
-.%N 3036
-.%D January 2001
+.%N 5036
+.%D October 2007
.%T LDP Specification
.Re
.Rs
diff -r b1fb54fbb546 -r a19fef6032b8 usr.sbin/ldpd/main.c
--- a/usr.sbin/ldpd/main.c Mon Nov 12 18:00:34 2012 +0000
+++ b/usr.sbin/ldpd/main.c Mon Nov 12 18:39:00 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.6 2011/07/02 18:17:12 kefren Exp $ */
+/* $NetBSD: main.c,v 1.7 2012/11/12 18:39:00 kefren Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -139,7 +139,7 @@
fatalp("Cannot create command socket\n");
return EXIT_FAILURE;
}
- if (create_hello_socket() < 1) {
+ if (create_hello_sockets() != 0) {
fatalp("Cannot create hello socket\n");
return EXIT_FAILURE;
}
diff -r b1fb54fbb546 -r a19fef6032b8 usr.sbin/ldpd/notifications.h
--- a/usr.sbin/ldpd/notifications.h Mon Nov 12 18:00:34 2012 +0000
+++ b/usr.sbin/ldpd/notifications.h Mon Nov 12 18:39:00 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: notifications.h,v 1.1 2010/12/08 07:20:15 kefren Exp $ */
+/* $NetBSD: notifications.h,v 1.2 2012/11/12 18:39:00 kefren Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#ifndef _NOTIFICATIONS_H_
#define _NOTIFICATIONS_H_
-/* Notifications codes RFC3036 2.9 */
+/* Notifications codes from RFC5036 3.9 - Status code summary */
#define NOTIF_SUCCESS 0x00000000
#define NOTIF_BAD_LDP_ID 0x00000001
#define NOTIF_BAD_LDP_VER 0x00000002
diff -r b1fb54fbb546 -r a19fef6032b8 usr.sbin/ldpd/socketops.c
--- a/usr.sbin/ldpd/socketops.c Mon Nov 12 18:00:34 2012 +0000
+++ b/usr.sbin/ldpd/socketops.c Mon Nov 12 18:39:00 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: socketops.c,v 1.11 2011/08/31 13:32:38 joerg Exp $ */
+/* $NetBSD: socketops.c,v 1.12 2012/11/12 18:39:00 kefren Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -60,12 +60,15 @@
#include "ldp_errors.h"
#include "socketops.h"
-int ls; /* TCP listening socket on port 646 */
Home |
Main Index |
Thread Index |
Old Index