Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux-HA: Dev

Re: Checksum not computed in ICMPv6 neighbor advertisement

 

 

Linux-HA dev RSS feed   Index | Next | Previous | View Threaded


dejanmm at fastmail

Jun 5, 2009, 4:08 AM

Post #1 of 6 (1246 views)
Permalink
Re: Checksum not computed in ICMPv6 neighbor advertisement

Hi Andre,

On Fri, Jun 05, 2009 at 09:34:37AM +0000, Andre, Pascal wrote:
> Hi,
>
> On an Active/Standby platform (using Linux-HA 2.1.4 RHEL5, in
> my case), when a fail-over/switch-over is initiated and standby
> machine takes over the virtual IP (IPv6), IPv6addr broadcasts
> an ICMPv6 neighbor advertisement message.
>
> Unfortunately, this ICMPv6 message has its checksum field set
> to 0 (i.e. not computed). The message is thus discarded by
> recipients.
>
> Maybe this computation should be done by libnet itself.
> Unfortunately, without much time to investigate libnet, I've
> added code in resources/OCF/IPv6addr.c in order to compute the
> checksum and provide the result to libnet (as a parameter).

Applied. Many thanks for the patch.

BTW, a user recently complained on the user mailing list about
not being able to run IPv6addr with mask 128. Did you ever
experience that? I looked at the code a bit, couldn't find a
problem. Oh, and it only prints the Generic error (exit code 1)
and one couldn't figure out anything from the strace.

Cheers,

Dejan

> Regards,
> Pascal ANDRE
>
>
> --- IPv6addr.c.old 2009-04-30 10:15:16.000000000 +0200
> +++ IPv6addr.c 2009-04-30 11:45:43.000000000 +0200
> @@ -381,6 +381,58 @@
> return OCF_NOT_RUNNING;
> }
>
> +/* compute ICMPv6 checksum */
> +static uint32_t
> +cksum_sum(uint16_t *addr, int len, int ntoh)
> +{
> + uint16_t * w = addr;
> + uint16_t ret = 0;
> + uint32_t sum = 0;
> +
> + while (len > 1) {
> + ret = *w++;
> + if (ntoh) ret = ntohs(ret);
> + sum += ret;
> + len -= 2;
> + }
> +
> + if (len == 1) {
> + *(unsigned char *) (&ret) = *(unsigned char *) w;
> + sum += ret;
> + }
> +
> + return sum;
> +}
> +
> +static uint16_t
> +icmpv6_cksum(struct in6_addr* src_ip, struct libnet_in6_addr* dst_ip, char* payload, int payload_len)
> +{
> + uint32_t sum = 0;
> + uint16_t val = 0;
> +
> + /* IPv6 pseudo header */
> + sum += cksum_sum( src_ip->s6_addr16, 16, 1 );
> + sum += cksum_sum( (uint16_t *)dst_ip, 16, 1 );
> + val = payload_len + (2 * sizeof(uint32_t));
> + sum += cksum_sum( &val, 2, 0 );
> + val = 58;
> + sum += cksum_sum( &val, 2, 0 );
> +
> + /* ICMPv6 packet */
> + val = 0x8800;
> + sum += cksum_sum( &val, 2, 0 );
> + val = 0x2000;
> + sum += cksum_sum( &val, 2, 0 );
> + sum += cksum_sum( (uint16_t *)payload, payload_len, 1 );
> +
> + /* perform 16-bit one's complement of sum */
> + sum = (sum >> 16) + (sum & 0xffff);
> + sum += (sum >> 16);
> + val = ~sum;
> +
> + return val;
> +}
> +
> /* Send an unsolicited advertisement packet
> * Please refer to rfc2461
> */
> @@ -416,7 +468,7 @@
>
> libnet_seed_prand(l);
> /* 0x2000: RSO */
> - libnet_build_icmpv4_echo(136,0,0,0x2000,0,(u_int8_t *)payload
> + libnet_build_icmpv4_echo(136,0,icmpv6_cksum(src_ip,&dst_ip,payload,sizeof(payload)),0x2000,0,(u_int8_t *)payload
> ,sizeof(payload), l, LIBNET_PTAG_INITIALIZER);
> libnet_build_ipv6(0,0,LIBNET_ICMPV6_H + sizeof(payload),IPPROTO_ICMP6,
> 255,*(struct libnet_in6_addr*)src_ip,

> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev [at] lists
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/

_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


Pascal.Andre at hp

Jun 5, 2009, 5:29 AM

Post #2 of 6 (1176 views)
Permalink
Re: Checksum not computed in ICMPv6 neighbor advertisement [In reply to]

Hi Dejan,

Thanks for your quick reply.

Sorry, I never tried with a mask of 128.

Regards,
Pascal


> -----Original Message-----
> From: linux-ha-dev-bounces [at] lists
> [mailto:linux-ha-dev-bounces [at] lists] On Behalf Of
> Dejan Muhamedagic
> Sent: Friday, June 05, 2009 1:09 PM
> To: High-Availability Linux Development List
> Subject: Re: [Linux-ha-dev] Checksum not computed in ICMPv6
> neighbor advertisement
>
> Hi Andre,
>
> On Fri, Jun 05, 2009 at 09:34:37AM +0000, Andre, Pascal wrote:
> > Hi,
> >
> > On an Active/Standby platform (using Linux-HA 2.1.4 RHEL5, in my
> > case), when a fail-over/switch-over is initiated and
> standby machine
> > takes over the virtual IP (IPv6), IPv6addr broadcasts an ICMPv6
> > neighbor advertisement message.
> >
> > Unfortunately, this ICMPv6 message has its checksum field set to 0
> > (i.e. not computed). The message is thus discarded by recipients.
> >
> > Maybe this computation should be done by libnet itself.
> > Unfortunately, without much time to investigate libnet, I've added
> > code in resources/OCF/IPv6addr.c in order to compute the
> checksum and
> > provide the result to libnet (as a parameter).
>
> Applied. Many thanks for the patch.
>
> BTW, a user recently complained on the user mailing list
> about not being able to run IPv6addr with mask 128. Did you
> ever experience that? I looked at the code a bit, couldn't
> find a problem. Oh, and it only prints the Generic error
> (exit code 1) and one couldn't figure out anything from the strace.
>
> Cheers,
>
> Dejan
>
> > Regards,
> > Pascal ANDRE
> >
> >
> > --- IPv6addr.c.old 2009-04-30 10:15:16.000000000 +0200
> > +++ IPv6addr.c 2009-04-30 11:45:43.000000000 +0200
> > @@ -381,6 +381,58 @@
> > return OCF_NOT_RUNNING;
> > }
> >
> > +/* compute ICMPv6 checksum */
> > +static uint32_t
> > +cksum_sum(uint16_t *addr, int len, int ntoh) {
> > + uint16_t * w = addr;
> > + uint16_t ret = 0;
> > + uint32_t sum = 0;
> > +
> > + while (len > 1) {
> > + ret = *w++;
> > + if (ntoh) ret = ntohs(ret);
> > + sum += ret;
> > + len -= 2;
> > + }
> > +
> > + if (len == 1) {
> > + *(unsigned char *) (&ret) = *(unsigned char *) w; sum += ret; }
> > +
> > + return sum;
> > +}
> > +
> > +static uint16_t
> > +icmpv6_cksum(struct in6_addr* src_ip, struct
> libnet_in6_addr* dst_ip,
> > +char* payload, int payload_len) { uint32_t sum = 0;
> uint16_t val =
> > +0;
> > +
> > + /* IPv6 pseudo header */
> > + sum += cksum_sum( src_ip->s6_addr16, 16, 1 ); sum += cksum_sum(
> > + (uint16_t *)dst_ip, 16, 1 ); val = payload_len + (2 *
> > + sizeof(uint32_t)); sum += cksum_sum( &val, 2, 0 ); val =
> 58; sum +=
> > + cksum_sum( &val, 2, 0 );
> > +
> > + /* ICMPv6 packet */
> > + val = 0x8800;
> > + sum += cksum_sum( &val, 2, 0 );
> > + val = 0x2000;
> > + sum += cksum_sum( &val, 2, 0 );
> > + sum += cksum_sum( (uint16_t *)payload, payload_len, 1 );
> > +
> > + /* perform 16-bit one's complement of sum */ sum = (sum >> 16) +
> > + (sum & 0xffff); sum += (sum >> 16); val = ~sum;
> > +
> > + return val;
> > +}
> > +
> > /* Send an unsolicited advertisement packet
> > * Please refer to rfc2461
> > */
> > @@ -416,7 +468,7 @@
> >
> > libnet_seed_prand(l);
> > /* 0x2000: RSO */
> > - libnet_build_icmpv4_echo(136,0,0,0x2000,0,(u_int8_t *)payload
> > +
> libnet_build_icmpv4_echo(136,0,icmpv6_cksum(src_ip,&dst_ip,payload,s
> > + izeof(payload)),0x2000,0,(u_int8_t *)payload
> > ,sizeof(payload), l, LIBNET_PTAG_INITIALIZER);
> > libnet_build_ipv6(0,0,LIBNET_ICMPV6_H +
> sizeof(payload),IPPROTO_ICMP6,
> > 255,*(struct libnet_in6_addr*)src_ip,
>
> > _______________________________________________________
> > Linux-HA-Dev: Linux-HA-Dev [at] lists
> > http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> > Home Page: http://linux-ha.org/
>
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev [at] lists
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
>
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


keisuke.mori+ha at gmail

Jun 7, 2009, 5:14 PM

Post #3 of 6 (1153 views)
Permalink
Re: Checksum not computed in ICMPv6 neighbor advertisement [In reply to]

Hi,

2009/6/5 Dejan Muhamedagic <dejanmm [at] fastmail>:
> Hi Andre,
>
> On Fri, Jun 05, 2009 at 09:34:37AM +0000, Andre, Pascal wrote:
>> Hi,
>>
>> On an Active/Standby platform (using Linux-HA 2.1.4 RHEL5, in
>> my case), when a fail-over/switch-over is initiated and standby
>> machine takes over the virtual IP (IPv6), IPv6addr broadcasts
>> an ICMPv6 neighbor advertisement message.
>>
>> Unfortunately, this ICMPv6 message has its checksum field set
>> to 0 (i.e. not computed). The message is thus discarded by
>> recipients.
>>
>> Maybe this computation should be done by libnet itself.
>> Unfortunately, without much time to investigate libnet, I've
>> added code in resources/OCF/IPv6addr.c in order to compute the
>> checksum and provide the result to libnet (as a parameter).
>
> Applied. Many thanks for the patch.

That problem was already fixed in:
http://developerbugs.linux-foundation.org/show_bug.cgi?id=2034
so the patch should not be necessary.

--
Keisuke MORI
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


dejanmm at fastmail

Jun 8, 2009, 2:04 AM

Post #4 of 6 (1150 views)
Permalink
Re: Checksum not computed in ICMPv6 neighbor advertisement [In reply to]

Hi Mori-san,

On Mon, Jun 08, 2009 at 09:14:55AM +0900, Keisuke MORI wrote:
> Hi,
>
> 2009/6/5 Dejan Muhamedagic <dejanmm [at] fastmail>:
> > Hi Andre,
> >
> > On Fri, Jun 05, 2009 at 09:34:37AM +0000, Andre, Pascal wrote:
> >> Hi,
> >>
> >> On an Active/Standby platform (using Linux-HA 2.1.4 RHEL5, in
> >> my case), when a fail-over/switch-over is initiated and standby
> >> machine takes over the virtual IP (IPv6), IPv6addr broadcasts
> >> an ICMPv6 neighbor advertisement message.
> >>
> >> Unfortunately, this ICMPv6 message has its checksum field set
> >> to 0 (i.e. not computed). The message is thus discarded by
> >> recipients.
> >>
> >> Maybe this computation should be done by libnet itself.
> >> Unfortunately, without much time to investigate libnet, I've
> >> added code in resources/OCF/IPv6addr.c in order to compute the
> >> checksum and provide the result to libnet (as a parameter).
> >
> > Applied. Many thanks for the patch.
>
> That problem was already fixed in:
> http://developerbugs.linux-foundation.org/show_bug.cgi?id=2034
> so the patch should not be necessary.

Oh, forgot about that one. Many thanks for spotting this. I guess
that Andre didn't have the latest version.

Andre:

Can you please check the latest IPv6addr without your checksum
patch?

Thanks,

Dejan

> --
> Keisuke MORI
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev [at] lists
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


Pascal.Andre at hp

Jun 8, 2009, 7:12 AM

Post #5 of 6 (1145 views)
Permalink
Re: Checksum not computed in ICMPv6 neighbor advertisement [In reply to]

Hi Dejan,

I've tested as you suggested. Obviously, successfully. Sorry for having missed this fix.
Regards,

Pascal ANDRE


> -----Original Message-----
> From: Dejan Muhamedagic [mailto:dejanmm [at] fastmail]
> Sent: Monday, June 08, 2009 11:04 AM
> To: High-Availability Linux Development List
> Cc: Andre, Pascal
> Subject: Re: [Linux-ha-dev] Checksum not computed in ICMPv6
> neighbor advertisement
>
> Hi Mori-san,
>
> On Mon, Jun 08, 2009 at 09:14:55AM +0900, Keisuke MORI wrote:
> > Hi,
> >
> > 2009/6/5 Dejan Muhamedagic <dejanmm [at] fastmail>:
> > > Hi Andre,
> > >
> > > On Fri, Jun 05, 2009 at 09:34:37AM +0000, Andre, Pascal wrote:
> > >> Hi,
> > >>
> > >> On an Active/Standby platform (using Linux-HA 2.1.4 RHEL5, in my
> > >> case), when a fail-over/switch-over is initiated and standby
> > >> machine takes over the virtual IP (IPv6), IPv6addr broadcasts an
> > >> ICMPv6 neighbor advertisement message.
> > >>
> > >> Unfortunately, this ICMPv6 message has its checksum
> field set to 0
> > >> (i.e. not computed). The message is thus discarded by recipients.
> > >>
> > >> Maybe this computation should be done by libnet itself.
> > >> Unfortunately, without much time to investigate libnet,
> I've added
> > >> code in resources/OCF/IPv6addr.c in order to compute the
> checksum
> > >> and provide the result to libnet (as a parameter).
> > >
> > > Applied. Many thanks for the patch.
> >
> > That problem was already fixed in:
> > http://developerbugs.linux-foundation.org/show_bug.cgi?id=2034
> > so the patch should not be necessary.
>
> Oh, forgot about that one. Many thanks for spotting this. I
> guess that Andre didn't have the latest version.
>
> Andre:
>
> Can you please check the latest IPv6addr without your checksum patch?
>
> Thanks,
>
> Dejan
>
> > --
> > Keisuke MORI
> > _______________________________________________________
> > Linux-HA-Dev: Linux-HA-Dev [at] lists
> > http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> > Home Page: http://linux-ha.org/
>
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


dejanmm at fastmail

Jun 8, 2009, 10:14 AM

Post #6 of 6 (1148 views)
Permalink
Re: Checksum not computed in ICMPv6 neighbor advertisement [In reply to]

Hi,

On Mon, Jun 08, 2009 at 02:12:25PM +0000, Andre, Pascal wrote:
> Hi Dejan,
>
> I've tested as you suggested. Obviously, successfully. Sorry
> for having missed this fix.

Yep, me too :) I'll revert the patch now.

Thanks,

Dejan

> Regards,
>
> Pascal ANDRE
>
>
> > -----Original Message-----
> > From: Dejan Muhamedagic [mailto:dejanmm [at] fastmail]
> > Sent: Monday, June 08, 2009 11:04 AM
> > To: High-Availability Linux Development List
> > Cc: Andre, Pascal
> > Subject: Re: [Linux-ha-dev] Checksum not computed in ICMPv6
> > neighbor advertisement
> >
> > Hi Mori-san,
> >
> > On Mon, Jun 08, 2009 at 09:14:55AM +0900, Keisuke MORI wrote:
> > > Hi,
> > >
> > > 2009/6/5 Dejan Muhamedagic <dejanmm [at] fastmail>:
> > > > Hi Andre,
> > > >
> > > > On Fri, Jun 05, 2009 at 09:34:37AM +0000, Andre, Pascal wrote:
> > > >> Hi,
> > > >>
> > > >> On an Active/Standby platform (using Linux-HA 2.1.4 RHEL5, in my
> > > >> case), when a fail-over/switch-over is initiated and standby
> > > >> machine takes over the virtual IP (IPv6), IPv6addr broadcasts an
> > > >> ICMPv6 neighbor advertisement message.
> > > >>
> > > >> Unfortunately, this ICMPv6 message has its checksum
> > field set to 0
> > > >> (i.e. not computed). The message is thus discarded by recipients.
> > > >>
> > > >> Maybe this computation should be done by libnet itself.
> > > >> Unfortunately, without much time to investigate libnet,
> > I've added
> > > >> code in resources/OCF/IPv6addr.c in order to compute the
> > checksum
> > > >> and provide the result to libnet (as a parameter).
> > > >
> > > > Applied. Many thanks for the patch.
> > >
> > > That problem was already fixed in:
> > > http://developerbugs.linux-foundation.org/show_bug.cgi?id=2034
> > > so the patch should not be necessary.
> >
> > Oh, forgot about that one. Many thanks for spotting this. I
> > guess that Andre didn't have the latest version.
> >
> > Andre:
> >
> > Can you please check the latest IPv6addr without your checksum patch?
> >
> > Thanks,
> >
> > Dejan
> >
> > > --
> > > Keisuke MORI
> > > _______________________________________________________
> > > Linux-HA-Dev: Linux-HA-Dev [at] lists
> > > http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> > > Home Page: http://linux-ha.org/
> >
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev [at] lists
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Linux-HA dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.