LinuxQuestions.org
Visit the LQ Articles and Editorials section
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 02-14-2004, 08:19 AM   #1
becky_starr
Member
 
Registered: Jan 2004
Posts: 34

Rep: Reputation: 15
stop forwarding packet after checking the message sent from PC 1 to PC 3 through PC@


suppose there are 3 PCs

A socket connection is made between PC 1 and PC 3 through PC 2.

PC 2 will act as a router wich forward packet from PC 1 to PC 3.

My problem is that

since the packet is directed to PC 3, in my program, how I can get the message sent from pc 1 to pc 3 at pc 2??

for PC 1, I write a client.c program to open connection and send data to PC 3

for PC 3, I write a server.c program to open connection and receive data and display on screen.

But I have no idea how I can get the message at PC 2.



I now try writing userspace program, but still in progress.


I would like to seek opinions from some experts here, thanks~~~~

Thanks again and again~~~

(Does anyone know any website which teaches userspace program in details?)
 
Old 02-14-2004, 11:24 AM   #2
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
instead, have PC1 and PC3 both connect to PC2, and then PC2 will read from one socket(PC1) and write to teh other (PC2).
 
Old 02-14-2004, 10:50 PM   #3
becky_starr
Member
 
Registered: Jan 2004
Posts: 34

Original Poster
Rep: Reputation: 15
Thanks infamous41md~~

However, I can't do that~~

Actually I am doing a Multicast QoS Implmentation in Linux Router~~

The packet has to direct to PC 3 (next hop is the sender of the multicast group) (pc 3 is the edge router) )which is for Admission Control of the multicast group.

So, my implementation is that when pc 2 receive the packet from pc 1 to the sender. then pc 2 has to change the source ip address from pc 1 to pc 2 .(because the sender only needs to know the connection close to it, it does not have to know the existence of the receivers)

when another receiver connect to pc 2 want to join the multicast group (ans just like pc 1 also send the join message to the sender through pc 2), pc 2 can check if pc 2 itself has already joined the group so return the packet back to that receiver without forwarding to the sender.

That means pc 2 has to know the message sent from the receiver to the sender.

But the connection is not made between them .....that's my problem~~~~



I have now think of another idea~~

with the use of iptables -m and -j QUEUE
in the program
I will mark the packet if pc 2 has already join the group, so I will enter the queue and run the userspace program to drop this packet and then open connection to that receiver and get the message that originally targets to the sender~~and pc 2 return the successful join mulitcst group message to that receiver.

But, I am not sure how/if the userspace program can drop that packet originally to sender and open connection to that receiver at the same time.

I haven't tried this~~~

Are there any other methods~~???
 
Old 02-14-2004, 11:02 PM   #4
becky_starr
Member
 
Registered: Jan 2004
Posts: 34

Original Poster
Rep: Reputation: 15
And, I want to ask how I can run another program in a program.

The command is..??

Could anyone show me the exact code??

Thanks~~~~
 
  


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
packet forwarding? one.eleven Linux - Networking 19 11-08-2006 03:35 AM
packet fragmentation in packet forwarding code cranium2004 Linux - Networking 0 05-16-2005 04:05 AM
how to program IP checking of packet for its delivery cranium2004 Programming 0 05-08-2005 01:46 AM
How to enable packet forwarding davidho3 Linux - Networking 2 10-12-2004 10:45 AM
port forwarding and packet forwarding syrtsardo Linux - Newbie 2 07-03-2003 10:37 AM


All times are GMT -5. The time now is 06:34 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration