From 9b77d13163cce652826e4446edc864a88be2e9e1 Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Mon, 23 May 2016 16:18:52 +0000 Subject: Make neighbor parameters per lsr-id not per transport-address. With the advent of IPv6 support, a single neighbor can have two different transport-addresses: one for ipv4 and one for ipv6. In order to define neighbor-specific parameters in an indistinguishable way, define them by lsr-id. This way we can switch between LDPov4 and LDPov6 and keep the same configuration. --- usr.sbin/ldpd/neighbor.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'usr.sbin/ldpd/neighbor.c') diff --git a/usr.sbin/ldpd/neighbor.c b/usr.sbin/ldpd/neighbor.c index 8b3f1824581..5e8bba48f91 100644 --- a/usr.sbin/ldpd/neighbor.c +++ b/usr.sbin/ldpd/neighbor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: neighbor.c,v 1.60 2016/05/23 16:16:44 renato Exp $ */ +/* $OpenBSD: neighbor.c,v 1.61 2016/05/23 16:18:51 renato Exp $ */ /* * Copyright (c) 2009 Michele Marchetto @@ -256,7 +256,7 @@ nbr_new(struct in_addr id, struct in_addr addr) /* init pfkey - remove old if any, load new ones */ pfkey_remove(nbr); - nbrp = nbr_params_find(leconf, nbr->raddr); + nbrp = nbr_params_find(leconf, nbr->id); if (nbrp && pfkey_establish(nbr, nbrp) == -1) fatalx("pfkey setup failed"); @@ -508,7 +508,7 @@ nbr_establish_connection(struct nbr *nbr) return (-1); } - nbrp = nbr_params_find(leconf, nbr->raddr); + nbrp = nbr_params_find(leconf, nbr->id); if (nbrp && nbrp->auth.method == AUTH_MD5SIG) { if (sysdep.no_pfkey || sysdep.no_md5sig) { log_warnx("md5sig configured but not available"); @@ -587,37 +587,37 @@ nbr_send_labelmappings(struct nbr *nbr) } struct nbr_params * -nbr_params_new(struct in_addr addr) +nbr_params_new(struct in_addr lsr_id) { struct nbr_params *nbrp; if ((nbrp = calloc(1, sizeof(*nbrp))) == NULL) fatal(__func__); - nbrp->addr.s_addr = addr.s_addr; + nbrp->lsr_id = lsr_id; nbrp->auth.method = AUTH_NONE; return (nbrp); } struct nbr_params * -nbr_params_find(struct ldpd_conf *xconf, struct in_addr addr) +nbr_params_find(struct ldpd_conf *xconf, struct in_addr lsr_id) { struct nbr_params *nbrp; LIST_FOREACH(nbrp, &xconf->nbrp_list, entry) - if (nbrp->addr.s_addr == addr.s_addr) + if (nbrp->lsr_id.s_addr == lsr_id.s_addr) return (nbrp); return (NULL); } uint16_t -nbr_get_keepalive(struct in_addr addr) +nbr_get_keepalive(struct in_addr lsr_id) { struct nbr_params *nbrp; - nbrp = nbr_params_find(leconf, addr); + nbrp = nbr_params_find(leconf, lsr_id); if (nbrp && (nbrp->flags & F_NBRP_KEEPALIVE)) return (nbrp->keepalive); -- cgit v1.2.3