0

by SO_BINDTODEVICE socket option we could set the socket to one of the network interface , also if we use two NIC cards and if we want to set the socket to one of the NIC card the SO_BINDTODEVICE will help .

if we set the socket to eth1 in the setsockopt through SO_BINDTODEVICE then the socket will send and receive all the packet through eth1 interface .

This is what so far my understandings on the SO_BINDTODEVICE option , and there is a statement about SO_BINDTODEVICE and that is

You can call BINDTODEVICE more than once for a socket to change the interface it's bound to, but results may be unpredictable because of caching effects in the kernel.

What does the that means , i could not understand , is this about cache table(routing table) of LAN network which connected , explanation please

Siva Kannan
  • 2,237
  • 4
  • 27
  • 39
  • It is about 'caching effects in the kernel', and nothing more specific than that. – user207421 Oct 01 '14 at 04:22
  • And in practice it means "you probably shouldn't call it twice on the same socket" – Matti Virkkunen Oct 01 '14 at 04:22
  • May be the real cause is bit too much to put in the statement. I can think about the SMP case where for each interface there are multiple queues allocated for connection handling tied to a particular CPU. This makes use of cache locality (cached networking structures) per CPU efficiently. If you change the interface multiple times its gonna affect somewhere considering the complexity. Between, I am just putting down my words, may not be relevant at all. – Arunmu Oct 01 '14 at 08:27

0 Answers0