-/* $OpenBSD: kroute.c,v 1.250 2022/06/07 16:12:00 claudio Exp $ */
+/* $OpenBSD: kroute.c,v 1.251 2022/06/07 16:42:07 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
kr->r.labelid = labelid;
if (kroute_insert(kt, kr) == -1) {
+ rtlabel_unref(kr->r.labelid);
free(kr);
return (-1);
}
kr6->r.labelid = labelid;
if (kroute6_insert(kt, kr6) == -1) {
+ rtlabel_unref(kr6->r.labelid);
free(kr6);
return (-1);
}
kr->r.ifindex = kl->ifindex;
if (kroute_insert(kt, kr) == -1) {
+ rtlabel_unref(kr->r.labelid);
free(kr);
return (-1);
}
kr6->r.ifindex = kl->ifindex;
if (kroute6_insert(kt, kr6) == -1) {
+ rtlabel_unref(kr6->r.labelid);
free(kr6);
return (-1);
}
if ((kr->r.flags & F_BGPD_INSERTED)) {
if (kt->fib_sync) /* coupled */
send_rtmsg(kr_state.fd, RTM_DELETE, kt, &kr->r);
- rtlabel_unref(kr->r.labelid);
-
if (kroute_remove(kt, kr) == -1)
return (-1);
}
if (kt->fib_sync) /* coupled */
send_rt6msg(kr_state.fd, RTM_DELETE, kt,
&kr6->r);
- rtlabel_unref(kr6->r.labelid);
-
if (kroute6_remove(kt, kr6) == -1)
return (-1);
}
if (send_rtmsg(kr_state.fd, RTM_DELETE, kt, &kr->r) == -1)
return (-1);
- rtlabel_unref(kr->r.labelid);
-
if (kroute_remove(kt, kr) == -1)
return (-1);
if (send_rt6msg(kr_state.fd, RTM_DELETE, kt, &kr6->r) == -1)
return (-1);
- rtlabel_unref(kr6->r.labelid);
-
if (kroute6_remove(kt, kr6) == -1)
return (-1);
if (send_rtmsg(kr_state.fd, RTM_DELETE, kt, &kr->r) == -1)
return (-1);
- rtlabel_unref(kr->r.labelid);
-
if (kroute_remove(kt, kr) == -1)
return (-1);
if (send_rt6msg(kr_state.fd, RTM_DELETE, kt, &kr6->r) == -1)
return (-1);
- rtlabel_unref(kr6->r.labelid);
-
if (kroute6_remove(kt, kr6) == -1)
return (-1);
if (kr->r.flags & F_CONNECTED)
if (kif_kr_remove(kr) == -1) {
+ rtlabel_unref(kr->r.labelid);
free(kr);
return (-1);
}
+ rtlabel_unref(kr->r.labelid);
+
free(kr);
return (0);
}
if (kr->r.flags & F_CONNECTED)
if (kif_kr6_remove(kr) == -1) {
+ rtlabel_unref(kr->r.labelid);
free(kr);
return (-1);
}
+ rtlabel_unref(kr->r.labelid);
+
free(kr);
return (0);
}
else
kr->r.prefixlen =
prefixlen_classful(kr->r.prefix.s_addr);
- rtlabel_unref(kr->r.labelid);
- kr->r.labelid = 0;
if ((label = (struct sockaddr_rtlabel *)
rti_info[RTAX_LABEL]) != NULL) {
kr->r.labelid =
kr6->r.prefixlen = 128;
else
fatalx("INET6 route without netmask");
- rtlabel_unref(kr6->r.labelid);
- kr6->r.labelid = 0;
if ((label = (struct sockaddr_rtlabel *)
rti_info[RTAX_LABEL]) != NULL) {
kr6->r.labelid =
if (sa->sa_family == AF_INET) {
if (rtm->rtm_priority == kr_state.fib_prio) {
send_rtmsg(kr_state.fd, RTM_DELETE, kt, &kr->r);
+ rtlabel_unref(kr->r.labelid);
free(kr);
} else
kroute_insert(kt, kr);
if (rtm->rtm_priority == kr_state.fib_prio) {
send_rt6msg(kr_state.fd, RTM_DELETE, kt,
&kr6->r);
+ rtlabel_unref(kr6->r.labelid);
free(kr6);
} else
kroute6_insert(kt, kr6);
rtlabel_name2id(label->sr_label);
if (kr6->r.labelid != new_labelid) {
rtlabel_unref(kr6->r.labelid);
- kr6->r.labelid = 0;
kr6->r.labelid = new_labelid;
rtlabel_changed = 1;
}