美文网首页wifidog
为wifidog认证跳转url添加客户端ip地址和MAC地址

为wifidog认证跳转url添加客户端ip地址和MAC地址

作者: 3c937c88e6c0 | 来源:发表于2015-02-02 14:23 被阅读209次

默认的的wifidog认证页面跳转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

由于业务需要,需要在跳转到认证页面时加一个客户端内网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了

现在认证跳转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整理编辑,转载请注明出处

相关文章

  • 为wifidog认证跳转url添加客户端ip地址和MAC地址

    默认的的wifidog认证页面跳转url是这样的 login/?gw_address=%s&gw_port=%d&...

  • Wifidog的协议梳理

    wifidog的认证流程图: 用户连接WIFI会跳转到以下地址: http://auth_server/logi...

  • HTTP

    一、地址栏键入URL,按下回车发生什么? 1、DNS解析,将相应的域名解析为IP地址 2.客户端根据IP地址去寻找...

  • ip地址和mac地址

    IP地址: 标记逻辑上的地址。 ip地址在整个通信过程中都不会发生任何变化。 mac地址: 标记实际转发数据时的设...

  • IP地址和MAC地址

    IP地址,每台设备都是不一样的 MAC地址,每台设备不一样,但是都是固定的、 区别 对于网络上的某一设备,如一台计...

  • MAC地址和IP地址

    Question1:为什么有了MAC地址,还需要IP地址? 任何东西的出现都是有原因的,技术也是Mac地址是物理层...

  • IP地址和MAC地址

    MAC是唯一的,虽然000...01和00...02是两个mac,但是他可能是在地球的两端,不方便统一管理。而ip...

  • 2019-02-21 IP地址和MAC地址

    一、IP地址和MAC地址 1、IP地址 (1)简介 IP地址(Internet Protocol Addres...

  • 2.IP地址详解

    一、IP地址和MAC地址 1、MAC地址 MAC(Media Access Control,介质访问控制)地址,或...

  • IP地址和子网划分学习笔记之《IP地址详解》

    一、IP地址和MAC地址 1、MAC地址 MAC(Media Access Control,介质访问控制)地址,或...

网友评论

    本文标题:为wifidog认证跳转url添加客户端ip地址和MAC地址

    本文链接:https://www.haomeiwen.com/subject/ewfrxttx.html