mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-16 02:30:52 +00:00
lib: Pass the safi as a uint8_t
The safi encode/decode is using 2 bytes, which may cause problems on some platforms. Let's assume that a safi is a uint8_t and work accordingly. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
ec93aa120e
commit
832d0f566f
@ -901,7 +901,7 @@ int zapi_route_encode(u_char cmd, struct stream *s, struct zapi_route *api)
|
|||||||
stream_putw(s, api->instance);
|
stream_putw(s, api->instance);
|
||||||
stream_putl(s, api->flags);
|
stream_putl(s, api->flags);
|
||||||
stream_putc(s, api->message);
|
stream_putc(s, api->message);
|
||||||
stream_putw(s, api->safi);
|
stream_putc(s, api->safi);
|
||||||
|
|
||||||
/* Put prefix information. */
|
/* Put prefix information. */
|
||||||
stream_putc(s, api->prefix.family);
|
stream_putc(s, api->prefix.family);
|
||||||
@ -1021,7 +1021,7 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api)
|
|||||||
STREAM_GETW(s, api->instance);
|
STREAM_GETW(s, api->instance);
|
||||||
STREAM_GETL(s, api->flags);
|
STREAM_GETL(s, api->flags);
|
||||||
STREAM_GETC(s, api->message);
|
STREAM_GETC(s, api->message);
|
||||||
STREAM_GETW(s, api->safi);
|
STREAM_GETC(s, api->safi);
|
||||||
|
|
||||||
/* Prefix. */
|
/* Prefix. */
|
||||||
STREAM_GETC(s, api->prefix.family);
|
STREAM_GETC(s, api->prefix.family);
|
||||||
|
@ -235,6 +235,13 @@ struct zapi_nexthop {
|
|||||||
mpls_label_t labels[MPLS_MAX_LABELS];
|
mpls_label_t labels[MPLS_MAX_LABELS];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Some of these data structures do not map easily to
|
||||||
|
* a actual data structure size giving different compilers
|
||||||
|
* and systems. For those data structures we need
|
||||||
|
* to use the smallest available stream_getX/putX functions
|
||||||
|
* to encode/decode.
|
||||||
|
*/
|
||||||
struct zapi_route {
|
struct zapi_route {
|
||||||
u_char type;
|
u_char type;
|
||||||
u_short instance;
|
u_short instance;
|
||||||
@ -243,6 +250,10 @@ struct zapi_route {
|
|||||||
|
|
||||||
u_char message;
|
u_char message;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is an enum but we are going to treat it as a uint8_t
|
||||||
|
* for purpose of encoding/decoding
|
||||||
|
*/
|
||||||
safi_t safi;
|
safi_t safi;
|
||||||
|
|
||||||
struct prefix prefix;
|
struct prefix prefix;
|
||||||
|
Loading…
Reference in New Issue
Block a user