diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2019-09-29 21:54:04 +0200 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2020-09-13 18:05:34 +0200 |
commit | 87264e5c5ba36fcfadfbcdd53b4e681cd995dbe3 (patch) | |
tree | e45a2905722958af6817203fafae0f0a3185580c /proto | |
parent | bbadc1e3e725635c8a5b6e306a29153c42612edd (diff) |
TunnelEncaps: Improve format function
Diffstat (limited to 'proto')
-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 90fcba57..78d437e8 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" @@ -891,23 +892,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 |