struct listnode *node;
struct bgp_pbr_match_entry *bpme;
struct bgp_pbr_match *bpm;
- int unit = 0;
+ bool list_began = false;
struct list *list_bpm;
list_bpm = list_new();
if (listnode_lookup(list_bpm, bpm))
continue;
listnode_add(list_bpm, bpm);
- if (unit == 0)
+ if (!list_began) {
vty_out(vty, " (");
- else
+ list_began = true;
+ } else
vty_out(vty, ", ");
vty_out(vty, "%s", bpm->ipset_name);
- unit++;
}
- if (unit)
+ if (list_began)
vty_out(vty, ")");
vty_out(vty, "\n");
list_delete_and_null(&list_bpm);
? "!" : "",
bpf->dscp->val);
}
- zlog_info("BGP: %s FS PBR from %s to %s, %s %s",
+ zlog_debug("BGP: %s FS PBR from %s to %s, %s %s",
add ? "adding" : "removing",
bpf->src == NULL ? "<all>" :
prefix2str(bpf->src, bufsrc, sizeof(bufsrc)),
bgp_pbr_match_alloc_intern);
/* new, then self allocate ipset_name and unique */
- if (bpm && bpm->unique == 0) {
+ if (bpm->unique == 0) {
bpm->unique = ++bgp_pbr_match_counter_unique;
/* 0 value is forbidden */
sprintf(bpm->ipset_name, "match%p", bpm);
temp2.src_port_max = src_port ? src_port->max_port : 0;
temp2.dst_port_max = dst_port ? dst_port->max_port : 0;
temp2.proto = bpf->protocol;
- if (bpm)
- bpme = hash_get(bpm->entry_hash, &temp2,
- bgp_pbr_match_entry_alloc_intern);
- if (bpme && bpme->unique == 0) {
+ bpme = hash_get(bpm->entry_hash, &temp2,
+ bgp_pbr_match_entry_alloc_intern);
+ if (bpme->unique == 0) {
bpme->unique = ++bgp_pbr_match_entry_counter_unique;
/* 0 value is forbidden */
bpme->backpointer = bpm;
bpme_found = true;
/* already installed */
- if (bpme_found && bpme) {
+ if (bpme_found) {
struct bgp_info_extra *extra = bgp_info_extra_get(binfo);
if (extra && extra->bgp_fs_pbr &&
bgp_unlock(e->bgp_orig);
if ((*extra)->bgp_fs_pbr)
- list_delete_all_node((*extra)->bgp_fs_pbr);
- (*extra)->bgp_fs_pbr = NULL;
+ list_delete_and_null(&((*extra)->bgp_fs_pbr));
XFREE(MTYPE_BGP_ROUTE_EXTRA, *extra);
*extra = NULL;
}
static int bgp_show_route_leak_vty(struct vty *vty, const char *name,
- afi_t afi, safi_t safi)
+ afi_t afi, safi_t safi, uint8_t use_json)
{
struct bgp *bgp;
struct listnode *node;
char *ecom_str;
vpn_policy_direction_t dir;
- if (name) {
- bgp = bgp_lookup_by_name(name);
+ if (use_json) {
+ json_object *json = NULL;
+ json_object *json_import_vrfs = NULL;
+ json_object *json_export_vrfs = NULL;
+
+ json = json_object_new_object();
+
+ /* Provide context for the block */
+ json_object_string_add(json, "vrf", name ? name : "default");
+ json_object_string_add(json, "afiSafi",
+ afi_safi_print(afi, safi));
+
+ bgp = name ? bgp_lookup_by_name(name) : bgp_get_default();
+
if (!bgp) {
- vty_out(vty, "%% No such BGP instance exist\n");
+ json_object_boolean_true_add(json,
+ "bgpNoSuchInstance");
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(
+ json,
+ JSON_C_TO_STRING_PRETTY));
+ json_object_free(json);
+
return CMD_WARNING;
}
+
+ if (!CHECK_FLAG(bgp->af_flags[afi][safi],
+ BGP_CONFIG_VRF_TO_VRF_IMPORT)) {
+ json_object_string_add(json, "importFromVrfs", "none");
+ json_object_string_add(json, "importRts", "none");
+ } else {
+ json_import_vrfs = json_object_new_array();
+
+ for (ALL_LIST_ELEMENTS_RO(
+ bgp->vpn_policy[afi].import_vrf,
+ node, vname))
+ json_object_array_add(json_import_vrfs,
+ json_object_new_string(vname));
+
+ dir = BGP_VPN_POLICY_DIR_FROMVPN;
+ ecom_str = ecommunity_ecom2str(
+ bgp->vpn_policy[afi].rtlist[dir],
+ ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
+ json_object_object_add(json, "importFromVrfs",
+ json_import_vrfs);
+ json_object_string_add(json, "importRts", ecom_str);
+
+ XFREE(MTYPE_ECOMMUNITY_STR, ecom_str);
+ }
+
+ if (!CHECK_FLAG(bgp->af_flags[afi][safi],
+ BGP_CONFIG_VRF_TO_VRF_EXPORT)) {
+ json_object_string_add(json, "exportToVrfs", "none");
+ json_object_string_add(json, "routeDistinguisher",
+ "none");
+ json_object_string_add(json, "exportRts", "none");
+ } else {
+ json_export_vrfs = json_object_new_array();
+
+ for (ALL_LIST_ELEMENTS_RO(
+ bgp->vpn_policy[afi].export_vrf,
+ node, vname))
+ json_object_array_add(json_export_vrfs,
+ json_object_new_string(vname));
+ json_object_object_add(json, "exportToVrfs",
+ json_export_vrfs);
+ json_object_string_add(json, "routeDistinguisher",
+ prefix_rd2str(&bgp->vpn_policy[afi].tovpn_rd,
+ buf1, RD_ADDRSTRLEN));
+
+ dir = BGP_VPN_POLICY_DIR_TOVPN;
+ ecom_str = ecommunity_ecom2str(
+ bgp->vpn_policy[afi].rtlist[dir],
+ ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
+ json_object_string_add(json, "exportRts", ecom_str);
+
+ XFREE(MTYPE_ECOMMUNITY_STR, ecom_str);
+ }
+
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(json,
+ JSON_C_TO_STRING_PRETTY));
+ json_object_free(json);
+
} else {
- bgp = bgp_get_default();
+ bgp = name ? bgp_lookup_by_name(name) : bgp_get_default();
+
if (!bgp) {
- vty_out(vty,
- "%% Default BGP instance does not exist\n");
+ vty_out(vty, "%% No such BGP instance exist\n");
return CMD_WARNING;
}
- }
- if (!CHECK_FLAG(bgp->af_flags[afi][safi],
- BGP_CONFIG_VRF_TO_VRF_IMPORT)) {
- vty_out(vty,
- "This VRF is not importing %s routes from any other VRF\n",
- afi_safi_print(afi, safi));
- } else {
- vty_out(vty,
- "This VRF is importing %s routes from the following VRFs:\n",
- afi_safi_print(afi, safi));
- for (ALL_LIST_ELEMENTS_RO(bgp->vpn_policy[afi].import_vrf, node,
- vname)) {
- vty_out(vty, " %s\n", vname);
+ if (!CHECK_FLAG(bgp->af_flags[afi][safi],
+ BGP_CONFIG_VRF_TO_VRF_IMPORT))
+ vty_out(vty,
+ "This VRF is not importing %s routes from any other VRF\n",
+ afi_safi_print(afi, safi));
+ else {
+ vty_out(vty,
+ "This VRF is importing %s routes from the following VRFs:\n",
+ afi_safi_print(afi, safi));
+
+ for (ALL_LIST_ELEMENTS_RO(
+ bgp->vpn_policy[afi].import_vrf,
+ node, vname))
+ vty_out(vty, " %s\n", vname);
+
+ dir = BGP_VPN_POLICY_DIR_FROMVPN;
+ ecom_str = ecommunity_ecom2str(
+ bgp->vpn_policy[afi].rtlist[dir],
+ ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
+ vty_out(vty, "Import RT(s): %s\n", ecom_str);
+
+ XFREE(MTYPE_ECOMMUNITY_STR, ecom_str);
}
- dir = BGP_VPN_POLICY_DIR_FROMVPN;
- ecom_str = ecommunity_ecom2str(
- bgp->vpn_policy[afi].rtlist[dir],
- ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
- vty_out(vty, "Import RT(s): %s\n", ecom_str);
- XFREE(MTYPE_ECOMMUNITY_STR, ecom_str);
- }
- if (!CHECK_FLAG(bgp->af_flags[afi][safi],
- BGP_CONFIG_VRF_TO_VRF_EXPORT)) {
- vty_out(vty,
- "This VRF is not exporting %s routes to any other VRF\n",
+ if (!CHECK_FLAG(bgp->af_flags[afi][safi],
+ BGP_CONFIG_VRF_TO_VRF_EXPORT))
+ vty_out(vty,
+ "This VRF is not exporting %s routes to any other VRF\n",
afi_safi_print(afi, safi));
- } else {
- vty_out(vty,
- "This VRF is exporting %s routes to the following VRFs:\n",
+ else {
+ vty_out(vty,
+ "This VRF is exporting %s routes to the following VRFs:\n",
afi_safi_print(afi, safi));
- for (ALL_LIST_ELEMENTS_RO(bgp->vpn_policy[afi].export_vrf, node,
- vname)) {
- vty_out(vty, " %s\n", vname);
+
+ for (ALL_LIST_ELEMENTS_RO(
+ bgp->vpn_policy[afi].export_vrf,
+ node, vname))
+ vty_out(vty, " %s\n", vname);
+
+ vty_out(vty, "RD: %s\n",
+ prefix_rd2str(&bgp->vpn_policy[afi].tovpn_rd,
+ buf1, RD_ADDRSTRLEN));
+
+ dir = BGP_VPN_POLICY_DIR_TOVPN;
+ ecom_str = ecommunity_ecom2str(
+ bgp->vpn_policy[afi].rtlist[dir],
+ ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
+ vty_out(vty, "Export RT: %s\n", ecom_str);
+ XFREE(MTYPE_ECOMMUNITY_STR, ecom_str);
}
- vty_out(vty, "RD: %s\n",
- prefix_rd2str(&bgp->vpn_policy[afi].tovpn_rd,
- buf1, RD_ADDRSTRLEN));
- dir = BGP_VPN_POLICY_DIR_TOVPN;
- ecom_str = ecommunity_ecom2str(
- bgp->vpn_policy[afi].rtlist[dir],
- ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
- vty_out(vty, "Emport RT: %s\n", ecom_str);
- XFREE(MTYPE_ECOMMUNITY_STR, ecom_str);
}
return CMD_SUCCESS;
/* "show [ip] bgp route-leak" command. */
DEFUN (show_ip_bgp_route_leak,
- show_ip_bgp_route_leak_cmd,
- "show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] route-leak",
- SHOW_STR
- IP_STR
- BGP_STR
- BGP_INSTANCE_HELP_STR
- BGP_AFI_HELP_STR
- BGP_SAFI_HELP_STR
- "Route leaking information\n")
+ show_ip_bgp_route_leak_cmd,
+ "show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] route-leak [json]",
+ SHOW_STR
+ IP_STR
+ BGP_STR
+ BGP_INSTANCE_HELP_STR
+ BGP_AFI_HELP_STR
+ BGP_SAFI_HELP_STR
+ "Route leaking information\n"
+ JSON_STR)
{
char *vrf = NULL;
afi_t afi = AFI_MAX;
safi_t safi = SAFI_MAX;
+ uint8_t uj = use_json(argc, argv);
int idx = 0;
/* show [ip] bgp */
return CMD_WARNING;
}
- return bgp_show_route_leak_vty(vty, vrf, afi, safi);
+ return bgp_show_route_leak_vty(vty, vrf, afi, safi, uj);
}
static void bgp_show_all_instances_updgrps_vty(struct vty *vty, afi_t afi,
WANT_LDP ?= 1
WANT_PIM ?= 1
WANT_OSPFAPI ?= 1
-WANT_TCP_ZEBRA ?= 0
WANT_BGP_VNC ?= 1
WANT_CUMULUS_MODE ?= 0
WANT_MULTIPATH ?= 1
USE_OSPFAPI=--enable-ospfapi=no
endif
-ifeq ($(WANT_TCP_ZEBRA),1)
- USE_TCP_ZEBRA=--enable-tcp-zebra
-else
- USE_TCP_ZEBRA=--disable-tcp-zebra
-endif
-
ifeq ($(WANT_BGP_VNC), 1)
USE_BGP_VNC=--enable-bgp-vnc=yes
else
$(USE_OSPFAPI) \
$(USE_MULTIPATH) \
$(USE_LDP) \
- $(USE_TCP_ZEBRA) \
--enable-fpm \
$(USE_FRR_USER) $(USE_FRR_GROUP) \
$(USE_FRR_VTY_GROUP) \
WANT_LDP ?= 1
WANT_PIM ?= 1
WANT_OSPFAPI ?= 1
-WANT_TCP_ZEBRA ?= 0
WANT_BGP_VNC ?= 1
WANT_CUMULUS_MODE ?= 0
WANT_MULTIPATH ?= 1
USE_OSPFAPI=--enable-ospfapi=no
endif
-ifeq ($(WANT_TCP_ZEBRA),1)
- USE_TCP_ZEBRA=--enable-tcp-zebra
-else
- USE_TCP_ZEBRA=--disable-tcp-zebra
-endif
-
ifeq ($(WANT_BGP_VNC), 1)
USE_BGP_VNC=--enable-bgp-vnc=yes
else
$(USE_OSPFAPI) \
$(USE_MULTIPATH) \
$(USE_LDP) \
- $(USE_TCP_ZEBRA) \
--enable-fpm \
$(USE_FRR_USER) $(USE_FRR_GROUP) \
$(USE_FRR_VTY_GROUP) \
WANT_LDP ?= 1
WANT_PIM ?= 1
WANT_OSPFAPI ?= 1
-WANT_TCP_ZEBRA ?= 0
WANT_BGP_VNC ?= 1
WANT_CUMULUS_MODE ?= 0
WANT_MULTIPATH ?= 1
USE_OSPFAPI=--enable-ospfapi=no
endif
-ifeq ($(WANT_TCP_ZEBRA),1)
- USE_TCP_ZEBRA=--enable-tcp-zebra
-else
- USE_TCP_ZEBRA=--disable-tcp-zebra
-endif
-
ifeq ($(WANT_BGP_VNC), 1)
USE_BGP_VNC=--enable-bgp-vnc=yes
else
$(USE_OSPFAPI) \
$(USE_MULTIPATH) \
$(USE_LDP) \
- $(USE_TCP_ZEBRA) \
--enable-fpm \
$(USE_FRR_USER) $(USE_FRR_GROUP) \
$(USE_FRR_VTY_GROUP) \
staticd 2616
bfdd 2617
- Port 2607 is used for ospfd's Opaque LSA API, while port 2600 is used for the (insecure) TCP-ZEBRA interface.
+ Port 2607 is used for ospfd's Opaque LSA API.
.. option:: --vty_socket vty-path
.. toctree::
:maxdepth: 2
+ bfdd
bgpd
eigrpd
isisd
.. _bfd-ospf-peer-config:
OSPF BFD Configuration
----------------------
+----------------------
The following commands are available inside the interface configuration node.
Echo transmission interval: 50ms
frr# show bfd peer 192.168.0.1 json
-{"multihop":false,"peer":"192.168.0.1","id":1,"remote-id":1,"status":"up","uptime":161,"diagnostic":"ok","remote-diagnostic":"ok","receive-interval":300,"transmit-interval":300,"echo-interval":50,"remote-receive-interval":300,"remote-transmit-interval":300,"remote-echo-interval":50}
+ {"multihop":false,"peer":"192.168.0.1","id":1,"remote-id":1,"status":"up","uptime":161,"diagnostic":"ok","remote-diagnostic":"ok","receive-interval":300,"transmit-interval":300,"echo-interval":50,"remote-receive-interval":300,"remote-transmit-interval":300,"remote-echo-interval":50}
You can also inspect peer session counters with the following commands:
Zebra notifications: 4
frr# show bfd peer 192.168.0.1 counters json
-{"multihop":false,"peer":"192.168.0.1","control-packet-input":348,"control-packet-output":685,"echo-packet-input":6815,"echo-packet-output":6816,"session-up":1,"session-down":0,"zebra-notifications":4}
+ {"multihop":false,"peer":"192.168.0.1","control-packet-input":348,"control-packet-output":685,"echo-packet-input":6815,"echo-packet-output":6816,"session-up":1,"session-down":0,"zebra-notifications":4}
char ubuf[256];
snprintf(pbuf, sizeof(pbuf), "\nError %"PRIu32" - %s",
- code, ref->title);
+ ref->code, ref->title);
memset(ubuf, '=', strlen(pbuf));
ubuf[sizeof(ubuf) - 1] = '\0';
save_errno = errno;
umask(oldumask);
if (zl->fp == NULL) {
+
+ pthread_mutex_unlock(&loglock);
+
flog_err_sys(
LIB_ERR_SYSTEM_CALL,
"Log rotate failed: cannot open file %s for append: %s",
zl->filename, safe_strerror(save_errno));
ret = -1;
+
+ pthread_mutex_lock(&loglock);
} else {
logfile_fd = fileno(zl->fp);
zl->maxlvl[ZLOG_DEST_FILE] = level;
zlog_debug(
"Requesting the same, remove it, next neighbor");
if (req == on->last_ls_req) {
+ /* sanity check refcount */
+ assert(req->lock >= 2);
ospf6_lsa_unlock(req);
on->last_ls_req = NULL;
}
#include "ospfd/ospf_lsdb.h"
#include "ospfd/ospf_neighbor.h"
#include "ospfd/ospf_dump.h"
+#include "ospfd/ospf_route.h"
#include "ospfd/ospf_zebra.h"
#include "ospfd/ospf_api.h"
newlsa->length = htons(length);
/* Create OSPF LSA. */
- if ((new = ospf_lsa_new()) == NULL) {
- zlog_warn("ospf_apiserver_opaque_lsa_new: ospf_lsa_new() ?");
- stream_free(s);
- return NULL;
- }
-
- if ((new->data = ospf_lsa_data_new(length)) == NULL) {
- zlog_warn(
- "ospf_apiserver_opaque_lsa_new: ospf_lsa_data_new() ?");
- ospf_lsa_unlock(&new);
- stream_free(s);
- return NULL;
- }
+ new = ospf_lsa_new_and_data(length);
new->area = area;
new->oi = oi;
p->prefixlen);
}
-/* Lookup external route. */
-struct ospf_route *ospf_external_route_lookup(struct ospf *ospf,
- struct prefix_ipv4 *p)
-{
- struct route_node *rn;
-
- rn = route_node_lookup(ospf->old_external_route, (struct prefix *)p);
- if (rn) {
- route_unlock_node(rn);
- if (rn->info)
- return rn->info;
- }
-
- zlog_warn("Route[%s/%d]: lookup, no such prefix", inet_ntoa(p->prefix),
- p->prefixlen);
-
- return NULL;
-}
-
-
/* Add an External info for AS-external-LSA. */
struct external_info *ospf_external_info_new(uint8_t type,
unsigned short instance)
extern struct external_info *ospf_external_info_lookup(struct ospf *, uint8_t,
unsigned short,
struct prefix_ipv4 *);
-extern struct ospf_route *ospf_external_route_lookup(struct ospf *,
- struct prefix_ipv4 *);
extern void ospf_asbr_status_update(struct ospf *, uint8_t);
extern void ospf_redistribute_withdraw(struct ospf *, uint8_t, unsigned short);
lsah->length = htons(length);
/* Now, create an OSPF LSA instance. */
- new = ospf_lsa_new();
- if (new == NULL) {
- zlog_warn("EXT (%s): ospf_lsa_new() error", __func__);
- stream_free(s);
- return NULL;
- }
- new->data = ospf_lsa_data_new(length);
- if (new->data == NULL) {
- zlog_warn("EXT (%s): ospf_lsa_data_new() error", __func__);
- ospf_lsa_unlock(&new);
- new = NULL;
- stream_free(s);
- return NULL;
- }
+ new = ospf_lsa_new_and_data(length);
/* Segment Routing belongs only to default VRF */
new->vrf_id = VRF_DEFAULT;
lsah->length = htons(length);
/* Now, create an OSPF LSA instance. */
- new = ospf_lsa_new();
- if (new == NULL) {
- zlog_warn("EXT (%s): ospf_lsa_new() error", __func__);
- stream_free(s);
- return NULL;
- }
- new->data = ospf_lsa_data_new(length);
- if (new->data == NULL) {
- zlog_warn("EXT (%s): ospf_lsa_data_new() error", __func__);
- ospf_lsa_unlock(&new);
- new = NULL;
- stream_free(s);
- return NULL;
- }
+ new = ospf_lsa_new_and_data(length);
/* Segment Routing belongs only to default VRF */
new->vrf_id = VRF_DEFAULT;
{
struct ospf_lsa *new;
- new = ospf_lsa_new();
- new->data = ospf_lsa_data_new(OSPF_LSA_HEADER_SIZE);
+ new = ospf_lsa_new_and_data(OSPF_LSA_HEADER_SIZE);
memcpy(new->data, lsah, OSPF_LSA_HEADER_SIZE);
return new;
return new;
}
+struct ospf_lsa *ospf_lsa_new_and_data(size_t size)
+{
+ struct ospf_lsa *new;
+
+ new = ospf_lsa_new();
+ new->data = ospf_lsa_data_new(size);
+
+ return new;
+}
+
/* Duplicate OSPF LSA. */
struct ospf_lsa *ospf_lsa_dup(struct ospf_lsa *lsa)
{
lsah->length = htons(length);
/* Now, create OSPF LSA instance. */
- if ((new = ospf_lsa_new()) == NULL) {
- zlog_err("%s: Unable to create new lsa", __func__);
- return NULL;
- }
+ new = ospf_lsa_new_and_data(length);
new->area = area;
SET_FLAG(new->flags, OSPF_LSA_SELF | OSPF_LSA_SELF_CHECKED);
new->vrf_id = area->ospf->vrf_id;
/* Copy LSA data to store, discard stream. */
- new->data = ospf_lsa_data_new(length);
memcpy(new->data, lsah, length);
stream_free(s);
lsah->length = htons(length);
/* Create OSPF LSA instance. */
- if ((new = ospf_lsa_new()) == NULL) {
- zlog_err("%s: ospf_lsa_new returned NULL", __func__);
- return NULL;
- }
+ new = ospf_lsa_new_and_data(length);
new->area = oi->area;
SET_FLAG(new->flags, OSPF_LSA_SELF | OSPF_LSA_SELF_CHECKED);
new->vrf_id = oi->ospf->vrf_id;
/* Copy LSA to store. */
- new->data = ospf_lsa_data_new(length);
memcpy(new->data, lsah, length);
stream_free(s);
lsah->length = htons(length);
/* Create OSPF LSA instance. */
- new = ospf_lsa_new();
+ new = ospf_lsa_new_and_data(length);
new->area = area;
SET_FLAG(new->flags, OSPF_LSA_SELF | OSPF_LSA_SELF_CHECKED);
new->vrf_id = area->ospf->vrf_id;
/* Copy LSA to store. */
- new->data = ospf_lsa_data_new(length);
memcpy(new->data, lsah, length);
stream_free(s);
lsah->length = htons(length);
/* Create OSPF LSA instance. */
- new = ospf_lsa_new();
+ new = ospf_lsa_new_and_data(length);
new->area = area;
SET_FLAG(new->flags, OSPF_LSA_SELF | OSPF_LSA_SELF_CHECKED);
new->vrf_id = area->ospf->vrf_id;
/* Copy LSA to store. */
- new->data = ospf_lsa_data_new(length);
memcpy(new->data, lsah, length);
stream_free(s);
lsah->length = htons(length);
/* Now, create OSPF LSA instance. */
- new = ospf_lsa_new();
+ new = ospf_lsa_new_and_data(length);
new->area = NULL;
SET_FLAG(new->flags,
OSPF_LSA_SELF | OSPF_LSA_APPROVED | OSPF_LSA_SELF_CHECKED);
new->vrf_id = ospf->vrf_id;
/* Copy LSA data to store, discard stream. */
- new->data = ospf_lsa_data_new(length);
memcpy(new->data, lsah, length);
stream_free(s);
/* Prototype for LSA primitive. */
extern struct ospf_lsa *ospf_lsa_new(void);
+extern struct ospf_lsa *ospf_lsa_new_and_data(size_t size);
extern struct ospf_lsa *ospf_lsa_dup(struct ospf_lsa *);
extern void ospf_lsa_free(struct ospf_lsa *);
extern struct ospf_lsa *ospf_lsa_lock(struct ospf_lsa *);
#include "ospfd/ospf_lsdb.h"
#include "ospfd/ospf_neighbor.h"
#include "ospfd/ospf_dump.h"
+#include "ospfd/ospf_route.h"
#include "ospfd/ospf_zebra.h"
#include "ospfd/ospf_vty.h"
#include "ospfd/ospf_bfd.h"
}
/* Create OSPF LSA instance. */
- lsa = ospf_lsa_new();
+ lsa = ospf_lsa_new_and_data(length);
lsa->vrf_id = oi->ospf->vrf_id;
/* We may wish to put some error checking if type NSSA comes in
break;
}
- lsa->data = ospf_lsa_data_new(length);
memcpy(lsa->data, lsah, length);
if (IS_DEBUG_OSPF_EVENT)
lsah->length = htons(length);
/* Now, create an OSPF LSA instance. */
- if ((new = ospf_lsa_new()) == NULL) {
- zlog_warn("ospf_router_info_lsa_new: ospf_lsa_new() ?");
- stream_free(s);
- return NULL;
- }
- if ((new->data = ospf_lsa_data_new(length)) == NULL) {
- zlog_warn("ospf_router_info_lsa_new: ospf_lsa_data_new() ?");
- ospf_lsa_unlock(&new);
- new = NULL;
- stream_free(s);
- return new;
- }
+ new = ospf_lsa_new_and_data(length);
new->area = OspfRI.area; /* Area must be null if the Opaque type is AS
scope, fulfill otherwise */
#include "ospfd/ospf_flood.h"
#include "ospfd/ospf_ism.h"
#include "ospfd/ospf_dump.h"
+#include "ospfd/ospf_route.h"
#include "ospfd/ospf_zebra.h"
/* OSPF2-MIB. */
lsah->length = htons(length);
/* Now, create an OSPF LSA instance. */
- if ((new = ospf_lsa_new()) == NULL) {
- zlog_warn("%s: ospf_lsa_new() ?", __func__);
- stream_free(s);
- return NULL;
- }
- if ((new->data = ospf_lsa_data_new(length)) == NULL) {
- zlog_warn("%s: ospf_lsa_data_new() ?", __func__);
- ospf_lsa_unlock(&new);
- new = NULL;
- stream_free(s);
- return new;
- }
+ new = ospf_lsa_new_and_data(length);
new->vrf_id = ospf->vrf_id;
if (area && area->ospf)
#include "ospfd/ospf_spf.h"
#include "ospfd/ospf_packet.h"
#include "ospfd/ospf_dump.h"
+#include "ospfd/ospf_route.h"
#include "ospfd/ospf_zebra.h"
#include "ospfd/ospf_abr.h"
#include "ospfd/ospf_flood.h"
-#include "ospfd/ospf_route.h"
#include "ospfd/ospf_ase.h"