| 125 | } |
| 126 | |
| 127 | int |
| 128 | accept_filt_generic_mod_event(module_t mod, int event, void *data) |
| 129 | { |
| 130 | struct accept_filter *p; |
| 131 | struct accept_filter *accfp = (struct accept_filter *) data; |
| 132 | int error; |
| 133 | |
| 134 | switch (event) { |
| 135 | case MOD_LOAD: |
| 136 | p = malloc(sizeof(*p), M_ACCF, M_WAITOK); |
| 137 | bcopy(accfp, p, sizeof(*p)); |
| 138 | error = accept_filt_add(p); |
| 139 | break; |
| 140 | |
| 141 | case MOD_UNLOAD: |
| 142 | /* |
| 143 | * Do not support unloading yet. we don't keep track of |
| 144 | * refcounts and unloading an accept filter callback and then |
| 145 | * having it called is a bad thing. A simple fix would be to |
| 146 | * track the refcount in the struct accept_filter. |
| 147 | */ |
| 148 | if (unloadable != 0) { |
| 149 | error = accept_filt_del(accfp->accf_name); |
| 150 | } else |
| 151 | error = EOPNOTSUPP; |
| 152 | break; |
| 153 | |
| 154 | case MOD_SHUTDOWN: |
| 155 | error = 0; |
| 156 | break; |
| 157 | |
| 158 | default: |
| 159 | error = EOPNOTSUPP; |
| 160 | break; |
| 161 | } |
| 162 | |
| 163 | return (error); |
| 164 | } |
| 165 | |
| 166 | int |
| 167 | accept_filt_getopt(struct socket *so, struct sockopt *sopt) |
nothing calls this directly
no test coverage detected