mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 15:33:56 +00:00
[zserv] fix up custom isisd and bgpd Zserv functions for new format.
2006-01-17 Paul Jakma <paul.jakma@sun.com> * bgp_nexthop.c: (zlookup_read*) convert to new Zserv format. (zlookup_query_ipv6) ditto. (bgp_import_check) ditto. * isis_zebra.c: (isis_zebra_route_add_ipv4) fix for new zserv format.
This commit is contained in:
parent
98fd1e6121
commit
d3092e7f22
@ -1,3 +1,9 @@
|
|||||||
|
2006-01-17 Paul Jakma <paul.jakma@sun.com>
|
||||||
|
|
||||||
|
* bgp_nexthop.c: (zlookup_read*) convert to new Zserv format.
|
||||||
|
(zlookup_query_ipv6) ditto.
|
||||||
|
(bgp_import_check) ditto.
|
||||||
|
|
||||||
2006-01-16 Paul Jakma <paul.jakma@sun.com>
|
2006-01-16 Paul Jakma <paul.jakma@sun.com>
|
||||||
|
|
||||||
* bgp_aspath.c: (assegment_append_asns) XREALLOC can return
|
* bgp_aspath.c: (assegment_append_asns) XREALLOC can return
|
||||||
|
@ -738,11 +738,13 @@ static struct bgp_nexthop_cache *
|
|||||||
zlookup_read ()
|
zlookup_read ()
|
||||||
{
|
{
|
||||||
struct stream *s;
|
struct stream *s;
|
||||||
u_int16_t length;
|
uint16_t length;
|
||||||
u_char command;
|
u_char marker;
|
||||||
|
u_char version;
|
||||||
|
uint16_t command;
|
||||||
int nbytes;
|
int nbytes;
|
||||||
struct in_addr raddr;
|
struct in_addr raddr;
|
||||||
u_int32_t metric;
|
uint32_t metric;
|
||||||
int i;
|
int i;
|
||||||
u_char nexthop_num;
|
u_char nexthop_num;
|
||||||
struct nexthop *nexthop;
|
struct nexthop *nexthop;
|
||||||
@ -755,7 +757,18 @@ zlookup_read ()
|
|||||||
length = stream_getw (s);
|
length = stream_getw (s);
|
||||||
|
|
||||||
nbytes = stream_read (s, zlookup->sock, length - 2);
|
nbytes = stream_read (s, zlookup->sock, length - 2);
|
||||||
command = stream_getc (s);
|
marker = stream_getc (s);
|
||||||
|
version = stream_getc (s);
|
||||||
|
|
||||||
|
if (version != ZSERV_VERSION || marker != ZEBRA_HEADER_MARKER)
|
||||||
|
{
|
||||||
|
zlog_err("%s: socket %d version mismatch, marker %d, version %d",
|
||||||
|
__func__, zlookup->sock, marker, version);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
command = stream_getw (s);
|
||||||
|
|
||||||
raddr.s_addr = stream_get_ipv4 (s);
|
raddr.s_addr = stream_get_ipv4 (s);
|
||||||
metric = stream_getl (s);
|
metric = stream_getl (s);
|
||||||
nexthop_num = stream_getc (s);
|
nexthop_num = stream_getc (s);
|
||||||
@ -806,11 +819,12 @@ zlookup_query (struct in_addr addr)
|
|||||||
|
|
||||||
s = zlookup->obuf;
|
s = zlookup->obuf;
|
||||||
stream_reset (s);
|
stream_reset (s);
|
||||||
stream_putw (s, 7);
|
zclient_create_header (s, ZEBRA_IPV4_NEXTHOP_LOOKUP);
|
||||||
stream_putc (s, ZEBRA_IPV4_NEXTHOP_LOOKUP);
|
|
||||||
stream_put_in_addr (s, &addr);
|
stream_put_in_addr (s, &addr);
|
||||||
|
|
||||||
ret = writen (zlookup->sock, s->data, 7);
|
stream_putw_at (s, 0, stream_get_endp (s));
|
||||||
|
|
||||||
|
ret = writen (zlookup->sock, s->data, stream_get_endp (s));
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
zlog_err ("can't write to zlookup->sock");
|
zlog_err ("can't write to zlookup->sock");
|
||||||
@ -834,11 +848,12 @@ static struct bgp_nexthop_cache *
|
|||||||
zlookup_read_ipv6 ()
|
zlookup_read_ipv6 ()
|
||||||
{
|
{
|
||||||
struct stream *s;
|
struct stream *s;
|
||||||
u_int16_t length;
|
uint16_t length;
|
||||||
u_char command;
|
u_char version, marker;
|
||||||
|
uint16_t command;
|
||||||
int nbytes;
|
int nbytes;
|
||||||
struct in6_addr raddr;
|
struct in6_addr raddr;
|
||||||
u_int32_t metric;
|
uint32_t metric;
|
||||||
int i;
|
int i;
|
||||||
u_char nexthop_num;
|
u_char nexthop_num;
|
||||||
struct nexthop *nexthop;
|
struct nexthop *nexthop;
|
||||||
@ -851,8 +866,18 @@ zlookup_read_ipv6 ()
|
|||||||
length = stream_getw (s);
|
length = stream_getw (s);
|
||||||
|
|
||||||
nbytes = stream_read (s, zlookup->sock, length - 2);
|
nbytes = stream_read (s, zlookup->sock, length - 2);
|
||||||
command = stream_getc (s);
|
marker = stream_getc (s);
|
||||||
|
version = stream_getc (s);
|
||||||
|
|
||||||
|
if (version != ZSERV_VERSION || marker != ZEBRA_HEADER_MARKER)
|
||||||
|
{
|
||||||
|
zlog_err("%s: socket %d version mismatch, marker %d, version %d",
|
||||||
|
__func__, zlookup->sock, marker, version);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
command = stream_getw (s);
|
||||||
|
|
||||||
stream_get (&raddr, s, 16);
|
stream_get (&raddr, s, 16);
|
||||||
|
|
||||||
metric = stream_getl (s);
|
metric = stream_getl (s);
|
||||||
@ -909,11 +934,11 @@ zlookup_query_ipv6 (struct in6_addr *addr)
|
|||||||
|
|
||||||
s = zlookup->obuf;
|
s = zlookup->obuf;
|
||||||
stream_reset (s);
|
stream_reset (s);
|
||||||
stream_putw (s, 19);
|
zclient_create_header (s, ZEBRA_IPV6_NEXTHOP_LOOKUP);
|
||||||
stream_putc (s, ZEBRA_IPV6_NEXTHOP_LOOKUP);
|
|
||||||
stream_put (s, addr, 16);
|
stream_put (s, addr, 16);
|
||||||
|
stream_putw_at (s, 0, stream_get_endp (s));
|
||||||
ret = writen (zlookup->sock, s->data, 19);
|
|
||||||
|
ret = writen (zlookup->sock, s->data, stream_get_endp (s));
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
zlog_err ("can't write to zlookup->sock");
|
zlog_err ("can't write to zlookup->sock");
|
||||||
@ -939,8 +964,8 @@ bgp_import_check (struct prefix *p, u_int32_t *igpmetric,
|
|||||||
{
|
{
|
||||||
struct stream *s;
|
struct stream *s;
|
||||||
int ret;
|
int ret;
|
||||||
u_int16_t length;
|
u_int16_t length, command;
|
||||||
u_char command;
|
u_char version, marker;
|
||||||
int nbytes;
|
int nbytes;
|
||||||
struct in_addr addr;
|
struct in_addr addr;
|
||||||
struct in_addr nexthop;
|
struct in_addr nexthop;
|
||||||
@ -959,13 +984,15 @@ bgp_import_check (struct prefix *p, u_int32_t *igpmetric,
|
|||||||
/* Send query to the lookup connection */
|
/* Send query to the lookup connection */
|
||||||
s = zlookup->obuf;
|
s = zlookup->obuf;
|
||||||
stream_reset (s);
|
stream_reset (s);
|
||||||
stream_putw (s, 8);
|
zclient_create_header (s, ZEBRA_IPV4_IMPORT_LOOKUP);
|
||||||
stream_putc (s, ZEBRA_IPV4_IMPORT_LOOKUP);
|
|
||||||
stream_putc (s, p->prefixlen);
|
stream_putc (s, p->prefixlen);
|
||||||
stream_put_in_addr (s, &p->u.prefix4);
|
stream_put_in_addr (s, &p->u.prefix4);
|
||||||
|
|
||||||
|
stream_putw_at (s, 0, stream_get_endp (s));
|
||||||
|
|
||||||
/* Write the packet. */
|
/* Write the packet. */
|
||||||
ret = writen (zlookup->sock, s->data, 8);
|
ret = writen (zlookup->sock, s->data, stream_get_endp (s));
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
@ -991,7 +1018,18 @@ bgp_import_check (struct prefix *p, u_int32_t *igpmetric,
|
|||||||
|
|
||||||
/* Fetch whole data. */
|
/* Fetch whole data. */
|
||||||
nbytes = stream_read (s, zlookup->sock, length - 2);
|
nbytes = stream_read (s, zlookup->sock, length - 2);
|
||||||
command = stream_getc (s);
|
marker = stream_getc (s);
|
||||||
|
version = stream_getc (s);
|
||||||
|
|
||||||
|
if (version != ZSERV_VERSION || marker != ZEBRA_HEADER_MARKER)
|
||||||
|
{
|
||||||
|
zlog_err("%s: socket %d version mismatch, marker %d, version %d",
|
||||||
|
__func__, zlookup->sock, marker, version);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
command = stream_getw (s);
|
||||||
|
|
||||||
addr.s_addr = stream_get_ipv4 (s);
|
addr.s_addr = stream_get_ipv4 (s);
|
||||||
metric = stream_getl (s);
|
metric = stream_getl (s);
|
||||||
nexthop_num = stream_getc (s);
|
nexthop_num = stream_getc (s);
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2006-01-17 Paul Jakma <paul.jakma@sun.com>
|
||||||
|
|
||||||
|
* isis_zebra.c: (isis_zebra_route_add_ipv4) fix for new
|
||||||
|
zserv format.
|
||||||
|
|
||||||
2005-11-20 Paul Jakma <paul.jakma@sun.com>
|
2005-11-20 Paul Jakma <paul.jakma@sun.com>
|
||||||
|
|
||||||
* (general) remove includes of very common system headers,
|
* (general) remove includes of very common system headers,
|
||||||
|
@ -267,10 +267,7 @@ isis_zebra_route_add_ipv4 (struct prefix *prefix,
|
|||||||
|
|
||||||
stream = zclient->obuf;
|
stream = zclient->obuf;
|
||||||
stream_reset (stream);
|
stream_reset (stream);
|
||||||
/* Length place holder. */
|
zclient_create_header (stream, ZEBRA_IPV4_ROUTE_ADD);
|
||||||
stream_putw (stream, 0);
|
|
||||||
/* command */
|
|
||||||
stream_putc (stream, ZEBRA_IPV4_ROUTE_ADD);
|
|
||||||
/* type */
|
/* type */
|
||||||
stream_putc (stream, ZEBRA_ROUTE_ISIS);
|
stream_putc (stream, ZEBRA_ROUTE_ISIS);
|
||||||
/* flags */
|
/* flags */
|
||||||
|
Loading…
Reference in New Issue
Block a user