[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] nd6.c byte order issues
From: |
Ivan Delamer |
Subject: |
Re: [lwip-users] nd6.c byte order issues |
Date: |
Wed, 23 Jan 2013 10:17:26 -0700 (MST) |
User-agent: |
SquirrelMail/1.4.9a |
Hey Zach,
Can you submit this issue, as well as the netif up/down issue, as bugs in
Savannah? That way I won't forget to look into it, and we can discuss it
if necessary.
Cheers
Ivan
> Date: Tue, 22 Jan 2013 22:47:59 +0000
> From: Zach Smith <address@hidden>
> To: "address@hidden" <address@hidden>
> Subject: [lwip-users] nd6.c byte order issues
> Message-ID:
> <address@hidden>
>
> Content-Type: text/plain; charset="us-ascii"
>
> It seems to me that the current master version of nd6_input function has
> some byte ordering problems.
>
> For example, in nd6_input()
>
> Line 439:
> case ND6_OPTION_TYPE_MTU:
> {
> struct mtu_option * mtu_opt;
> mtu_opt = (struct mtu_option *)buffer;
> if (mtu_opt->mtu >= 1280) {
> #if LWIP_ND6_ALLOW_RA_UPDATES
> inp->mtu = mtu_opt->mtu;
> #endif /* LWIP_ND6_ALLOW_RA_UPDATES */
> }
> break;
> }
>
> As mtu_opt->mtu is a u32_t, it seems to me like it should be this:
>
> case ND6_OPTION_TYPE_MTU:
> {
> struct mtu_option * mtu_opt;
> mtu_opt = (struct mtu_option *)buffer;
> if (ntohl(mtu_opt->mtu) >= 1280) { /* zs: added
> ntohl() */
> #if LWIP_ND6_ALLOW_RA_UPDATES
> inp->mtu = ntohl(mtu_opt->mtu); /* zs: added
> ntohl() */
> #endif /* LWIP_ND6_ALLOW_RA_UPDATES */
> }
> break;
> }
>
> Am I correct that this is a bug?
> There are a few other accesses in nd6_input() like this that I think
> should be done using ntohl() or ntohs().
>
> -Zach