[Openswan dev] LELEM, 0ULL
mladen-g at rogers.com
mladen-g at rogers.com
Tue Jun 1 18:26:17 CEST 2004
Hi all,
Thanks for the help (Michael Richardson in particular) with my earlier issue, I have a better idea of what's going on now...
However, I've managed to run into another obstacle. I edited the Pluto code to generate a different I1 message, and while the message is generated fine, it is rejected by the other end due to unexpected payloads (which is logical).
When I was trying to remove this payload check in the code, I ran into a problem in process_packet(...) in the file demux.c:
---------------------------------
{
lset_t s = LELEM(np);
if (LDISJOINT(s
, needed | smc->opt_payloads| LELEM(ISAKMP_NEXT_N) | LELEM(ISAKMP_NEXT_D)))
{
loglog(RC_LOG_SERIOUS, "%smessage ignored because it "
"contains an unexpected payload type (%s)"
, excuse, enum_show(&payload_names, np));
SEND_NOTIFICATION(INVALID_PAYLOAD_TYPE);
return;
}
needed &= ~s;
}
--------------------------
My problem is quite simply that I don't have any idea what this does, and how it checks for expected payloads. I've never seen code like this before (I'm currently a university student, and the course I took in C didn't go nearly into this kind of depth). Could anyone give me a brief explanation of the logic here, or maybe point me to a resource that would explain it?
The definitions for LELEM and LDISJOINT are in constants.h and say:
--------------------------
typedef unsigned long long lset_t;
#define LEMPTY 0ULL
#define LELEM(opt) (1ULL << (opt))
#define LRANGE(lwb, upb) LRANGES(LELEM(lwb), LELEM(upb))
#define LRANGES(first, last) (last - first + last)
#define LHAS(set, elem) ((LELEM(elem) & (set)) != LEMPTY)
#define LIN(subset, set) (((subset) & (set)) == (subset))
#define LDISJOINT(a, b) (((a) & (b)) == LEMPTY)
--------------------------
So what is 0ULL and 1ULL? Maybe values 0 and 1 in unsigned long long field size?
Thanks very much for your patience,
Mladen
1
More information about the Dev
mailing list