Skip to content

Commit

Permalink
Merge pull request #282 from timri/feature/location-without-proxyvsa
Browse files Browse the repository at this point in the history
Allow --enable-location without --enable-proxyvsa
  • Loading branch information
wlanmac authored Sep 20, 2016
2 parents 2291edf + 531d386 commit 41b3103
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 10 deletions.
6 changes: 5 additions & 1 deletion src/chilli.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ double mainclock_diffd(struct timespec * past) {
}

uint8_t* chilli_called_station(struct session_state *state) {
#ifdef ENABLE_PROXYVSA
#ifdef ENABLE_LOCATION
if (_options.location_copy_called && state->redir.calledlen) {
return state->redir.called;
}
Expand Down Expand Up @@ -3085,8 +3085,10 @@ static int
chilli_proxy_radlocation(struct radius_packet_t *pack,
struct app_conn_t *appconn, char force) {
struct radius_attr_t *attr = 0;
#ifdef ENABLE_PROXYVSA
uint8_t * vsa = appconn->s_state.redir.vsa;
int instance=0;
#endif

if (_options.location_copy_called) {
if (!radius_getattr(pack, &attr, RADIUS_ATTR_CALLED_STATION_ID, 0, 0, 0)) {
Expand All @@ -3099,6 +3101,7 @@ chilli_proxy_radlocation(struct radius_packet_t *pack,
}
}

#ifdef ENABLE_PROXYVSA
do {
attr=NULL;
if (!radius_getattr(pack, &attr, RADIUS_ATTR_VENDOR_SPECIFIC, 0, 0,
Expand All @@ -3120,6 +3123,7 @@ chilli_proxy_radlocation(struct radius_packet_t *pack,
#endif
}
} while (attr);
#endif

#ifdef ENABLE_LOCATION
if (_options.proxy_loc[0].attr) {
Expand Down
2 changes: 2 additions & 0 deletions src/chilli.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ void child_killall(int sig);

#ifdef ENABLE_PROXYVSA
int radius_addvsa(struct radius_packet_t *pack, struct redir_state *state);
#endif
#if defined(ENABLE_LOCATION) || defined(ENABLE_PROXYVSA)
int chilli_learn_location(uint8_t *loc, int loclen,
struct app_conn_t *appconn, char force);
#endif
Expand Down
4 changes: 2 additions & 2 deletions src/main-opt.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ int main(int argc, char **argv) {
_options.bwbucketminsize = args_info.bwbucketminsize_arg;
#endif

#ifdef ENABLE_PROXYVSA
#if defined(ENABLE_PROXYVSA) || defined(ENABLE_LOCATION)
_options.vlanlocation = args_info.vlanlocation_flag;
_options.location_stop_start = args_info.locationstopstart_flag;
_options.location_copy_called = args_info.locationcopycalled_flag;
Expand Down Expand Up @@ -1394,7 +1394,7 @@ int main(int argc, char **argv) {
_options.ieee8021q_only = args_info.only8021q_flag;
_options.vlanupdate = STRDUP(args_info.vlanupdate_arg);
#endif
#ifdef ENABLE_PROXYVSA
#if defined(ENABLE_PROXYVSA) || defined(ENABLE_LOCATION)
_options.locationupdate = STRDUP(args_info.locationupdate_arg);
#endif
_options.nochallenge = args_info.nochallenge_flag;
Expand Down
4 changes: 2 additions & 2 deletions src/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ int options_fromfd(int fd, bstring bt) {
#ifdef ENABLE_IEEE8021Q
if (!option_s_l(bt, &o.vlanupdate)) return 0;
#endif
#ifdef ENABLE_PROXYVSA
#if defined(ENABLE_PROXYVSA) || defined(ENABLE_LOCATION)
if (!option_s_l(bt, &o.locationupdate)) return 0;
#endif

Expand Down Expand Up @@ -479,7 +479,7 @@ int options_save(char *file, bstring bt) {
#ifdef ENABLE_IEEE8021Q
if (!option_s_s(bt, &o.vlanupdate)) return 0;
#endif
#ifdef ENABLE_PROXYVSA
#if defined(ENABLE_PROXYVSA) || defined(ENABLE_LOCATION)
if (!option_s_s(bt, &o.locationupdate)) return 0;
#endif

Expand Down
4 changes: 2 additions & 2 deletions src/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ struct options_t {
uint8_t proxymacaccept:1; /* Auto-accept non-EAP requests on proxy port */
uint8_t proxyonacct:1;
#endif
#ifdef ENABLE_PROXYVSA
#if defined(ENABLE_LOCATION) || defined(ENABLE_PROXYVSA)
uint8_t vlanlocation:1;
uint8_t location_stop_start:1;
uint8_t location_copy_called:1;
Expand Down Expand Up @@ -340,7 +340,7 @@ struct options_t {
uint32_t challengetimeout;
uint32_t challengetimeout2;

#ifdef ENABLE_PROXYVSA
#if defined(ENABLE_LOCATION) || defined(ENABLE_PROXYVSA)
#define PROXYVSA_ATTR_CNT 4
struct {
uint32_t attr_vsa;
Expand Down
2 changes: 1 addition & 1 deletion src/radius.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void radius_addcalledstation(struct radius_t *this,
uint8_t b[32];
uint8_t *mac = NULL;

#ifdef ENABLE_PROXYVSA
#if defined(ENABLE_PROXYVSA) || defined(ENABLE_LOCATION)
if (state->redir.calledlen) {
radius_addattr(this, pack, RADIUS_ATTR_CALLED_STATION_ID, 0, 0, 0,
state->redir.called, state->redir.calledlen);
Expand Down
6 changes: 4 additions & 2 deletions src/session.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,12 @@ struct redir_state {
char acceptlanguage[128];
#endif

#ifdef ENABLE_PROXYVSA
#define RADIUS_PROXYVSA 256
#if defined(ENABLE_LOCATION) || defined(ENABLE_PROXYVSA)
uint8_t called[RADIUS_ATTR_VLEN];
uint8_t calledlen;
#endif
#ifdef ENABLE_PROXYVSA
#define RADIUS_PROXYVSA 256
uint8_t vsa[RADIUS_PROXYVSA];
size_t vsalen;
#endif
Expand Down

0 comments on commit 41b3103

Please sign in to comment.