[CUWiN-Dev] Re: [CUWiN-Commits] r4068 - cuw/branches/quagga-zrib-update/src/zrib

Bill Comisky bcomisky at pobox.com
Wed Jul 5 19:57:30 CDT 2006


On 7/5/06, bcomisky at cuw.ojctech.com <bcomisky at cuw.ojctech.com> wrote:
> Author: bcomisky
> Date: 2006-07-05 19:44:16 -0500 (Wed, 05 Jul 2006)
> New Revision: 4068
>
> Modified:
>    cuw/branches/quagga-zrib-update/src/zrib/rib_zebra_pkt.c
> Log:
> Fix an endian issue with the (newly 2-byte) command in the zebra packet header.
>
> rib_zebra_pkt.c:
>  - rib_zpkt_header_unpack(): Call ntohs() after unpacking command.
>  - rib_zpkt_header_pack(): Call htons() before packing command.
>
>
> Modified: cuw/branches/quagga-zrib-update/src/zrib/rib_zebra_pkt.c
> ===================================================================
> --- cuw/branches/quagga-zrib-update/src/zrib/rib_zebra_pkt.c    2006-07-03 23:32:03 UTC (rev 4067)
> +++ cuw/branches/quagga-zrib-update/src/zrib/rib_zebra_pkt.c    2006-07-06 00:44:16 UTC (rev 4068)
> @@ -79,6 +79,8 @@
>                 return NULL;
>         }
>
> +       *commandp = ntohs(*commandp);
> +
>         return end;
>  }
>
> @@ -90,7 +92,7 @@
>         void *end;
>
>         rc = pack(buf, buflen, ZPKT_HEADER_FMT ENDMARKER,
> -           paylenp, ZPKT_HEADER_MARKER, ZEBRA_ZSERV_VERSION, command, &end);
> +           paylenp, ZPKT_HEADER_MARKER, ZEBRA_ZSERV_VERSION, htons(command), &end);
>
>         if (rc != 5) {
>                 loglib_warnx("%s: packed %d fields in %zu bytes at %p",
>

I finally got around to testing the quagga update, and (surprise) it
wasn't working  right.  The commands, which are now 2-byte instead of
1-byte as in zserv version 0, commands were all byte swapped.   The
client sent a 1 and the server received a 256, etc.  After the above
patch, the routing tables are populating properly and thing seem to be
working.  I tested against HEAD of /trunk with the
/branches/quagga-zrib-update changes merged in.

Was this "the right way" to do it?  Also, any suggestions for other
tests (other than booting and checking for a good looking routing
table) to shake out any other bugs in the new quagga stuff?

Bill

-- 
Bill Comisky
bcomisky at pobox.com


More information about the CU-Wireless-Dev mailing list