Subject: [Hipsec] draft-ietf-hip-native-api-04 issues [1/3]: sockaddr_hip{}.

From: YOSHIFUJI Hideaki / 吉藤英明<[email-masked]>
Date: Wed, 07 May 2008 17:48:54 +0900 (JST)

Hello.

I found several issues in draft-ietf-hip-native-api-04 Section 4.1.

   The sockets API extensions define a new protocol family, PF_HIP, and
   a new address family, AF_HIP.  The AF_HIP and PF_HIP are aliases to
   each other.  The use of the PF_HIP constant is mandatory with the
   socket() function when application uses the native HIP APIs.  The
   application gives the PF_HIP constant as the first argument (domain)
   to the socket() function.  The system returns a positive integer
   representing a socket descriptor when the system supports HIP.
   Otherwise, the system returns -1 and sets errno to EAFNOSUPPORT.

   A HIT is contained in a sockaddr_hip structure, which is shown in
   Figure 2 in 4.4BSD format.  The family of the socket, ship_family, is
   set to PF_HIP.  The port number ship_port is two octets and the
   ship_hit is 16 octets.

      #include <netinet/in.h>

      typedef struct in6_addr hip_hit_t;

      struct sockaddr_hip {
              uint8_t        ship_len;
              uint8_t        ship_family;
              uint16_t       ship_port;
              uint64_t       ship_flags;
              hip_hit_t      ship_hit;
              uint8_t        reserved[16];
      }

7 issues.

1) There is no discussion about sockaddr_hip{} on 4.3BSD-like systems,
   which has no XXX_len fields.
   Please see sockaddr_in6{} definitions in RFC3493.

2) Do we really need 64bit "flags" field?
   If yes, uint64_t should explicitly be aligned on 64bit boundary.
   Otherwise, implementation will need nasty "compat" layer on 64bit
   systems for 32bit applications, because of different alignment
   requirements between 64bit and 32bit mode.
   Note: sockaddr_in6{} does not have this issue.

3) "reserved" should come with "ship_" prefix as we do in sockaddr_in{}.

4) Address and port should be in network byte order.

5) Use sa_family_t for address family.  Use in_port_t for port number.

6) Please use AF_HIP instead.

7) ";" is missing at the end of structure definition.

I'd propose the following text.

   The sockets API extensions define a new protocol family, PF_HIP, and
   a new address family, AF_HIP.   The AF_HIP and PF_HIP are aliases to
   each other.  These definition shall be defined as a result of including
   <sys/socket.h>.

   The use of the PF_HIP constant is mandatory with the socket()
   function when application uses the native HIP APIs.  The
   application gives the PF_HIP constant as the first argument (domain)
   to the socket() function.  The system returns a positive integer
   representing a socket descriptor when the system supports HIP.
   Otherwise, the system returns -1 and sets errno to EAFNOSUPPORT.

   A HIT is contained in a sockaddr_hip structure, which is shown in
   Figure 2 in 4.3BSD format.  The family of the socket, ship_family, is
   set to AF_HIP.  The port number ship_port is two octets in network byte
   order. and the ship_hit is 16 octets in network byte order.

         #include <netinet/in.h>

         typedef struct in6_addr hip_hit_t;

         struct sockaddr_hip {
                  sa_family_t    ship_family;
                  in_port_t      ship_port;
                  uint32_t       ship_pad;
                  uint64_t       ship_flags;
                  hip_hit_t      ship_hit;
                  uint8_t        ship_reserved[16];
         };

   An implementation may have extra member(s) in this structure.

Regards,

-- 
YOSHIFUJI Hideaki @ USAGI Project  <[email-masked]>
GPG-FP  : 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA
_______________________________________________
Hipsec mailing list
[email-masked]
https://www.ietf.org/mailman/listinfo/hipsec