2005-02-09 Paul Jakma <paul.jakma@sun.com>
* (global) Update code to match stream.h changes.
stream_get_putp effectively replaced with stream_get_endp.
stream_forward renamed to stream_forward_getp.
stream_forward_endp introduced to replace some previous
setting/manual twiddling of putp by daemons.
* lib/stream.h: Remove putp. Update reference to putp with endp.
Add stream_forward_endp, which daemons were doing manually.
Rename stream_forward to stream_forward_getp.
lib/stream.c: Remove/update references to putp.
introduce stream_forward_endp.
diff --git a/zebra/irdp_packet.c b/zebra/irdp_packet.c
index 77e559c..2f448ec 100644
--- a/zebra/irdp_packet.c
+++ b/zebra/irdp_packet.c
@@ -305,11 +305,11 @@
icmp = (struct icmphdr *) (buf + sizeof (struct ip));
/* Merge IP header with icmp packet */
-
- stream_get(icmp, s, s->putp);
+ assert (stream_get_endp(s) < (sizeof (buf) - sizeof (struct ip)));
+ stream_get(icmp, s, stream_get_endp(s));
/* icmp->checksum is already calculated */
- ip->ip_len = sizeof(struct ip) + s->putp;
+ ip->ip_len = sizeof(struct ip) + stream_get_endp(s);
stream_free(s);
on = 1;
diff --git a/zebra/zserv.c b/zebra/zserv.c
index 10616b4..dfaa90e 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -480,7 +480,7 @@
{
if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB))
{
- nhnummark = stream_get_putp (s);
+ nhnummark = stream_get_endp (s);
stream_putc (s, 1); /* placeholder */
nhnum++;
@@ -562,7 +562,7 @@
{
stream_putl (s, rib->metric);
num = 0;
- nump = s->putp;
+ nump = stream_get_endp(s);
stream_putc (s, 0);
for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB))
@@ -629,7 +629,7 @@
{
stream_putl (s, rib->metric);
num = 0;
- nump = s->putp;
+ nump = stream_get_endp(s);
stream_putc (s, 0);
for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB))
@@ -690,7 +690,7 @@
{
stream_putl (s, rib->metric);
num = 0;
- nump = s->putp;
+ nump = stream_get_endp(s);
stream_putc (s, 0);
for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB))
@@ -853,14 +853,14 @@
break;
case ZEBRA_NEXTHOP_IFNAME:
ifname_len = stream_getc (s);
- stream_forward (s, ifname_len);
+ stream_forward_getp (s, ifname_len);
break;
case ZEBRA_NEXTHOP_IPV4:
nexthop.s_addr = stream_get_ipv4 (s);
nexthop_ipv4_add (rib, &nexthop);
break;
case ZEBRA_NEXTHOP_IPV6:
- stream_forward (s, IPV6_MAX_BYTELEN);
+ stream_forward_getp (s, IPV6_MAX_BYTELEN);
break;
case ZEBRA_NEXTHOP_BLACKHOLE:
nexthop_blackhole_add (rib);
@@ -925,13 +925,13 @@
break;
case ZEBRA_NEXTHOP_IFNAME:
ifname_len = stream_getc (s);
- stream_forward (s, ifname_len);
+ stream_forward_getp (s, ifname_len);
break;
case ZEBRA_NEXTHOP_IPV4:
nexthop.s_addr = stream_get_ipv4 (s);
break;
case ZEBRA_NEXTHOP_IPV6:
- stream_forward (s, IPV6_MAX_BYTELEN);
+ stream_forward_getp (s, IPV6_MAX_BYTELEN);
break;
}
}