ipv6 atomic draft - rfc6946 diff

2013-08-22 Thread Loganaden Velvindron
Hi,

The draft is now an RFC.
Perhaps the code should reflect those changes as well ?


Index: sys/netinet6/frag6.c
===
RCS file: /cvs/src/sys/netinet6/frag6.c,v
retrieving revision 1.47
diff -u -p -r1.47 frag6.c
--- sys/netinet6/frag6.c11 Jun 2013 18:15:54 -  1.47
+++ sys/netinet6/frag6.c22 Aug 2013 06:36:35 -
@@ -236,7 +236,7 @@ frag6_input(struct mbuf **mp, int *offp,
offset += sizeof(struct ip6_frag);
 
/*
-* draft-gont-6man-ipv6-atomic-fragments-00:  A host that receives an
+* RFC6946:  A host that receives an
 * IPv6 packet which includes a Fragment Header with the Fragment
 * Offset equal to 0 and the M bit equal to 0 MUST process such
 * packet in isolation from any other packets/fragments.



Re: ipv6 atomic draft - rfc6946 diff

2013-08-22 Thread Peter Hessler
Have you verified that we follow the RFC, and not just -00 of the draft?


On 2013 Aug 21 (Wed) at 23:40:12 -0700 (-0700), Loganaden Velvindron wrote:
:Hi,
:
:The draft is now an RFC.
:Perhaps the code should reflect those changes as well ?
:
:
:Index: sys/netinet6/frag6.c
:===
:RCS file: /cvs/src/sys/netinet6/frag6.c,v
:retrieving revision 1.47
:diff -u -p -r1.47 frag6.c
:--- sys/netinet6/frag6.c11 Jun 2013 18:15:54 -  1.47
:+++ sys/netinet6/frag6.c22 Aug 2013 06:36:35 -
:@@ -236,7 +236,7 @@ frag6_input(struct mbuf **mp, int *offp,
:offset += sizeof(struct ip6_frag);
: 
:/*
:-* draft-gont-6man-ipv6-atomic-fragments-00:  A host that receives an
:+* RFC6946:  A host that receives an
: * IPv6 packet which includes a Fragment Header with the Fragment
: * Offset equal to 0 and the M bit equal to 0 MUST process such
: * packet in isolation from any other packets/fragments.
:

-- 
It's better to be wanted for murder than not to be wanted at all.
-- Marty Winch



Re: ipv6 atomic draft - rfc6946 diff

2013-08-22 Thread Loganaden Velvindron
On Thu, Aug 22, 2013 at 08:53:50AM +0200, Peter Hessler wrote:
 Have you verified that we follow the RFC, and not just -00 of the draft?
 
The table of OSes were updated and some terms were changed:

   A host that receives an IPv6 packet that includes a Fragment
  Header with the Fragment Offset equal to 0 and the M flag
  equal to 0 MUST process that packet in isolation from any other
  packets/fragments, even if such packets/fragments contain the same
  set {IPv6 Source Address, IPv6 Destination Address, Fragment
  Identification}.  A received atomic fragment should be
  reassembled from the contents of that sole fragment.
bit-flag, and some clarifications added.



 On 2013 Aug 21 (Wed) at 23:40:12 -0700 (-0700), Loganaden Velvindron wrote:
 :Hi,
 :
 :The draft is now an RFC.
 :Perhaps the code should reflect those changes as well ?
 :
 :
 :Index: sys/netinet6/frag6.c
 :===
 :RCS file: /cvs/src/sys/netinet6/frag6.c,v
 :retrieving revision 1.47
 :diff -u -p -r1.47 frag6.c
 :--- sys/netinet6/frag6.c11 Jun 2013 18:15:54 -  1.47
 :+++ sys/netinet6/frag6.c22 Aug 2013 06:36:35 -
 :@@ -236,7 +236,7 @@ frag6_input(struct mbuf **mp, int *offp,
 :offset += sizeof(struct ip6_frag);
 : 
 :/*
 :-* draft-gont-6man-ipv6-atomic-fragments-00:  A host that receives an
 :+* RFC6946:  A host that receives an
 : * IPv6 packet which includes a Fragment Header with the Fragment
 : * Offset equal to 0 and the M bit equal to 0 MUST process such
 : * packet in isolation from any other packets/fragments.
 :
 
 -- 
 It's better to be wanted for murder than not to be wanted at all.
   -- Marty Winch



Don't iterate over in_ifaddr in in_control()

2013-08-22 Thread Martin Pieuchot
On 21/08/13(Wed) 16:29, Martin Pieuchot wrote:
 Now that IPv4 addresses stay on the interface list even if something 
 bad occurs during in_ifinit(), I'd like to make in_control() look for
 the previously configured addresses on the interface list rather than
 on the global list.

New try, with the correct diff this time ;)

ok?

Index: netinet/in.c
===
RCS file: /home/ncvs/src/sys/netinet/in.c,v
retrieving revision 1.83
diff -u -p -r1.83 in.c
--- netinet/in.c19 Aug 2013 08:45:34 -  1.83
+++ netinet/in.c22 Aug 2013 08:54:53 -
@@ -192,6 +192,7 @@ int
 in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp)
 {
struct ifreq *ifr = (struct ifreq *)data;
+   struct ifaddr *ifa; \
struct in_ifaddr *ia = NULL;
struct in_aliasreq *ifra = (struct in_aliasreq *)data;
struct sockaddr_in oldaddr;
@@ -215,21 +216,24 @@ in_control(struct socket *so, u_long cmd
 * Find address for this interface, if it exists.
 */
if (ifp)
-   TAILQ_FOREACH(ia, in_ifaddr, ia_list)
-   if (ia-ia_ifp == ifp)
+   TAILQ_FOREACH(ifa, ifp-if_addrlist, ifa_list)
+   if (ifa-ifa_addr-sa_family == AF_INET) {
+   ia = ifatoia(ifa);
break;
+   }
 
switch (cmd) {
 
case SIOCAIFADDR:
case SIOCDIFADDR:
if (ifra-ifra_addr.sin_family == AF_INET)
-   for (; ia != NULL; ia = TAILQ_NEXT(ia, ia_list)) {
-   if (ia-ia_ifp == ifp 
-   ia-ia_addr.sin_addr.s_addr ==
+   for (; ifa != NULL; ifa = TAILQ_NEXT(ifa, ifa_list)) {
+   if ((ifa-ifa_addr-sa_family == AF_INET) 
+   ifatoia(ifa)-ia_addr.sin_addr.s_addr ==
ifra-ifra_addr.sin_addr.s_addr)
-   break;
+   break;
}
+   ia = ifatoia(ifa);
if (cmd == SIOCDIFADDR  ia == NULL)
return (EADDRNOTAVAIL);
/* FALLTHROUGH */
@@ -271,17 +275,14 @@ in_control(struct socket *so, u_long cmd
case SIOCGIFDSTADDR:
case SIOCGIFBRDADDR:
if (ia  satosin(ifr-ifr_addr)-sin_addr.s_addr) {
-   struct in_ifaddr *ia2;
-
-   for (ia2 = ia; ia2 != NULL;
-   ia2 = TAILQ_NEXT(ia2, ia_list)) {
-   if (ia2-ia_ifp == ifp 
-   ia2-ia_addr.sin_addr.s_addr ==
-   satosin(ifr-ifr_addr)-sin_addr.s_addr)
+   for (; ifa != NULL; ifa = TAILQ_NEXT(ifa, ifa_list)) {
+   if ((ifa-ifa_addr-sa_family == AF_INET) 
+   ifatoia(ifa)-ia_addr.sin_addr.s_addr ==
+   satosin(ifr-ifr_addr)-sin_addr.s_addr) {
+   ia = ifatoia(ifa);
break;
+   }
}
-   if (ia2  ia2-ia_ifp == ifp)
-   ia = ia2;
}
if (ia == NULL)
return (EADDRNOTAVAIL);



Re: ipv6 atomic draft - rfc6946 diff

2013-08-22 Thread Claudio Jeker
On Thu, Aug 22, 2013 at 08:53:50AM +0200, Peter Hessler wrote:
 Have you verified that we follow the RFC, and not just -00 of the draft?
 

The RFC actually mentions that OpenBSD-current as of 2012 is following the
specification so I think this is OK.

 
 On 2013 Aug 21 (Wed) at 23:40:12 -0700 (-0700), Loganaden Velvindron wrote:
 :Hi,
 :
 :The draft is now an RFC.
 :Perhaps the code should reflect those changes as well ?
 :
 :
 :Index: sys/netinet6/frag6.c
 :===
 :RCS file: /cvs/src/sys/netinet6/frag6.c,v
 :retrieving revision 1.47
 :diff -u -p -r1.47 frag6.c
 :--- sys/netinet6/frag6.c11 Jun 2013 18:15:54 -  1.47
 :+++ sys/netinet6/frag6.c22 Aug 2013 06:36:35 -
 :@@ -236,7 +236,7 @@ frag6_input(struct mbuf **mp, int *offp,
 :offset += sizeof(struct ip6_frag);
 : 
 :/*
 :-* draft-gont-6man-ipv6-atomic-fragments-00:  A host that receives an
 :+* RFC6946:  A host that receives an
 : * IPv6 packet which includes a Fragment Header with the Fragment
 : * Offset equal to 0 and the M bit equal to 0 MUST process such
 : * packet in isolation from any other packets/fragments.
 :
 
 -- 
 It's better to be wanted for murder than not to be wanted at all.
   -- Marty Winch
 

-- 
:wq Claudio



Re: openbsd ioctl fix (in6.c)

2013-08-22 Thread Claudio Jeker
On Wed, Aug 21, 2013 at 09:59:56AM -0700, Loganaden Velvindron wrote:
 I'm not sure if applies to OpenBSD as well, but NetBSD
 also disallowed SIOCSIFDSTADDR for ioctl.
 
 http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/netinet6/in6.c?annotate=1.166only_with_tag=MAIN
 
 1.2   itojun374:switch (cmd) {
 1.104 christos  375:/*
 1.105 christos  376: * XXX: Fix me, once we fix SIOCSIFADDR, 
 SIOCIFDSTADDR, etc.
 1.104 christos  377: */
 378:case SIOCSIFADDR:
 1.105 christos  379:case SIOCSIFDSTADDR:
 1.129 cube  380: #ifdef SIOCSIFCONF_X25
 1.106 christos  381:case SIOCSIFCONF_X25:
 1.110 matt  382: #endif
 1.104 christos  383:return EOPNOTSUPP;
 
 If it's indeed the case in OpenBSD, here's a diff:
 
 Index: sys/netinet6/in6.c
 ===
 RCS file: /cvs/src/sys/netinet6/in6.c,v
 retrieving revision 1.117
 diff -u -p -r1.117 in6.c
 --- sys/netinet6/in6.c13 Aug 2013 05:52:25 -  1.117
 +++ sys/netinet6/in6.c21 Aug 2013 15:50:00 -
 @@ -429,8 +429,9 @@ in6_control(struct socket *so, u_long cm
   sa6 = ifr-ifr_addr;
   break;
   case SIOCSIFADDR:
 + case SIOCSIFDSTADDR:
   /*
 -  * Do not pass this ioctl to driver handler since it is not
 +  * Do not pass those ioctl to driver handler since they are not
* properly setup. Instead just error out.
*/
   return (EOPNOTSUPP);
 
Are any of our driver ioctl handlers handling SIOCSIFDSTADDR? I don't
think so but I think this could be just extra safety and should therefor
be commited.

-- 
:wq Claudio