Packet-{Src,Dst}-Port patch to 1.1.0
I had to backpatch the Packet-Dst-Port options into 1.1.0 from the 2.0.0pre0 CVS snapshot for my company, so I thought I'd send this out to the list as well to see if anyone was willing to merge it into the next 1.1.x release. Thanks. --- src/include/radius.h.orig 2006-02-06 15:52:20.000000000 -0500 +++ src/include/radius.h 2006-02-21 16:35:26.000000000 -0500 @@ -183,8 +183,9 @@ #define PW_REWRITE_RULE 1078 #define PW_SQL_GROUP 1079 #define PW_RESPONSE_PACKET_TYPE 1080 -#define PW_PACKET_DST_PORT 1081 #define PW_MS_CHAP_USE_NTLM_AUTH 1082 +#define PW_PACKET_SRC_PORT 1086 +#define PW_PACKET_DST_PORT 1087 /* * Integer Translations diff -urHN src/main/xlat.c src.new/main/xlat.c --- src/main/xlat.c.orig 2006-02-06 15:52:20.000000000 -0500 +++ src/main/xlat.c 2006-02-21 16:36:49.000000000 -0500 @@ -196,6 +196,10 @@ * FIXME: Add SRC/DST IP address! */ if (packet) { + VALUE_PAIR localvp; + + localvp.strvalue[0] = 0; + switch (da->attr) { case PW_PACKET_TYPE: { @@ -210,10 +214,25 @@ return strlen(out); } break; - - default: - break; - } + + case PW_PACKET_SRC_PORT: + localvp.attribute = da->attr; + localvp.lvalue = packet->src_port; + break; + + case PW_PACKET_DST_PORT: + localvp.attribute = da->attr; + localvp.lvalue = packet->dst_port; + break; + + default: + return 0; + break; + } + + localvp.type = da->type; + return valuepair2str(out, outlen, &localvp, + da->type, func); } /*
participants (1)
-
Geoff Silver