From 23a5e4bcdcf7d3fef9aaa6c4a20f9f08f22ca9a6 Mon Sep 17 00:00:00 2001 From: Chia-chi Yeh Date: Mon, 13 Jun 2011 16:14:49 -0700 Subject: [PATCH] VPN: tolerate duplicated routes. Change-Id: I0f9efa8c3af3d4859358438745a5cd2c4ad376ca --- services/jni/com_android_server_connectivity_Vpn.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/jni/com_android_server_connectivity_Vpn.cpp b/services/jni/com_android_server_connectivity_Vpn.cpp index 33f241f4c7228..b3d38dc65b248 100644 --- a/services/jni/com_android_server_connectivity_Vpn.cpp +++ b/services/jni/com_android_server_connectivity_Vpn.cpp @@ -224,7 +224,7 @@ static int set_routes(const char *name, int index, const char *routes) if (memcmp(&rt6.rtmsg_gateway, &in6addr_any, sizeof(in6addr_any))) { rt6.rtmsg_flags |= RTF_GATEWAY; } - if (ioctl(inet6, SIOCADDRT, &rt6)) { + if (ioctl(inet6, SIOCADDRT, &rt6) && errno != EEXIST) { count = (errno == EINVAL) ? BAD_ARGUMENT : SYSTEM_ERROR; break; } @@ -242,7 +242,7 @@ static int set_routes(const char *name, int index, const char *routes) if (*as_in_addr(&rt4.rt_gateway)) { rt4.rt_flags |= RTF_GATEWAY; } - if (ioctl(inet4, SIOCADDRT, &rt4)) { + if (ioctl(inet4, SIOCADDRT, &rt4) && errno != EEXIST) { count = (errno == EINVAL) ? BAD_ARGUMENT : SYSTEM_ERROR; break; }