Skip to content

Commit 6af686f

Browse files
committed
IPv6 mobility: Rework a length check
When the option is not PAD1, the minimal length is 2 (IP6MOPT_MINLEN). Check this length and remove, on two options, the same check now useless.
1 parent 5e42629 commit 6af686f

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

print-mobility.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ mobility_opt_print(netdissect_options *ndo,
127127
if (opttype == IP6MOPT_PAD1)
128128
optlen = 1;
129129
else {
130-
ND_ICHECKMSG_U("remaining length", (u_int)(len - i), <, 1);
130+
ND_ICHECKMSG_U("remaining length", (u_int)(len - i), <,
131+
IP6MOPT_MINLEN);
131132
optlen = GET_U_1(bp + i + 1) + 2;
132133
}
133134
ND_ICHECKMSG_U("remaining length", (u_int)(len - i), <, optlen);
@@ -139,8 +140,6 @@ mobility_opt_print(netdissect_options *ndo,
139140
break;
140141
case IP6MOPT_PADN:
141142
ND_PRINT("(padn)");
142-
ND_ICHECKMSG_U("remaining length", (u_int)(len - i), <,
143-
IP6MOPT_MINLEN);
144143
break;
145144
case IP6MOPT_REFRESH:
146145
ND_PRINT("(refresh: ");
@@ -170,8 +169,6 @@ mobility_opt_print(netdissect_options *ndo,
170169
break;
171170
default:
172171
ND_PRINT("(unknown: ");
173-
ND_ICHECKMSG_U("remaining length", (u_int)(len - i), <,
174-
IP6MOPT_MINLEN);
175172
ND_PRINT("type-#%u len=%u)", opttype, optlen - 2);
176173
break;
177174
}

0 commit comments

Comments
 (0)