[cmaster-next] [PATCH 01/10] ldpd: fix segfault when configuring multiple pseudowires

Renato Westphal renato at opensourcerouting.org
Thu Dec 15 09:55:45 EST 2016


Signed-off-by: Renato Westphal <renato at opensourcerouting.org>
---
 ldpd/ldp_vty_conf.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/ldpd/ldp_vty_conf.c b/ldpd/ldp_vty_conf.c
index f2b21d8..dd70365 100644
--- a/ldpd/ldp_vty_conf.c
+++ b/ldpd/ldp_vty_conf.c
@@ -1250,7 +1250,7 @@ ldp_vty_l2vpn(struct vty *vty, struct vty_arg *args[])
 	l2vpn->type = L2VPN_TYPE_VPLS;
 	LIST_INSERT_HEAD(&vty_conf->l2vpn_list, l2vpn, entry);
 
-	ldp_reload(vty_conf);
+	ldp_reload_ref(vty_conf, (void **)&l2vpn);
 	VTY_PUSH_CONTEXT(LDP_L2VPN_NODE, l2vpn);
 
 	return (CMD_SUCCESS);
@@ -1432,7 +1432,7 @@ ldp_vty_l2vpn_pseudowire(struct vty *vty, struct vty_arg *args[])
 	}
 
 	if (pw) {
-		VTY_PUSH_CONTEXT(LDP_PSEUDOWIRE_NODE, pw);
+		VTY_PUSH_CONTEXT_SUB(LDP_PSEUDOWIRE_NODE, pw);
 		goto cancel;
 	}
 
@@ -1454,7 +1454,7 @@ ldp_vty_l2vpn_pseudowire(struct vty *vty, struct vty_arg *args[])
 	LIST_INSERT_HEAD(&l2vpn->pw_inactive_list, pw, entry);
 
 	ldp_reload_ref(vty_conf, (void **)&pw);
-	VTY_PUSH_CONTEXT(LDP_PSEUDOWIRE_NODE, pw);
+	VTY_PUSH_CONTEXT_SUB(LDP_PSEUDOWIRE_NODE, pw);
 
 	return (CMD_SUCCESS);
 
@@ -1474,7 +1474,7 @@ ldp_vty_l2vpn_pw_cword(struct vty *vty, struct vty_arg *args[])
 	disable = (vty_get_arg_value(args, "no")) ? 1 : 0;
 	preference_str = vty_get_arg_value(args, "preference");
 
-	pw = VTY_GET_CONTEXT(l2vpn_pw);
+	pw = VTY_GET_CONTEXT_SUB(l2vpn_pw);
 	vty_conf = ldp_dup_config_ref(ldpd_conf, (void **)&pw);
 
 	if (disable)
@@ -1510,7 +1510,7 @@ ldp_vty_l2vpn_pw_nbr_addr(struct vty *vty, struct vty_arg *args[])
 		return (CMD_WARNING);
 	}
 
-	pw = VTY_GET_CONTEXT(l2vpn_pw);
+	pw = VTY_GET_CONTEXT_SUB(l2vpn_pw);
 	vty_conf = ldp_dup_config_ref(ldpd_conf, (void **)&pw);
 
 	if (disable) {
@@ -1546,7 +1546,7 @@ ldp_vty_l2vpn_pw_nbr_id(struct vty *vty, struct vty_arg *args[])
 		return (CMD_WARNING);
 	}
 
-	pw = VTY_GET_CONTEXT(l2vpn_pw);
+	pw = VTY_GET_CONTEXT_SUB(l2vpn_pw);
 	vty_conf = ldp_dup_config_ref(ldpd_conf, (void **)&pw);
 
 	if (disable)
@@ -1578,7 +1578,7 @@ ldp_vty_l2vpn_pw_pwid(struct vty *vty, struct vty_arg *args[])
 		return (CMD_WARNING);
 	}
 
-	pw = VTY_GET_CONTEXT(l2vpn_pw);
+	pw = VTY_GET_CONTEXT_SUB(l2vpn_pw);
 	vty_conf = ldp_dup_config_ref(ldpd_conf, (void **)&pw);
 
 	if (disable)
@@ -1600,7 +1600,7 @@ ldp_vty_l2vpn_pw_pwstatus(struct vty *vty, struct vty_arg *args[])
 
 	disable = (vty_get_arg_value(args, "no")) ? 1 : 0;
 
-	pw = VTY_GET_CONTEXT(l2vpn_pw);
+	pw = VTY_GET_CONTEXT_SUB(l2vpn_pw);
 	vty_conf = ldp_dup_config_ref(ldpd_conf, (void **)&pw);
 
 	if (disable)
-- 
1.9.1





More information about the dev mailing list