diff options
author | Kozlov Dmitry <xeb@mail.ru> | 2012-06-22 18:11:19 +0400 |
---|---|---|
committer | Kozlov Dmitry <xeb@mail.ru> | 2012-06-22 18:11:19 +0400 |
commit | 4080b4e1ffdb1482ab26557eb46a8121d93ac584 (patch) | |
tree | 0732197c98f911a18c024f7b91ec1031de34e10b /accel-pppd/radius | |
parent | b57c6b9e838fa7fa39e81164912d518b43de3723 (diff) | |
download | accel-ppp-4080b4e1ffdb1482ab26557eb46a8121d93ac584.tar.gz accel-ppp-4080b4e1ffdb1482ab26557eb46a8121d93ac584.zip |
initial ipoe implementation
Diffstat (limited to 'accel-pppd/radius')
-rw-r--r-- | accel-pppd/radius/auth.c | 28 | ||||
-rw-r--r-- | accel-pppd/radius/radius.c | 4 | ||||
-rw-r--r-- | accel-pppd/radius/radius_p.h | 1 | ||||
-rw-r--r-- | accel-pppd/radius/req.c | 21 |
4 files changed, 47 insertions, 7 deletions
diff --git a/accel-pppd/radius/auth.c b/accel-pppd/radius/auth.c index 6a0b3a96..6cb4e803 100644 --- a/accel-pppd/radius/auth.c +++ b/accel-pppd/radius/auth.c @@ -552,3 +552,31 @@ out: } +int rad_auth_null(struct radius_pd_t *rpd, const char *username, va_list args) +{ + struct rad_req_t *req; + int r = PWDB_DENIED; + + req = rad_req_alloc(rpd, CODE_ACCESS_REQUEST, username); + if (!req) + return PWDB_DENIED; + + if (conf_sid_in_auth) + if (rad_packet_add_str(req->pack, NULL, "Acct-Session-Id", rpd->ses->sessionid)) + return -1; + + r = rad_auth_send(req); + if (r == PWDB_SUCCESS) { + struct ev_radius_t ev = { + .ses = rpd->ses, + .request = req->pack, + .reply = req->reply, + }; + triton_event_fire(EV_RADIUS_ACCESS_ACCEPT, &ev); + } + + rad_req_free(req); + + return r; +} + diff --git a/accel-pppd/radius/radius.c b/accel-pppd/radius/radius.c index b654f29c..d880ad01 100644 --- a/accel-pppd/radius/radius.c +++ b/accel-pppd/radius/radius.c @@ -164,7 +164,9 @@ static int check(struct pwdb_t *pwdb, struct ap_session *ses, const char *userna r = rad_auth_mschap_v2(rpd, username, args); break; } - break; + case 0: + r = rad_auth_null(rpd, username, args); + break; } va_end(args); diff --git a/accel-pppd/radius/radius_p.h b/accel-pppd/radius/radius_p.h index e2c48bf9..f8adb465 100644 --- a/accel-pppd/radius/radius_p.h +++ b/accel-pppd/radius/radius_p.h @@ -154,6 +154,7 @@ int rad_auth_pap(struct radius_pd_t *rpd, const char *username, va_list args); int rad_auth_chap_md5(struct radius_pd_t *rpd, const char *username, va_list args); int rad_auth_mschap_v1(struct radius_pd_t *rpd, const char *username, va_list args); int rad_auth_mschap_v2(struct radius_pd_t *rpd, const char *username, va_list args); +int rad_auth_null(struct radius_pd_t *rpd, const char *username, va_list args); int rad_acct_start(struct radius_pd_t *rpd); void rad_acct_stop(struct radius_pd_t *rpd); diff --git a/accel-pppd/radius/req.c b/accel-pppd/radius/req.c index 33273b43..f452c425 100644 --- a/accel-pppd/radius/req.c +++ b/accel-pppd/radius/req.c @@ -71,12 +71,21 @@ struct rad_req_t *rad_req_alloc(struct radius_pd_t *rpd, int code, const char *u if (rad_packet_add_int(req->pack, NULL, "NAS-Port", ppp->ses.unit_idx)) goto out_err; } - if (rad_packet_add_val(req->pack, NULL, "NAS-Port-Type", "Virtual")) - goto out_err; - if (rad_packet_add_val(req->pack, NULL, "Service-Type", "Framed-User")) - goto out_err; - if (rad_packet_add_val(req->pack, NULL, "Framed-Protocol", "PPP")) - goto out_err; + + if (req->rpd->ses->ctrl->type == CTRL_TYPE_IPOE) { + if (rad_packet_add_val(req->pack, NULL, "NAS-Port-Type", "Ethernet")) + goto out_err; + } else { + if (rad_packet_add_val(req->pack, NULL, "NAS-Port-Type", "Virtual")) + goto out_err; + + if (rad_packet_add_val(req->pack, NULL, "Service-Type", "Framed-User")) + goto out_err; + + if (rad_packet_add_val(req->pack, NULL, "Framed-Protocol", "PPP")) + goto out_err; + } + if (rpd->ses->ctrl->calling_station_id) if (rad_packet_add_str(req->pack, NULL, "Calling-Station-Id", rpd->ses->ctrl->calling_station_id)) goto out_err; |