diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2019-09-29 21:54:04 +0200 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2021-01-12 23:34:17 +0100 |
commit | b04f434f693e49c65197c2c1bcee2d5fd66f12d2 (patch) | |
tree | 2f35c1bfd68ea947b557a8c71267e074a28680a7 /proto/bgp | |
parent | 33ef360f775ea5819cc8c3638ca4256c4992c4c7 (diff) |
TunnelEncaps: Improve format function
Diffstat (limited to 'proto/bgp')
-rw-r--r-- | proto/bgp/attrs.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c index c6317892..f8153dd0 100644 --- a/proto/bgp/attrs.c +++ b/proto/bgp/attrs.c @@ -21,6 +21,7 @@ #include "lib/resource.h" #include "lib/string.h" #include "lib/unaligned.h" +#include "lib/tunnel_encaps.h" #include "bgp.h" @@ -919,23 +920,9 @@ bgp_format_tunnel_encap(const eattr *a, byte *buf, uint size) { char *pos = buf; - if (a->u.ptr->length == 0) - { - bsprintf(pos, ""); - return; - } - - for (uint i = 0; i < a->u.ptr->length; i++) - { - if (size < 4) - { - bsprintf(pos, "..."); - return; - } - - uint l = bsprintf(pos, "%02x ", a->u.ptr->data[i]); + int l = format_tunnel_encap(a, pos, size); + if (l > 0) ADVANCE(pos, size, l); - } } static void |