~ubuntu-branches/ubuntu/utopic/suricata/utopic

« back to all changes in this revision

Viewing changes to src/source-nfq.c

  • Committer: Package Import Robot
  • Author(s): Pierre Chifflier
  • Date: 2012-07-22 22:27:36 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20120722222736-s2bcw3ruzenagjam
Tags: 1.3-1
* Imported Upstream version 1.3
* Add build-dependency on libnss3-dev and libnspr4-dev
* Bump Standards Version to 3.9.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
91
91
    tmm_modules[TMM_DECODENFQ].ThreadDeinit = NULL;
92
92
    tmm_modules[TMM_DECODENFQ].RegisterTests = NULL;
93
93
    tmm_modules[TMM_DECODENFQ].cap_flags = 0;
 
94
    tmm_modules[TMM_DECODENFQ].flags = TM_FLAG_DECODE_TM;
94
95
}
95
96
 
96
97
TmEcode NoNFQSupportExit(ThreadVars *tv, void *initdata, void **data)
176
177
    tmm_modules[TMM_RECEIVENFQ].ThreadExitPrintStats = ReceiveNFQThreadExitStats;
177
178
    tmm_modules[TMM_RECEIVENFQ].ThreadDeinit = ReceiveNFQThreadDeinit;
178
179
    tmm_modules[TMM_RECEIVENFQ].RegisterTests = NULL;
 
180
    tmm_modules[TMM_RECEIVENFQ].flags = TM_FLAG_RECEIVE_TM;
179
181
}
180
182
 
181
183
void TmModuleVerdictNFQRegister (void) {
194
196
    tmm_modules[TMM_DECODENFQ].ThreadExitPrintStats = NULL;
195
197
    tmm_modules[TMM_DECODENFQ].ThreadDeinit = NULL;
196
198
    tmm_modules[TMM_DECODENFQ].RegisterTests = NULL;
 
199
    tmm_modules[TMM_DECODENFQ].flags = TM_FLAG_DECODE_TM;
197
200
}
198
201
 
199
202
/** \brief          To initialize the NFQ global configuration data
225
228
        }
226
229
    }
227
230
 
228
 
    if ((ConfGetInt("nfq.repeat_mark", &value)) == 1) {
 
231
    if ((ConfGetInt("nfq.repeat-mark", &value)) == 1) {
229
232
        nfq_config.mark = (uint32_t)value;
230
233
    }
231
234
 
232
 
    if ((ConfGetInt("nfq.repeat_mask", &value)) == 1) {
 
235
    if ((ConfGetInt("nfq.repeat-mask", &value)) == 1) {
233
236
        nfq_config.mask = (uint32_t)value;
234
237
    }
235
238
 
236
 
    if ((ConfGetInt("nfq.route_queue", &value)) == 1) {
 
239
    if ((ConfGetInt("nfq.route-queue", &value)) == 1) {
237
240
        nfq_config.next_queue = ((uint32_t)value) << 16;
238
241
    }
239
242
 
259
262
{
260
263
    char *active_runmode = RunmodeGetActive();
261
264
 
262
 
    if (active_runmode && !strcmp("worker", active_runmode)) {
 
265
    if (active_runmode && !strcmp("workers", active_runmode)) {
263
266
        nq->use_mutex = 0;
264
 
        SCLogInfo("NFQ running in 'worker' runmode, will not use mutex.");
 
267
        SCLogInfo("NFQ running in 'workers' runmode, will not use mutex.");
265
268
    } else {
266
269
        nq->use_mutex = 1;
267
270
    }
269
272
        SCMutexInit(&nq->mutex_qh, NULL);
270
273
}
271
274
 
272
 
static inline void NFQMutexLock(NFQQueueVars *nq)
273
 
{
274
 
    if (nq->use_mutex)
275
 
        SCMutexLock(&nq->mutex_qh);
276
 
}
 
275
#define NFQMutexLock(nq) do {           \
 
276
    if ((nq)->use_mutex)                \
 
277
        SCMutexLock(&(nq)->mutex_qh);   \
 
278
} while (0)
277
279
 
278
 
static inline void NFQMutexUnlock(NFQQueueVars *nq)
279
 
{
280
 
    if (nq->use_mutex)
281
 
        SCMutexUnlock(&nq->mutex_qh);
282
 
}
 
280
#define NFQMutexUnlock(nq) do {         \
 
281
    if ((nq)->use_mutex)                \
 
282
        SCMutexUnlock(&(nq)->mutex_qh); \
 
283
} while (0)
283
284
 
284
285
 
285
286
int NFQSetupPkt (Packet *p, struct nfq_q_handle *qh, void *data)