diff options
Diffstat (limited to 'lib/nexthop.c')
| -rw-r--r-- | lib/nexthop.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/lib/nexthop.c b/lib/nexthop.c index 7b8ac95e83..725b52c052 100644 --- a/lib/nexthop.c +++ b/lib/nexthop.c @@ -13,10 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with Quagga; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; see the file COPYING; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include <zebra.h> @@ -92,6 +91,28 @@ nexthop_type_to_str (enum nexthop_types_t nh_type) return desc[nh_type]; } +/* + * Check if the labels match for the 2 nexthops specified. + */ +int +nexthop_labels_match (struct nexthop *nh1, struct nexthop *nh2) +{ + struct nexthop_label *nhl1, *nhl2; + + nhl1 = nh1->nh_label; + nhl2 = nh2->nh_label; + if ((nhl1 && !nhl2) || (!nhl1 && nhl2)) + return 0; + + if (nhl1->num_labels != nhl2->num_labels) + return 0; + + if (memcmp (nhl1->label, nhl2->label, nhl1->num_labels)) + return 0; + + return 1; +} + struct nexthop * nexthop_new (void) { |
