Semantics of current lifetime in IPsec SA

2006-02-21 Thread Kristian Slavov

Hi,

I noticed that the SA's curlft-usetime is only updated once (time of the 
first packet). Is this the intended behaviour, or should it be the time 
the SA was last used? SPs, on the other hand, are constantly updated as 
packets flow.


Tested on 2.6.15.2.

BR,
--
Krisu
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] IPv6 address autoconfiguration does not work after device down/up cycle

2006-02-09 Thread Kristian Slavov

Kristian Slavov wrote:

Hi,

The following patch seems to get the work done. Patch is against 2.6.15.3.



Here's the signed-off tag I forgot to add, should that matter anymore.

Signed-off-by: Kristian Slavov [EMAIL PROTECTED]

BR,
--
Krisu
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Fix IPv6 address deletion

2005-12-21 Thread Kristian Slavov

Hi,

If you add more than one IPv6 address belonging to the same prefix and 
delete the address that was last added, routing table entry for that 
prefix is also deleted.

Tested on 2.6.14.4

To reproduce:
ip addr add 3ffe::1/64 dev eth0
ip addr add 3ffe::2/64 dev eth0
/* wait DAD */
sleep 1
ip addr del 3ffe::2/64 dev eth0
ip -6 route

(route to 3ffe::/64 should be gone)

In ipv6_del_addr(), if ifa == ifp, we set ifa-if_next to NULL, and later 
assign ifap = ifa-if_next, effectively terminating the for-loop.
This prevents us from checking if there are other addresses using the same 
prefix that are valid, and thus resulting in deletion of the prefix.
This applies only if the first entry in idev-addr_list is the address to 
be deleted.


Signed-off-by: Kristian Slavov [EMAIL PROTECTED]

Cheers,
--
Krisu
diff -aur orig/net/ipv6/addrconf.c new/net/ipv6/addrconf.c
--- orig/net/ipv6/addrconf.c2005-12-21 13:46:41.0 +0200
+++ new/net/ipv6/addrconf.c 2005-12-21 13:50:04.0 +0200
@@ -630,8 +630,7 @@
}
 #endif
 
-   for (ifap = idev-addr_list; (ifa=*ifap) != NULL;
-ifap = ifa-if_next) {
+   for (ifap = idev-addr_list; (ifa=*ifap) != NULL;) {
if (ifa == ifp) {
*ifap = ifa-if_next;
__in6_ifa_put(ifp);
@@ -639,6 +638,7 @@
if (!(ifp-flags  IFA_F_PERMANENT) || onlink  0)
break;
deleted = 1;
+   continue;
} else if (ifp-flags  IFA_F_PERMANENT) {
if (ipv6_prefix_equal(ifa-addr, ifp-addr,
  ifp-prefix_len)) {
@@ -662,6 +662,7 @@
}
}
}
+   ifap = ifa-if_next;
}
write_unlock_bh(idev-lock);
 
Only in new/net/ipv6: addrconf.c~


[PATCH] Fix RTNLGRP definitions in rtnetlink.h

2005-12-19 Thread Kristian Slavov

Hi,

I reported a problem and gave hints to the solution, but nobody seemed to 
react. So I prepared a patch against 2.6.14.4.


Tested on 2.6.14.4 with ip monitor addr and with the program attached, 
while adding and removing IPv6 address. Both programs didn't receive any 
messages.
Tested 2.6.14.4 + this patch, and both programs received add and remove 
messages.


Signed-off-by: Kristian Slavov [EMAIL PROTECTED]

Cheers,
--
Krisu
diff -Naur linux-2.6.14.4/include/linux/rtnetlink.h 
linux-2.6.14.4-patched/include/linux/rtnetlink.h
--- linux-2.6.14.4/include/linux/rtnetlink.h2005-12-15 01:50:41.0 
+0200
+++ linux-2.6.14.4-patched/include/linux/rtnetlink.h2005-12-19 
12:30:04.0 +0200
@@ -866,6 +866,7 @@
 #defineRTNLGRP_IPV4_MROUTE RTNLGRP_IPV4_MROUTE
RTNLGRP_IPV4_ROUTE,
 #define RTNLGRP_IPV4_ROUTE RTNLGRP_IPV4_ROUTE
+   RTNLGRP_NOP1,
RTNLGRP_IPV6_IFADDR,
 #define RTNLGRP_IPV6_IFADDRRTNLGRP_IPV6_IFADDR
RTNLGRP_IPV6_MROUTE,
@@ -876,8 +877,11 @@
 #define RTNLGRP_IPV6_IFINFORTNLGRP_IPV6_IFINFO
RTNLGRP_DECnet_IFADDR,
 #define RTNLGRP_DECnet_IFADDR  RTNLGRP_DECnet_IFADDR
+   RTNLGRP_NOP2,
RTNLGRP_DECnet_ROUTE,
 #define RTNLGRP_DECnet_ROUTE   RTNLGRP_DECnet_ROUTE
+   RTNLGRP_NOP3,
+   RTNLGRP_NOP4,
RTNLGRP_IPV6_PREFIX,
 #define RTNLGRP_IPV6_PREFIXRTNLGRP_IPV6_PREFIX
__RTNLGRP_MAX
#include stdio.h
#include stdlib.h
#include sys/socket.h
#include linux/rtnetlink.h
#include errno.h
#include string.h

#define MLEN 1024

int main()
{
	struct sockaddr_nl nlserver;
size_t z;
char *buffer;
	int rtsock, k;

	buffer = malloc(MLEN);
if (!buffer)
return 0;

	memset(buffer, 0, MLEN);
	memset(nlserver, 0, sizeof(nlserver));

	nlserver.nl_family = AF_NETLINK;
	nlserver.nl_groups = RTMGRP_IPV6_IFADDR;

	rtsock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
if (rtsock  0)
return 0;

	k = bind(rtsock, (struct sockaddr *)nlserver, sizeof(nlserver));
	if (k  0)
return 0;

z = sizeof(nlserver);
	k = recvfrom(rtsock, buffer, MLEN, 0, 
		 (struct sockaddr *)nlserver, z);
	printf(recvfrom() = %d, errno = %d\n,k,errno);
		
	close(rtsock);
return 1;
}