Logo Search packages:      
Sourcecode: libnetfilter-queue version File versions  Download package

int nfq_get_indev_name ( struct nlif_handle *  nlif_handle,
struct nfq_data nfad,
char *  name 

nfq_get_indev_name - get the name of the interface the packet was received through

nlif_handlepointer to a nlif interface resolving handle
nfadNetlink packet data handle passed to callback function
namepointer to the buffer to receive the interface name; not more than IFNAMSIZ bytes will be copied to it.
-1 in case of error, >0 if it succeed.

To use a nlif_handle, You need first to call nlif_open() and to open an handler. Don't forget to store the result as it will be used during all your program life:

	h = nlif_open();
 	if (h == NULL) {

Once the handler is open, you need to fetch the interface table at a whole via a call to nlif_query.


libnfnetlink is able to update the interface mapping when a new interface appears. To do so, you need to call nlif_catch() on the handler after each interface related event. The simplest way to get and treat event is to run a select() or poll() against the nlif file descriptor. To get this file descriptor, you need to use nlif_fd:

 	if_fd = nlif_fd(h);

Don't forget to close the handler when you don't need the feature anymore:


Definition at line 902 of file libnetfilter_queue.c.

References nfq_get_indev().

      u_int32_t ifindex = nfq_get_indev(nfad);
      return nlif_index2name(nlif_handle, ifindex, name);

Here is the call graph for this function:

Generated by  Doxygen 1.6.0   Back to index