[Xorp-hackers] [PATCH 8/8] xorp: fea: data_plane: ifconfig: Check if we can set destination(broadcast) address for vif

igorm at etf.rs igorm at etf.rs
Tue Mar 20 10:02:47 PDT 2012


From: Igor Maravic <igorm at etf.rs>

If our vif on system isn't broadcast-capable(point-to-point) link
we can't set appropriate broadcast(destination) address. Commit will fail in that case.

Signed-off-by: Igor Maravic <igorm at etf.rs>
---
 xorp/fea/data_plane/ifconfig/ifconfig_set.cc |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/xorp/fea/data_plane/ifconfig/ifconfig_set.cc b/xorp/fea/data_plane/ifconfig/ifconfig_set.cc
index 6965c41..046ab3e 100644
--- a/xorp/fea/data_plane/ifconfig/ifconfig_set.cc
+++ b/xorp/fea/data_plane/ifconfig/ifconfig_set.cc
@@ -595,6 +595,21 @@ IfConfigSet::push_vif_address(const IfTreeInterface*	system_ifp,
 	is_add = false;
     }
 
+    if (system_vifp != NULL) {
+	if (system_vifp->point_to_point() != config_addr.point_to_point()) {
+	    error_msg = c_format("Can't set destination address for if: %s vif: %s"
+		    "because it isn't point-to-point interface\n",
+		    system_ifp->ifname().c_str(), system_vifp->vifname().c_str());
+	    goto done;
+	}
+	if (system_vifp->broadcast() != config_addr.broadcast()) {
+	    error_msg = c_format("Can't set broadcast address for if: %s vif: %s"
+		    "because it isn't broadcast capable\n",
+		    system_ifp->ifname().c_str(), system_vifp->vifname().c_str());
+	    goto done;
+	}
+    }
+
     //
     // XXX: If the broadcast address was omitted, recompute and set it here.
     // Note that we recompute it only if the underlying vif is
-- 
1.7.5.4



More information about the Xorp-hackers mailing list