LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-01-2005, 06:49 PM   #1
fotisaueb
LQ Newbie
 
Registered: Jul 2004
Posts: 4

Rep: Reputation: 0
using linux network stack through other programs


Hi there I need your help on doing the following.


I'm writing a program and I need to use the linux network stack so as to do the following.


When a packet arrives to the linux router and its destination is for pc A to forward it to another computer B which is locate outside the network.
Someone may tell me that this can be done with classical routing methods but what I want is to dynamically change the routes under certain circumstances.
So I want to call function of the linux network stack through my program.
Are there any specific system calls?Where can I find more info

thanx
 
Old 07-02-2005, 08:39 PM   #2
stefan_nicolau
Member
 
Registered: Jun 2005
Location: Canada
Distribution: Debian Etch/Sid, Ubuntu
Posts: 529

Rep: Reputation: 32
Have a look at NAT with iptables. Mappings can be altered dynamically.

If you insist on writing your own code, you will need to write a kernel module (I think, but you should double-check, maybe by posting a more specific question in the programming forum).

Writing a kernel module can be very long, and I'm almost sure iptables can do the job you need.

http://www.tldp.org/HOWTO/IP-Masquerade-HOWTO/
http://www.netfilter.org/documentation/index.html

Last edited by stefan_nicolau; 07-02-2005 at 08:42 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Network protocol stack corruption. Has it ever happened? tomdkat Linux - Networking 1 11-27-2005 09:42 AM
The journey of a packet through the linux 2.6 network stack kskkumar Linux - Networking 3 10-27-2005 03:19 AM
Linux Network Stack. tech1222 Linux - Networking 0 09-15-2004 08:05 PM
C++ programs initial stack size. uncle_kevin Programming 1 07-05-2004 01:35 PM
Making changes to Linux network protocol stack kayko2000 Linux - Networking 0 10-13-2003 05:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:00 AM.

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