summaryrefslogtreecommitdiffstats
path: root/proto/ospf/iface.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2010-03-26 16:21:29 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2010-03-26 16:21:29 +0100
commit48cff379a718998cd984d60fb6f8b48cb961c0f1 (patch)
treec4e0a589e36522e3579486cdba7309cd07a01a50 /proto/ospf/iface.c
parentaf157fa3dbe2bba0674eb7634efd3ade6c89d604 (diff)
downloadbird-48cff379a718998cd984d60fb6f8b48cb961c0f1.tar
bird-48cff379a718998cd984d60fb6f8b48cb961c0f1.zip
Added some comments.
Diffstat (limited to 'proto/ospf/iface.c')
-rw-r--r--proto/ospf/iface.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/proto/ospf/iface.c b/proto/ospf/iface.c
index b30a811..83d591b 100644
--- a/proto/ospf/iface.c
+++ b/proto/ospf/iface.c
@@ -97,6 +97,27 @@ ospf_sk_open(struct ospf_iface *ifa)
goto err;
#endif
+ /*
+ * For OSPFv2: When sending a packet, it is important to have a
+ * proper source address. We expect that when we send one-hop
+ * unicast packets, OS chooses a source address according to the
+ * destination address (to be in the same prefix). We also expect
+ * that when we send multicast packets, OS uses the source address
+ * from sk->saddr registered to OS by sk_setup_multicast(). This
+ * behavior is needed to implement multiple virtual ifaces (struct
+ * ospf_iface) on one physical iface and is signalized by
+ * CONFIG_MC_PROPER_SRC.
+ *
+ * If this behavior is not available (for example on BSD), we create
+ * non-stub iface just for the primary IP address (see
+ * ospf_iface_stubby()) and we expect OS to use primary IP address
+ * as a source address for both unicast and multicast packets.
+ *
+ * FIXME: the primary IP address is currently just the
+ * lexicographically smallest address on an interface, it should be
+ * signalized by sysdep code which one is really the primary.
+ */
+
sk->saddr = ifa->addr->ip;
if (sk_setup_multicast(sk) < 0)
goto err;