"%s: error BGP attribute length %lu is smaller than min len",
peer->host,
(unsigned long)(endp
- - STREAM_PNT(BGP_INPUT(peer))));
+ - stream_pnt(BGP_INPUT(peer))));
bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_ATTR_LENG_ERR);
"%s: Extended length set, but just %lu bytes of attr header",
peer->host,
(unsigned long)(endp
- - STREAM_PNT(BGP_INPUT(peer))));
+ - stream_pnt(BGP_INPUT(peer))));
bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_ATTR_LENG_ERR);
addpath_tx_id = adj->addpath_tx_id;
space_remaining =
- STREAM_REMAIN(s) - BGP_MAX_PACKET_SIZE_OVERFLOW;
+ STREAM_WRITEABLE(s) - BGP_MAX_PACKET_SIZE_OVERFLOW;
space_needed =
BGP_NLRI_LENGTH + addpath_overhead + BGP_TOTAL_ATTR_LEN
+ bgp_packet_mpattr_prefix_size(afi, safi, &rn->p);
/* Macros. */
#define BGP_INPUT(P) ((P)->curr)
-#define BGP_INPUT_PNT(P) (STREAM_PNT(BGP_INPUT(P)))
+#define BGP_INPUT_PNT(P) (stream_pnt(BGP_INPUT(P)))
#define BGP_IS_VALID_STATE_FOR_NOTIF(S) \
(((S) == OpenSent) || ((S) == OpenConfirm) || ((S) == Established))
iov[0].iov_base = (char *)&iph;
iov[0].iov_len = iph.ip_hl << EIGRP_WRITE_IPHL_SHIFT;
- iov[1].iov_base = STREAM_PNT(ep->s);
+ iov[1].iov_base = stream_pnt(ep->s);
iov[1].iov_len = ep->length;
/* send final fragment (could be first) */
by eigrp_recv_packet() to be correct). */
stream_forward_getp(ibuf, (iph->ip_hl * 4));
- eigrph = (struct eigrp_header *)STREAM_PNT(ibuf);
+ eigrph = (struct eigrp_header *)stream_pnt(ibuf);
if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV)
&& IS_DEBUG_EIGRP_TRANSMIT(0, PACKET_DETAIL))
#define STREAM_CONCAT_REMAIN(S1, S2, size) ((size) - (S1)->endp - (S2)->endp)
/* deprecated macros - do not use in new code */
+#if CONFDATE > 20181128
+CPP_NOTICE("lib: time to remove deprecated stream.h macros")
+#endif
#define STREAM_PNT(S) stream_pnt((S))
-#define STREAM_DATA(S) ((S)->data)
#define STREAM_REMAIN(S) STREAM_WRITEABLE((S))
+/* this macro is deprecated, but not slated for removal anytime soon */
+#define STREAM_DATA(S) ((S)->data)
+
/* Stream prototypes.
* For stream_{put,get}S, the S suffix mean:
*
struct ospf_hello *hello;
int i;
- hello = (struct ospf_hello *)STREAM_PNT(s);
+ hello = (struct ospf_hello *)stream_pnt(s);
zlog_debug("Hello");
zlog_debug(" NetworkMask %s", inet_ntoa(hello->network_mask));
struct router_lsa *rl;
int i, len;
- rl = (struct router_lsa *)STREAM_PNT(s);
+ rl = (struct router_lsa *)stream_pnt(s);
zlog_debug(" Router-LSA");
zlog_debug(" flags %s",
struct network_lsa *nl;
int i, cnt;
- nl = (struct network_lsa *)STREAM_PNT(s);
+ nl = (struct network_lsa *)stream_pnt(s);
cnt = (ntohs(nl->header.length) - (OSPF_LSA_HEADER_SIZE + 4)) / 4;
zlog_debug(" Network-LSA");
int size;
int i;
- sl = (struct summary_lsa *)STREAM_PNT(s);
+ sl = (struct summary_lsa *)stream_pnt(s);
zlog_debug(" Summary-LSA");
zlog_debug(" Network Mask %s", inet_ntoa(sl->mask));
int size;
int i;
- al = (struct as_external_lsa *)STREAM_PNT(s);
+ al = (struct as_external_lsa *)stream_pnt(s);
zlog_debug(" %s", ospf_lsa_type_msg[al->header.type].str);
zlog_debug(" Network Mask %s", inet_ntoa(al->mask));
/* LSA Headers. */
while (length > 0) {
- lsa = (struct lsa_header *)STREAM_PNT(s);
+ lsa = (struct lsa_header *)stream_pnt(s);
ospf_lsa_header_dump(lsa);
stream_forward_getp(s, OSPF_LSA_HEADER_SIZE);
u_int32_t gp;
gp = stream_get_getp(s);
- dd = (struct ospf_db_desc *)STREAM_PNT(s);
+ dd = (struct ospf_db_desc *)stream_pnt(s);
zlog_debug("Database Description");
zlog_debug(" Interface MTU %d", ntohs(dd->mtu));
break;
}
- lsa = (struct lsa_header *)STREAM_PNT(s);
+ lsa = (struct lsa_header *)stream_pnt(s);
lsa_len = ntohs(lsa->length);
ospf_lsa_header_dump(lsa);
gp = stream_get_getp(s);
/* OSPF Header dump. */
- ospfh = (struct ospf_header *)STREAM_PNT(s);
+ ospfh = (struct ospf_header *)stream_pnt(s);
/* Until detail flag is set, return. */
if (!(term_debug_ospf_packet[ospfh->type - 1] & OSPF_DEBUG_DETAIL))
if (ret == OSPF_MAX_LSA_SIZE) {
zlog_warn(
"%s: Out of space in LSA stream, left %zd, size %zd",
- __func__, STREAM_REMAIN(s), STREAM_SIZE(s));
+ __func__, STREAM_WRITEABLE(s), STREAM_SIZE(s));
return 0;
}
}
{
struct ospf_lsa lsa;
- lsa.data = (struct lsa_header *)STREAM_PNT(s);
+ lsa.data = (struct lsa_header *)stream_pnt(s);
show_opaque_info_detail(NULL, &lsa);
return;
}
iph->ip_off += offset;
stream_forward_getp(op->s, iovp->iov_len);
- iovp->iov_base = STREAM_PNT(op->s);
+ iovp->iov_base = stream_pnt(op->s);
}
/* setup for final fragment */
iov[0].iov_base = (char *)&iph;
iov[0].iov_len = iph.ip_hl << OSPF_WRITE_IPHL_SHIFT;
- iov[1].iov_base = STREAM_PNT(op->s);
+ iov[1].iov_base = stream_pnt(op->s);
iov[1].iov_len = op->length;
#ifdef GNU_LINUX
/* increment statistics. */
oi->hello_in++;
- hello = (struct ospf_hello *)STREAM_PNT(s);
+ hello = (struct ospf_hello *)stream_pnt(s);
/* If Hello is myself, silently discard. */
if (IPV4_ADDR_SAME(&ospfh->router_id, &oi->ospf->router_id)) {
stream_forward_getp(s, OSPF_DB_DESC_MIN_SIZE);
for (size -= OSPF_DB_DESC_MIN_SIZE; size >= OSPF_LSA_HEADER_SIZE;
size -= OSPF_LSA_HEADER_SIZE) {
- lsah = (struct lsa_header *)STREAM_PNT(s);
+ lsah = (struct lsa_header *)stream_pnt(s);
stream_forward_getp(s, OSPF_LSA_HEADER_SIZE);
/* Unknown LS type. */
/* Increment statistics. */
oi->db_desc_in++;
- dd = (struct ospf_db_desc *)STREAM_PNT(s);
+ dd = (struct ospf_db_desc *)stream_pnt(s);
nbr = ospf_nbr_lookup(oi, iph, ospfh);
if (nbr == NULL) {
for (; size >= OSPF_LSA_HEADER_SIZE && count > 0;
size -= length, stream_forward_getp(s, length), count--) {
- lsah = (struct lsa_header *)STREAM_PNT(s);
+ lsah = (struct lsa_header *)stream_pnt(s);
length = ntohs(lsah->length);
if (length > size) {
struct ospf_lsa *lsa, *lsr;
lsa = ospf_lsa_new();
- lsa->data = (struct lsa_header *)STREAM_PNT(s);
+ lsa->data = (struct lsa_header *)stream_pnt(s);
lsa->vrf_id = oi->ospf->vrf_id;
- /* lsah = (struct lsa_header *) STREAM_PNT (s); */
+ /* lsah = (struct lsa_header *) stream_pnt (s); */
size -= OSPF_LSA_HEADER_SIZE;
stream_forward_getp(s, OSPF_LSA_HEADER_SIZE);
by ospf_recv_packet() to be correct). */
stream_forward_getp(ibuf, iph->ip_hl * 4);
- ospfh = (struct ospf_header *)STREAM_PNT(ibuf);
+ ospfh = (struct ospf_header *)stream_pnt(ibuf);
if (MSG_OK
!= ospf_packet_examin(
ospfh, stream_get_endp(ibuf) - stream_get_getp(ibuf)))
writenum = stream_get_endp(s) - stream_get_getp(s);
/* Call write() system call */
- num = write(mp->fd, STREAM_PNT(s), writenum);
+ num = write(mp->fd, stream_pnt(s), writenum);
if (num < 0) {
/* write failed either retry needed or error */
if (ERRNO_IO_RETRY(errno)) {
break;
bytes_written =
- write(zfpm_g->sock, STREAM_PNT(s), bytes_to_write);
+ write(zfpm_g->sock, stream_pnt(s), bytes_to_write);
zfpm_g->stats.write_calls++;
num_writes++;