[Xorp-users] Question on supporting multiple routing tables [PATCH]
Ben Greear
greearb at candelatech.com
Thu Aug 30 12:00:23 PDT 2007
This appears to be working..my OSPF instances are now in the 'Full'
state, and it's adding routes. Unfortunately, it's adding them to the
default routing table, as far as I can tell. Will debug that next.
Index: data_plane/io/io_ip_socket.cc
===================================================================
RCS file: /cvs/xorp/fea/data_plane/io/io_ip_socket.cc,v
retrieving revision 1.11
diff -u -r1.11 io_ip_socket.cc
--- data_plane/io/io_ip_socket.cc 30 Aug 2007 17:37:51 -0000 1.11
+++ data_plane/io/io_ip_socket.cc 30 Aug 2007 18:58:23 -0000
@@ -2362,6 +2362,33 @@
}
#endif // ! IPV4_RAW_INPUT_IS_RAW
+#ifdef SO_BINDTODEVICE
+ // Bind to DEVICE if platform supports it
+ // NOTE: We have to do the binding for both multicast and unicast because
+ // otherwise the socket can be left in stale state (bound to whatever interface the last
+ // packet was sent through.
+ // Even if it doesn't help multicast much, it doesn't appear to hurt anything.
+ if (!ifp->ifname().empty()) {
+ //XLOG_ERROR("will BINDTODEVICE, dev: %s, this: %p src-addr: %s",
+ // ifp->ifname().c_str(), this, cstring(src_address));
+ if (setsockopt(_proto_socket_out, SOL_SOCKET, SO_BINDTODEVICE,
+ ifp->ifname().c_str(), IFNAMSIZ)) {
+ error_msg += c_format("setsockopt(SO_BINDTODEVICE, %s) failed: %s",
+ ifp->ifname().c_str(), strerror(errno));
+ }
+ }
+ else {
+ // Un-bind in case we were previously bound...
+ //XLOG_ERROR("will un-BINDTODEVICE, dev: %s, this: %p src-addr: %s",
+ // ifp->ifname().c_str(), this, cstring(src_address));
+ if (setsockopt(_proto_socket_out, SOL_SOCKET, SO_BINDTODEVICE,
+ ifp->ifname().c_str(), 0)) {
+ error_msg += c_format("setsockopt(SO_BINDTODEVICE, NULL) failed: %s",
+ strerror(errno));
+ }
+ }
+#endif
+
//
// Multicast-related setting
//
--
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc http://www.candelatech.com
More information about the Xorp-users
mailing list