[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(usagi-users 01096) IPv6 header definition



Hello,

I've got last USAGI snaps

usagi-20011210-linux22.tar.bz2
usagi-20011210-linux24.tar.bz2

and it was a surprise for me to see the different definition
of 'struct ipv6hdr' in the kernel/linux22/include/linux/ipv6.h and
kernel/linux24/include/linux/ipv6.h files. In first case:

------------------
struct ipv6hdr {
#if defined(__LITTLE_ENDIAN_BITFIELD)
        __u8                    priority:4,
                                version:4;
#elif defined(__BIG_ENDIAN_BITFIELD)
        __u8                    version:4,
                                priority:4;
#else
#error  "Please fix <asm/byteorder.h>"
#endif
        __u8                    flow_lbl[3];

        __u16                   payload_len;
        __u8                    nexthdr;
        __u8                    hop_limit;

        struct  in6_addr        saddr;
        struct  in6_addr        daddr;
};
------------------

and in second:

------------------
struct ipv6hdr {
#if defined(__LITTLE_ENDIAN_BITFIELD)
        __u8                    tclass1:4,
                                version:4;
#elif defined(__BIG_ENDIAN_BITFIELD)
        __u8                    version:4,
                                tclass1:4;
#else
#error  "Please fix <asm/byteorder.h>"
#endif
        __u8                    tclass2_flow[3];

        __u16                   payload_len;
        __u8                    nexthdr;
        __u8                    hop_limit;

        struct  in6_addr        saddr;
        struct  in6_addr        daddr;
};

---------------------

1. The IPv6 header's field Traffic Class is named 'priority' for linux22
and 'tclass1' for linux24.
2. The IPv6 header's field Flow Label us named 'flow_lbl' and 'tclass2_flow'
accordingly.

All other fields have identical names. Why?

But it is not a big problem. The field Flow Label has 20 bits lenght as
specified by RFC 2460. In the struct ipv6hdr Flow Label has 24 bits.
If an implemention will use the struct ipv6hdr definition from ipv6.h,
it will be need to change some code related with Flow Label in the future.

I've greped 'tclass2_flow' and 'tclass1' strings in the linux24
usagi codes. Those strings are used only in three files (in 7 lines):
-------------
[grn@rabbit linux24]$ grep -r tclass2_flow *
include/linux/ipv6.h:   __u8                    tclass2_flow[3];
net/ipv6/datagram.c:            int tclass = ((ipv6h->tclass1 << 4) |
(ipv6h->tclass2_flow[0] >> 4)) & 0xff;
net/ipv6/ipsec6/ipsec6_utils.c:        refs->ipv6hdr->tclass2_flow[0]=0;
net/ipv6/ipsec6/ipsec6_utils.c:        refs->ipv6hdr->tclass2_flow[1]=0;
net/ipv6/ipsec6/ipsec6_utils.c:        refs->ipv6hdr->tclass2_flow[2]=0;
net/ipv6/mobile_ip6/ah.c:       memset(buff->nh.ipv6h->tclass2_flow, 0, 3);

[grn@rabbit linux24]$ grep -r tclass1 *
include/linux/ipv6.h:   __u8                    tclass1:4,
include/linux/ipv6.h:                           tclass1:4;
net/ipv6/datagram.c:            int tclass = ((ipv6h->tclass1 << 4) |
(ipv6h->tclass2_flow[0] >> 4)) & 0xff;
net/ipv6/ipsec6/ipsec6_utils.c:        refs->ipv6hdr->tclass1=0;
net/ipv6/mobile_ip6/ah.c:       buff->nh.ipv6h->tclass1 = 0;
---------------

In linux22 the string 'flow_lbl' isn't used, the string 'priority' has many
matches as very popular word in the code, but I belive it's used only
in several files as field of struct ipv6hdr.

May be it's a time to change IPv6 header names in ipv6.h in both
linux22 and linux24 to identical names. And to set right lenght
for Flow Label field.

May be I can do this if someone would like to point me to the
problems with it? Or may be usagi's developers plan to do
some changes to resolve this problem?

We are doing implementations of SIIT and NAT-PT for Linux22/24,
and it's very interesting for as.

Regards,

Grigory Klyuchnikov, System Engineer,
Institute for System Programming
Russian Academy of Sciences