[Openswan dev] 2.6.25, satype 0 conversion to proto failed for msg_type 14

Yair Elharrar Yair.Elharrar at audiocodes.com
Mon May 17 00:44:40 EDT 2010


I think there's something wrong with the esatype/satype conversion in kernel_pfkey.c.
Please review this patch:

diff -ur openswan-2.6.25/programs/pluto/kernel_pfkey.c openswan-2.6.25.yair/programs/pluto/kernel_pfkey.c
--- openswan-2.6.25/programs/pluto/kernel_pfkey.c       2010-03-21 19:39:35.000000000 +0200
+++ openswan-2.6.25.yair/programs/pluto/kernel_pfkey.c  2010-05-17 07:22:00.856954727 +0300
@@ -1284,6 +1290,30 @@
     }
 }

+enum eroute_type satype2esatype(unsigned int satype)
+{
+       switch(satype)
+       {
+       case K_SADB_SATYPE_UNSPEC:
+               return ET_UNSPEC;
+       case K_SADB_SATYPE_AH:
+               return ET_AH;
+       case K_SADB_SATYPE_ESP:
+               return ET_ESP;
+       case K_SADB_X_SATYPE_COMP:
+               return ET_IPCOMP;
+       case K_SADB_X_SATYPE_INT:
+               return ET_INT;
+       case K_SADB_X_SATYPE_IPIP:
+               return ET_IPIP;
+       default:
+               loglog(RC_LOG_SERIOUS, "bad satype2esatype satype=%d"
+                   , satype);
+                   break;
+       }
+       return 0;
+}
+
 /* install or remove eroute for SA Group */
 bool
 pfkey_sag_eroute(struct state *st, struct spd_route *sr
@@ -1370,7 +1401,7 @@

     return eroute_connection(sr
                             , inner_spi, inner_proto
-                            , inner_satype, proto_info + i
+                            , satype2esatype(inner_satype), proto_info + i
                             , op, opname);
 }


This email and any files transmitted with it are confidential material. They are intended solely for the use of the designated individual or entity to whom they are addressed. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, use, distribution or copying of this communication is strictly prohibited and may be unlawful.

If you have received this email in error please immediately notify the sender and delete or destroy any copy of this message


More information about the Dev mailing list