tcpdump fix cdp Native-VLAN-ID

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

tcpdump fix cdp Native-VLAN-ID

Martijn van Duren-5
Found by a colleague and verified against latest tcpdump version.

I don't know where the -1 comes from, but it is wrong.

OK?

martijn@

Index: print-cdp.c
===================================================================
RCS file: /cvs/src/usr.sbin/tcpdump/print-cdp.c,v
retrieving revision 1.7
diff -u -p -r1.7 print-cdp.c
--- print-cdp.c 5 Apr 2019 00:57:59 -0000 1.7
+++ print-cdp.c 11 Sep 2019 12:33:51 -0000
@@ -115,7 +115,7 @@ cdp_print(const u_char *p, u_int length,
  case 0x0a: /* guess - not documented */
  if (len < 6)
  goto error;
- printf(" Native-VLAN-ID %d", (p[i+4]<<8) + p[i+4+1] - 1 );
+ printf(" Native-VLAN-ID %d", (p[i+4]<<8) + p[i+4+1]);
  break;
  case 0x0b: /* guess - not documented */
  if (len < 5)

Reply | Threaded
Open this post in threaded view
|

Re: tcpdump fix cdp Native-VLAN-ID

Stuart Henderson
On 2019/09/11 14:34, Martijn van Duren wrote:

> Found by a colleague and verified against latest tcpdump version.
>
> I don't know where the -1 comes from, but it is wrong.
>
> OK?
>
> martijn@
>
> Index: print-cdp.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/print-cdp.c,v
> retrieving revision 1.7
> diff -u -p -r1.7 print-cdp.c
> --- print-cdp.c 5 Apr 2019 00:57:59 -0000 1.7
> +++ print-cdp.c 11 Sep 2019 12:33:51 -0000
> @@ -115,7 +115,7 @@ cdp_print(const u_char *p, u_int length,
>   case 0x0a: /* guess - not documented */
>   if (len < 6)
>   goto error;
> - printf(" Native-VLAN-ID %d", (p[i+4]<<8) + p[i+4+1] - 1 );
> + printf(" Native-VLAN-ID %d", (p[i+4]<<8) + p[i+4+1]);
>   break;
>   case 0x0b: /* guess - not documented */
>   if (len < 5)
>

OK.

There are some cisco docs that don't say anything about subtracting 1
(maybe replace the "guess - not documented" with the url while there?
http://www.cisco.com/c/en/us/support/docs/switches/catalyst-4500-series-switches/13414-103.html#cdp)