static int skelmod_handle(struct lkm_table *lkmtp, int cmd) { int error = 0; switch (cmd) { case LKM_E_LOAD: if (lkmexists(lkmtp)) return (EEXIST); printf("hello world\n"); break; case LKM_E_UNLOAD: printf("goodbye world\n"); break; default: error = EINVAL; break; } return (error); }
static int pf_lkmload(struct lkm_table *lkmtp, int cmd) { if (lkmexists(lkmtp)) return (EEXIST); pfattach(1); pflogattach(1); return (0); }
/* give kue a little action */ static int kue_action(struct lkm_table *lkmtp, int cmd) { int err = 0; switch (cmd) { case LKM_E_LOAD: if (lkmexists(lkmtp)) err = EEXIST; else err = kue_load(); break; case LKM_E_UNLOAD: err = kue_unload(); break; case LKM_E_STAT: err = EIO; break; } return err; }
static int if_ipl_lkmload(struct lkm_table *lkmtp, int cmd) { const char *defpass; int error; if (lkmexists(lkmtp)) return (EEXIST); error = ipfattach(); if (error == 0) { if (FR_ISPASS(fr_pass)) defpass = "******"; else if (FR_ISBLOCK(fr_pass)) defpass = "******"; else defpass = "******"; printf("%s initialized. Default = %s all, Logging = %s%s\n", ipfilter_version, defpass, #ifdef IPFILTER_LOG "enabled", #else "disabled", #endif #ifdef IPFILTER_COMPILED " (COMPILED)" #else "" #endif ); fr_running = 1; } return (error); }