summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2022-08-15 10:43:08 +0200
committerFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2022-08-15 10:54:54 +0200
commitba547395795b78db62782f714429e7dfa186bfb1 (patch)
tree5f74a117d6a368609a221e0c9d99c1e3782b1d4c
parentda0c0cb6e39f69d9169497d2e278ede775b668cc (diff)
downloadtcpdump-ba547395795b78db62782f714429e7dfa186bfb1.tar.gz
RIP: Print an error message for an invalid version
Moreover: RIP: Print the protocol name even in truncation case or invalid length.
-rw-r--r--print-rip.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/print-rip.c b/print-rip.c
index 265222a1..35672551 100644
--- a/print-rip.c
+++ b/print-rip.c
@@ -300,14 +300,18 @@ rip_print(netdissect_options *ndo,
unsigned entry_size;
ndo->ndo_protocol = "rip";
+ ND_PRINT("%s", (ndo->ndo_vflag >= 1) ? "\n\t" : "");
+ nd_print_protocol_caps(ndo);
ND_ICHECKMSG_ZU("packet length", len, <, sizeof(*rp));
rp = (const struct rip *)p;
vers = GET_U_1(rp->rip_vers);
- ND_PRINT("%sRIPv%u",
- (ndo->ndo_vflag >= 1) ? "\n\t" : "",
- vers);
+ ND_PRINT("v%u", vers);
+ if (vers != 1 && vers != 2) {
+ ND_PRINT(" [version != 1 && version != 2]");
+ goto invalid;
+ }
/* dump version and lets see if we know the commands name*/
cmd = GET_U_1(rp->rip_cmd);