Implementing IP_SENDIF (like SO_BINDTODEVICE)
Bruce M Simpson
bms at spc.org
Thu Oct 28 15:32:52 PDT 2004
On Thu, Oct 28, 2004 at 03:41:34PM +0400, Gleb Smirnoff wrote:
> ng_device can be attached to "orphans" hook of ng_ether. /dev/ngdX opened
> by dhcpd, and packets processed.
This seems to me like pure configuration overkill. It would require that
people compile and load netgraph to run dhclient, and that the netgraph
graph be created and populated correctly.
> What is benefit to get rid of bpf? What is problem with it?
IPV6_NEXTHOP is intended to support this for IPv6. It doesn't right
now, it returns EAFNOSUPPORT.
Please see my attached game plan.
BMS
-------------- next part --------------
The story with FreeBSD and 'ip unnumbered' in IPv4 land
- Multicast group membership
- Dealt with in ip_multicast_if()
(can specify ifIndex in 0/8 as per RFC1724 hack)
- IP forwarding FIB
- Routes can be specified with the rt_gate field set to an
sockaddr_dl (AF_LINK) filled out only with an interface name
and no RTF_GATEWAY or RTF_LLINFO flag set for an unnumbered
serial interface.
- For host mode, sending packets to destinations whose prefix
and next-hop match such a route in the FIB are OK, but the
source address may need to be explicitly specified (it may
default to INADDR_ANY otherwise).
- Unicast sends
- Currently no way to explicitly send a udp datagram to such
an interface without specifying a destination with a route
pointing to that interface.
- Running BGP over an unnumbered interface is possible.
For an active session open, there has to be a route to one of
the addresses configured on the remote peer which traverses
the unnumbered interface, and this address must be specified
during connect().
For a passive session open, it would probably require that
net.inet.ip.check_interface is 0, so that incoming sessions
can be accepted on the unnumbered interface for passive open.
The IP address for the passive open (seen during accept() will
of course have to correspond to one of the other addresses
configured on the local host.
- For a protocol which needs to send broadcasts via the existing
unicast path and which cannot use multicast, there is no way
of doing this in the current iteration of the code.
TODO:
- Add support for explicitly specifying the interface used during
ip_output(). This would require SO_DONTROUTE and IP_SENDIF to
be set. SO_BINDTODEVICE could be emulated.
IP_SENDIF specified as a control message would be purely
temporary and only necessary for an unconnected datagram
socket send.
The inpcb already has an interface index field for IPv6. This
should be unravelled for IPv4 too.
IP_SENDIF passed to setsockopt() would be like SO_BINDTODEVICE
only instead of specifying an interface name, the interface
index is specified and cached in the inpcb.
SO_BINDTODEVICE would perform a lookup of the interface index
by name, just like Linux, then perform the same action as
IP_SENDIF when used as a socket option. This means calling
ifunit() to resolve the name to an ifnet, then just cache
ifnet->if_index in the inpcb.
SO_BINDTODEVICE can either be implemented purely in the
Linuxulator, or within src/sys/net/ itself.
The actual hack in ip_output() would need to check if the
interface had gone away, and if it had, drop the datagram -
this stuff only takes effect if SO_DONTROUTE is specified.
This is easily done...
(SO_DONTROUTE of course implies IP_ROUTETOIF - they are
defined to be identical).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 167 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-net/attachments/20041028/d9a5c5e8/attachment.bin
More information about the freebsd-net
mailing list