Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/ldpd allow INET6 gateways, split some long lines



details:   https://anonhg.NetBSD.org/src/rev/ee2d45293933
branches:  trunk
changeset: 787551:ee2d45293933
user:      kefren <kefren%NetBSD.org@localhost>
date:      Sun Jun 23 06:40:26 2013 +0000

description:
allow INET6 gateways, split some long lines

diffstat:

 usr.sbin/ldpd/mpls_interface.c |  20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diffs (62 lines):

diff -r 20a4e2559072 -r ee2d45293933 usr.sbin/ldpd/mpls_interface.c
--- a/usr.sbin/ldpd/mpls_interface.c    Sun Jun 23 06:19:55 2013 +0000
+++ b/usr.sbin/ldpd/mpls_interface.c    Sun Jun 23 06:40:26 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mpls_interface.c,v 1.7 2013/01/26 17:29:55 kefren Exp $ */
+/* $NetBSD: mpls_interface.c,v 1.8 2013/06/23 06:40:26 kefren Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -133,8 +133,9 @@
                            RT_ROUNDUP(so_oldifa->sa.sa_len));
        }
 
-       if (so_gate->sa.sa_family != AF_INET) {
-               debugp("Failed at family check - only INET supoprted for now\n");
+       if (so_gate->sa.sa_family != AF_INET &&
+           so_gate->sa.sa_family != AF_INET6) {
+               debugp("mpls_add_label: so_gate is not IP or IPv6\n");
                return LDP_E_BAD_AF;
        }
 
@@ -153,7 +154,7 @@
        if (lab->binding == MPLS_LABEL_IMPLNULL) {
                change_local_label(lab, get_free_local_label());
                if (!lab->binding) {
-                       fatalp("No more free labels !!!\n");
+                       fatalp("Label pool depleted\n");
                        return LDP_E_TOO_MANY_LABELS;
                }
        }
@@ -181,16 +182,18 @@
                fatalp("Out of memory\n");
                return LDP_E_MEMORY;
        }
-       if (add_route(so_dest, NULL, so_nexthop, NULL, so_tag, FREESO, RTM_ADD) != LDP_E_OK)
+       if (add_route(so_dest, NULL, so_nexthop, NULL, so_tag,
+           FREESO, RTM_ADD) != LDP_E_OK)
                return LDP_E_ROUTE_ERROR;
 
-       /* Now, let's add tag to IPv4 route and point it to mpls interface */
+       /* Now, let's add tag to IP route and point it to mpls interface */
        if ((so_dest = make_inet_union(satos(addr))) == NULL) { // XXX: grobian
                fatalp("Out of memory\n");
                return LDP_E_MEMORY;
        }
 
-       /* if prefixlen == 32 check if it's inserted as host
+       /*
+       * if prefixlen == 32 check if it's inserted as host
        * and treat it as host. It may also be set as /32 prefix
        * (thanks mlelstv for heads-up about this)
        */
@@ -227,7 +230,8 @@
                memcpy(so_ifa, so_oldifa, so_oldifa->sa.sa_len);
        } else
                so_ifa = NULL;
-       if (add_route(so_dest, so_pref, so_nexthop, so_ifa, so_tag, FREESO, RTM_CHANGE) != LDP_E_OK)
+       if (add_route(so_dest, so_pref, so_nexthop, so_ifa, so_tag,
+           FREESO, RTM_CHANGE) != LDP_E_OK)
                return LDP_E_ROUTE_ERROR;
 
        debugp("Added %s/%d as label %d to peer %s\n", satos(addr), len,



Home | Main Index | Thread Index | Old Index