LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-22-2016, 06:19 AM   #1
spsamy.cse
LQ Newbie
 
Registered: May 2009
Posts: 2

Rep: Reputation: 0
How to bind multiple interface to a raw socket


Hi ,

I have opened a raw socket to get all the raw packets.
socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL)

When a packet is received on an interface which is member of a LAG or bond , the kernel is sending the packets to the user application 2 times. One for the actual physical interface and another one for the bond interface. How to restrict the kernel to lift the packet only for the interface which i am interested.

We can achieve it by binding the application interested interface to the socket. But i don't want to create multiple sockets ( one for each interface) to avoid scalablity issue. Is it possible to bind multiple interface to the raw socket dynamically ?

Thanks in advance
 
Old 01-22-2016, 11:20 AM   #2
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,669

Rep: Reputation: 498Reputation: 498Reputation: 498Reputation: 498Reputation: 498
Have you tried binding the socket to a single address and use arbitrary ports?
 
Old 01-26-2016, 01:17 AM   #3
spsamy.cse
LQ Newbie
 
Registered: May 2009
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks for the response malekmustaq. The application is looking for layer 2 control packets ( STP Bpdus) . To which address i should bind the socket ?
 
  


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
[SOLVED] RAW socket bind error jayadhanesh Linux - Software 1 11-22-2012 02:12 AM
Raw SCTP socket cannot bind with port? JohnJLewis Linux - Networking 1 07-26-2010 02:14 PM
Raw socket and bind question, how to implement correctly. coolsti Linux - Networking 1 06-28-2009 11:49 PM
PF_PACKET socket bind() to loopback interface (lo) cwpetersen Linux - Networking 0 03-17-2009 12:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:39 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