LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-19-2014, 09:15 AM   #1
dorian33
Member
 
Registered: Jan 2003
Location: Poland, Warsaw
Distribution: LFS, Gentoo
Posts: 591

Rep: Reputation: 32
simple tunnel with packet marking


Hi all,
I've created the udp tunnel using tun device and it works fine.

I have the following situation:
1. the encapsupated packet is read from udp socket
2. the data of the packet is written using file descriptor concerned with tun device
3. decapsulated packet appears in system via tun device


The question is:
how to write the packet in step 2 or what to do to see the packet in step 3 as "marked" one (to use as the selector in iptables -m mark --mark ... rule) ?


Some insights:

Iptables rules are the static ones so they do't work for me.
Iptables mark (or don't mark) packets dependenly on fixed set of parameters.

My question concerns the situation when it is my (tunneling) program which dynamically decides to set or not to set mark for each of the packet currently being decapsulated.

In other words I am looking for something similar to nfq_set_verdict_mark() function existing in libnetfilter_queue library but without necessity of using this library.

The packet I want (or don't want) to mark is "in my hand" i.e. in user space at the moment of de-tunelling. So it would be the best place to decide there about packet mark value.
With libnetfilter_queue additional kernel <---> userspace packet copying take place.

Therefore libnetfilter_queue is a solution but is not cost-effective.

This is the issue of my question.

Last edited by colucix; 04-06-2014 at 07:54 AM. Reason: Adjusted merged posts
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Per-packet IP DSCP/TOS Marking srikantap Programming 3 11-21-2011 06:12 AM
how to tunnel packet mutwkil Programming 3 04-19-2011 10:23 AM
route type unreachable overriding local packet generation for marking packets jp413 Linux - Networking 2 07-10-2010 08:51 PM
iptables packet marking and hfsc xanax Linux - Networking 0 02-18-2007 11:43 PM
iptables packet marking meks Linux - Networking 0 09-21-2004 05:14 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration