no udp response on FreeBSD/arm

Ronald Klop ronald-freebsd8@klop.yi.org
Sun Jun 24 18:02:46 UTC 2012


On Sun, 24 Jun 2012 18:49:53 +0200, Vernon Schryver <vjs@rhyolite.com>  
wrote:

>> From: "Ronald Klop" <ronald-freebsd8@klop.yi.org>
>
>> Cdcc info works and the network traffic looks ok. So I do not see a
>> firewall issue.
>
> ok.
>
>> Wireshark (1.8) gives some interesting outcome. Here are the dump files.
>> https://dl.dropbox.com/u/74961258/dump-amd64.pcap
>> https://dl.dropbox.com/u/74961258/dump-arm.pcap
>>
>> The first md5 sum is shifted 2 bytes in dump-arm.
>> amd: 28:49:3c:d1:60:ac:70:13:16:df:e6:a7:d7:0c:4c:e4
>> arm: 08:20:28:49:3c:d1:60:ac:70:13:16:df:e6:a7:d7:0c
>>
>> The length field of the checksum says 36 on arm and 18 on amd64. And the
>> arm value looks padded with 0's at the end.
>
> Yes.
>
> Are you using current official DCC source from
> http://www.dcc-servers.net/dcc/#downloads or  
> http://www.rhyolite.com/dcc/ ?
> Have you modified any of it at all?
> I assume (and hope) not, but experience demands that I ask.

I just use the version from the FreeBSD ports collection.


> This is the code in clntlib/ask.c that puts the checksums into the  
> request:
>
> 	ck = rpt.r.cks;
> 	num_cks = 0;
> 	for (g = cks->sums; g <= &cks->sums[DCC_CK_TYPE_LAST]; ++g) {
> 		/* do not tell the DCC server about some checksums */
> 		if (!g->rpt2srvr)
> 			continue;
> 		ck->len = sizeof(*ck);
> 		ck->type = g->type;
> 		ck->sum = g->sum;
> 		++ck;
> 		++num_cks;
> 	}
>
> These are the relevant definitions from include/dcc_proto.h
>
>     typedef u_char DCC_CK_TYPE_B;
>     typedef struct {
> 	u_char	hi, lo;
>     } DCC_FLOD_PATH_ID;
>     typedef union {
> 	u_char b[16];
> 	DCC_FLOD_PATH_ID p[8];
>     } DCC_SUM;
>     typedef struct {
> 	DCC_CK_TYPE_B type;
> 	u_char	len;			/* total length of this checksum */
> 	DCC_SUM	sum;
>     } DCC_CK;
>
>
> It can't be that sizeof(u_char)==2, because 1 byte fields
> such as the checksum length are using single bytes.
>
> If it were an alignment or structure confusion, I'd expect
> the length to be rounded up to 20 or 24 instead of 36.
>
> It would be interesting to see what the compiler thinks about
> the sizes and alignments of the structure elements of cks->sums.

sizeof(ck->type)=1
sizeof(ck->len)=1
sizeof(ck->sum)=32
sizeof(*ck)=36
&ck->type=0xbfff9704
&ck->len=0xbfff9705
&ck->sum)=0xbfff9708
ck=0xbfff9704

I added __attribute__((__packed__)) to DCC_FLOD_PATH_ID and DCC_CK and now  
it seems to work. At least the server responds.
I guess it is by design that the servers ignore invalid packets in stead  
of replying with an error message.

I don't know if my solution with __packed__ is the best, but thanks a lot  
for your quick answers.

Ronald.



More information about the DCC mailing list

Contact vjs@rhyolite.com by mail or use the form.