diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2018-07-06 07:00:50 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2018-07-06 07:00:50 +0000 |
commit | 7ae31a6cb2f8effc8c267001e98f4148c54a1e94 (patch) | |
tree | 25bd3415b101ac82c4838ba2b905afd31bbb5e8f | |
parent | d56545c8b370703a03b7bfe7b65dfa5ae970070f (diff) |
use do { } while (!bottom) instead of again: ... if (!bottom) goto again;
-rw-r--r-- | usr.sbin/tcpdump/print-mpls.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/usr.sbin/tcpdump/print-mpls.c b/usr.sbin/tcpdump/print-mpls.c index bb73a0064cc..6617998b7f2 100644 --- a/usr.sbin/tcpdump/print-mpls.c +++ b/usr.sbin/tcpdump/print-mpls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-mpls.c,v 1.3 2016/07/11 00:27:50 rzalamena Exp $ */ +/* $OpenBSD: print-mpls.c,v 1.4 2018/07/06 07:00:49 dlg Exp $ */ /* * Copyright (c) 2005 Jason L. Wright (jason@thought.net) @@ -45,25 +45,23 @@ mpls_print(const u_char *bp, u_int len) u_int32_t tag, label, exp, bottom, ttl; int has_cw; - again: - if (bp + sizeof(tag) > snapend) - goto trunc; - - tag = EXTRACT_32BITS(bp); - bp += sizeof(tag); - len -= sizeof(tag); + do { + if (bp + sizeof(tag) > snapend) + goto trunc; - label = (tag >> 12) & 0xfffff; - exp = (tag >> 9) & 0x7; - bottom = (tag >> 8) & 0x1; - ttl = (tag >> 0) & 0xff; + tag = EXTRACT_32BITS(bp); + bp += sizeof(tag); + len -= sizeof(tag); - printf("MPLS(label %u, exp %u, ttl %u) ", label, exp, ttl); + label = (tag >> 12) & 0xfffff; + exp = (tag >> 9) & 0x7; + bottom = (tag >> 8) & 0x1; + ttl = (tag >> 0) & 0xff; - /* XXX decode "Router Alert Label" */ + printf("MPLS(label %u, exp %u, ttl %u) ", label, exp, ttl); - if (!bottom) - goto again; + /* XXX decode "Router Alert Label" */ + } while (!bottom); /* Handle pseudowire control word. */ has_cw = controlword_tryprint(&bp, &len); |