nfqueue 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nfqueue.rb +18 -16
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0e5269527d84dec2eac0a07da9f1dff4b70b8a41
4
- data.tar.gz: 5cebd45b959d5cc698bad49c7ae4e5116f2d1c89
3
+ metadata.gz: 4332685b28595e6de8f0af46fab3f4a3e02efc61
4
+ data.tar.gz: 0095459b9ef2e010e1a2e53403dee6278e6042e0
5
5
  SHA512:
6
- metadata.gz: be8d86d168625c3b2b2d4606188c2ffb9ca2fe3d9b4c930628448bf0460d7233e9c390ca2501a44c6de4753489f1af8a719018f3ef82ff9d66bb9919bff1359e
7
- data.tar.gz: bb5504db4774eade02d99c475322a029c3fe1803ed811b17933afa67561ba2c45b55b8af682ce4d8ced035ea05598b9433fec559eb64f95bb8113f99465b08c9
6
+ metadata.gz: e1d11a737d43b094d59aa011c7ca4c181055ea883cc3ece3a404256ac16c483c0a0aececce2991cc582ecc336faabae933533b106d4723b7e774c670dba7c6a5
7
+ data.tar.gz: 41a56e9825c070496972e92afdac059c2b1a189c8a6af9cc54393c34ab836a7caaea4564b360aedc6b8c664a6c139559ce8dabeb357b32d06bb75ffbb62292b5
@@ -265,7 +265,24 @@ module Netfilter
265
265
  raise QueueError, "nfq_unbind_pf has failed"
266
266
  end
267
267
 
268
- @qhandle = Queue.nfq_create_queue(@conn_handle, qnumber, method(:callback_handler), nil)
268
+ @callback = Proc.new {|packet| raise QueueError, "Undefined callback method."}
269
+ @callback_handler =
270
+ FFI::Function.new(:int, [:pointer, :pointer, :pointer, :buffer_in]) do |qhandler, nfmsg, nfad, data|
271
+ packet = Packet.new(self, nfad)
272
+ verdict = @callback[packet]
273
+
274
+ data = packet.data
275
+
276
+ Queue.nfq_set_verdict(
277
+ qhandler,
278
+ packet.id,
279
+ verdict,
280
+ data.size,
281
+ data
282
+ )
283
+ end
284
+
285
+ @qhandle = Queue.nfq_create_queue(@conn_handle, qnumber, @callback_handler, nil)
269
286
  if @qhandle.null?
270
287
  close
271
288
  raise QueueError, "nfq_create_queue has failed" if @qhandle.null?
@@ -341,21 +358,6 @@ module Netfilter
341
358
 
342
359
  private
343
360
 
344
- def callback_handler(qhandler, nfmsg, nfad, data) #:nodoc:
345
- packet = Packet.new(self, nfad)
346
- verdict = @callback[packet]
347
-
348
- data = packet.data
349
-
350
- Queue.nfq_set_verdict(
351
- qhandler,
352
- packet.id,
353
- verdict,
354
- data.size,
355
- data
356
- )
357
- end
358
-
359
361
  def close #:nodoc:
360
362
  Queue.nfq_close(@conn_handle)
361
363
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nfqueue
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guillaume Delugré