默認(rèn)的的wifidog認(rèn)證頁面跳轉(zhuǎn)url是這樣的
login/?gw_address=%s&gw_port=%d&gw_id=%s&url=%s
Example: https://auth.ilesansfil.org/login/?gw_id=0016B6DA9AE0&gw_address=7.0.0.1&gw_port=2060
由于業(yè)務(wù)需要,需要在跳轉(zhuǎn)到認(rèn)證頁面時(shí)加一個(gè)客戶端內(nèi)網(wǎng)IP地址,即ClienIPAddress
下載wifidog添代碼晋渺,打開http.c伊履,找到
/* Re-direct them to auth server */
char *urlFragment;
safe_asprintf(&urlFragment, "%sgw_address=%s&gw_port=%d&gw_id=%s&url=%s",
auth_server->authserv_login_script_path_fragment,
config->gw_address,
config->gw_port,
config->gw_id,
url);
debug(LOG_INFO, "Captured %s requesting [%s] and re-directing them to login page", r->clientAddr, url);
http_send_redirect_to_auth(r, urlFragment, "Redirect to login page");
free(urlFragment);
修改為
/* Re-direct them to auth server */
char *urlFragment;
char *mac = arp_get(r->clientAddr);
if(!mac)
{
printf("mac cannot get\n");
return;
}
safe_asprintf(&urlFragment, "%sgw_address=%s&gw_port=%d&gw_id=%s&url=%s&clientip=%s&clientmac=%s",
auth_server->authserv_login_script_path_fragment,
config->gw_address,
config->gw_port,
config->gw_id,
url,
r->clientAddr,
mac);
debug(LOG_INFO, "Captured %s requesting [%s] and re-directing them to login page", r->clientAddr, url);
http_send_redirect_to_auth(r, urlFragment, "Redirect to login page");
free(urlFragment);
重新編譯以后就OK了
現(xiàn)在認(rèn)證跳轉(zhuǎn)url就帶有客戶端ip地址了
http://authServer/login/?gw_address=10.0.0.254&gw_port=2060&gw_id=79194CFB58&url=http%3A//www.baidu.com&clientAddr=10.0.0.100&clientmac=00:23:43:a3:b1:d5
本文由http://www.wifidog.pro/2014/12/10/wifidog-login%E5%8D%8F%E8%AE%AE%E6%B7%BB%E5%8A%A0%E5%AE%A2%E6%88%B7%E7%AB%AFIP-MAC.html整理編輯,轉(zhuǎn)載請(qǐng)注明出處