summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark O'Brien <mobrien@firebolt.vyatta.com>2008-07-09 13:44:13 -0700
committerMark O'Brien <mobrien@firebolt.vyatta.com>2008-07-09 13:44:13 -0700
commitf63a0b4acc3de4823ba8ac244beb0df74f8213b4 (patch)
treed7d1aea8b4e405791262f64e83c9106bc4aff609
parentab5c50927981ae4be0e6bc59f7d0b8ea7f662886 (diff)
parent7ddd7a8c51f05287919e9c4e39756f9a52dac99c (diff)
downloadquagga-f63a0b4acc3de4823ba8ac244beb0df74f8213b4.tar.bz2
quagga-f63a0b4acc3de4823ba8ac244beb0df74f8213b4.tar.xz
Merge branch 'hollywood' of git:/git/vyatta-quagga into hollywood
-rw-r--r--bgpd/bgp_network.c15
-rw-r--r--debian/vyatta-quagga.preinst2
-rw-r--r--lib/sockopt.c13
-rw-r--r--lib/sockopt.h1
-rw-r--r--zebra/connected.c2
-rw-r--r--zebra/zebra_rib.c59
6 files changed, 67 insertions, 25 deletions
diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c
index 4289ce20..e981e718 100644
--- a/bgpd/bgp_network.c
+++ b/bgpd/bgp_network.c
@@ -267,6 +267,11 @@ bgp_connect (struct peer *peer)
sockopt_reuseaddr (peer->fd);
sockopt_reuseport (peer->fd);
+#ifdef IPTOS_PREC_INTERNETCONTROL
+ if (sockunion_family (&peer->su) == AF_INET)
+ setsockopt_ipv4_tos (peer->fd, IPTOS_PREC_INTERNETCONTROL);
+#endif
+
#ifdef HAVE_TCP_MD5SIG
if (CHECK_FLAG (peer->flags, PEER_FLAG_PASSWORD))
if (sockunion_family (&peer->su) == AF_INET)
@@ -362,6 +367,11 @@ bgp_socket (struct bgp *bgp, unsigned short port, char *address)
sockopt_reuseaddr (sock);
sockopt_reuseport (sock);
+#ifdef IPTOS_PREC_INTERNETCONTROL
+ if (ainfo->ai_family == AF_INET)
+ setsockopt_ipv4_tos (sock, IPTOS_PREC_INTERNETCONTROL);
+#endif
+
#if defined(HAVE_TCP_MD5SIG) && defined(IPV6_V6ONLY)
/* We can not apply MD5SIG to an IPv6 socket. If this is an AF_INET6
socket, we'll have to create another socket for IPv4*/
@@ -419,6 +429,7 @@ bgp_socket (struct bgp *bgp, unsigned short port, char *address)
sockopt_reuseaddr (sock);
sockopt_reuseport (sock);
+ setsockopt_ipv4_tos (sock, IPTOS_PREC_INTERNETCONTROL);
memset (&sin, 0, sizeof (struct sockaddr_in));
@@ -486,6 +497,10 @@ bgp_socket (struct bgp *bgp, unsigned short port, char *address)
sockopt_reuseaddr (sock);
sockopt_reuseport (sock);
+#ifdef IPTOS_PREC_INTERNETCONTROL
+ setsockopt_ipv4_tos (sock, IPTOS_PREC_INTERNETCONTROL);
+#endif
+
memset (&sin, 0, sizeof (struct sockaddr_in));
sin.sin_family = AF_INET;
diff --git a/debian/vyatta-quagga.preinst b/debian/vyatta-quagga.preinst
index af61947a..41bc3df3 100644
--- a/debian/vyatta-quagga.preinst
+++ b/debian/vyatta-quagga.preinst
@@ -67,7 +67,7 @@ if [ "$1" = "install" ]; then
chmod 0640 $ETC_DIR/${daemon}.conf
cat <<-EOF > $ETC_DIR/${daemon}.conf
log syslog
- log facility local7
+ log facility local7
EOF
fi
done
diff --git a/lib/sockopt.c b/lib/sockopt.c
index 985c3a38..e0027e88 100644
--- a/lib/sockopt.c
+++ b/lib/sockopt.c
@@ -342,6 +342,19 @@ setsockopt_ipv4_ifindex (int sock, int val)
}
int
+setsockopt_ipv4_tos(int sock, int tos)
+{
+ int ret;
+
+ ret = setsockopt (sock, IPPROTO_IP, IP_TOS, &tos, sizeof (tos));
+ if (ret < 0)
+ zlog_warn ("Can't set IP_TOS option for fd %d to %#x: %s",
+ sock, tos, safe_strerror(errno));
+ return ret;
+}
+
+
+int
setsockopt_ifindex (int af, int sock, int val)
{
int ret = -1;
diff --git a/lib/sockopt.h b/lib/sockopt.h
index 158f17ac..df0de61c 100644
--- a/lib/sockopt.h
+++ b/lib/sockopt.h
@@ -87,6 +87,7 @@ extern int setsockopt_multicast_ipv4(int sock, int optname,
unsigned int ifindex
/* optional: if non-zero, may be used
instead of if_addr */);
+extern int setsockopt_ipv4_tos(int sock, int tos);
/* Ask for, and get, ifindex, by whatever method is supported. */
extern int setsockopt_ifindex (int, int, int);
diff --git a/zebra/connected.c b/zebra/connected.c
index 8bf1d337..ca22a011 100644
--- a/zebra/connected.c
+++ b/zebra/connected.c
@@ -86,7 +86,7 @@ connected_announce (struct interface *ifp, struct connected *ifc)
zebra_interface_address_add_update (ifp, ifc);
- if (if_is_up(ifp))
+ if (if_is_operative(ifp))
{
if (ifc->address->family == AF_INET)
connected_up_ipv4 (ifp, ifc);
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 59b53fa1..5acb644d 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -51,7 +51,7 @@ extern struct zebra_t zebrad;
int rib_process_hold_time = 10;
/* Each route type's string and default distance value. */
-struct
+static const struct
{
int key;
int distance;
@@ -70,7 +70,7 @@ struct
};
/* Vector for routing table. */
-vector vrf_vector;
+static vector vrf_vector;
/* Allocate new VRF. */
static struct vrf *
@@ -401,17 +401,24 @@ nexthop_active_ipv4 (struct rib *rib, struct nexthop *nexthop, int set,
{
/* Directly point connected route. */
newhop = match->nexthop;
- if (newhop && nexthop->type == NEXTHOP_TYPE_IPV4)
- nexthop->ifindex = newhop->ifindex;
- else if (newhop && newhop->type == NEXTHOP_TYPE_IFINDEX)
+ if (newhop)
{
- ifp = if_lookup_by_index (newhop->ifindex);
- return (ifp && if_is_operative (ifp));
- }
- else if (newhop && newhop->type == NEXTHOP_TYPE_IFNAME)
- {
- ifp = if_lookup_by_name(newhop->ifname);
- return (ifp && if_is_operative (ifp));
+ if (nexthop->type == NEXTHOP_TYPE_IPV4)
+ nexthop->ifindex = newhop->ifindex;
+
+ if (newhop->type == NEXTHOP_TYPE_IFINDEX ||
+ newhop->type == NEXTHOP_TYPE_IPV4_IFINDEX)
+ {
+ ifp = if_lookup_by_index (newhop->ifindex);
+ return (ifp && if_is_operative (ifp));
+ }
+
+ if (newhop->type == NEXTHOP_TYPE_IFNAME ||
+ newhop->type == NEXTHOP_TYPE_IPV4_IFNAME)
+ {
+ ifp = if_lookup_by_name(newhop->ifname);
+ return (ifp && if_is_operative (ifp));
+ }
}
return 1;
}
@@ -521,19 +528,25 @@ nexthop_active_ipv6 (struct rib *rib, struct nexthop *nexthop, int set,
/* Directly point connected route. */
newhop = match->nexthop;
- if (newhop && nexthop->type == NEXTHOP_TYPE_IPV6)
- nexthop->ifindex = newhop->ifindex;
- else if (newhop && newhop->type == NEXTHOP_TYPE_IFINDEX)
+ if (newhop)
{
- ifp = if_lookup_by_index (newhop->ifindex);
- return (ifp && if_is_operative (ifp));
+ if (nexthop->type == NEXTHOP_TYPE_IPV4)
+ nexthop->ifindex = newhop->ifindex;
+
+ if (newhop->type == NEXTHOP_TYPE_IFINDEX ||
+ newhop->type == NEXTHOP_TYPE_IPV4_IFINDEX)
+ {
+ ifp = if_lookup_by_index (newhop->ifindex);
+ return (ifp && if_is_operative (ifp));
+ }
+
+ if (newhop->type == NEXTHOP_TYPE_IFNAME ||
+ newhop->type == NEXTHOP_TYPE_IPV4_IFNAME)
+ {
+ ifp = if_lookup_by_name(newhop->ifname);
+ return (ifp && if_is_operative (ifp));
+ }
}
- else if (newhop && newhop->type == NEXTHOP_TYPE_IFNAME)
- {
- ifp = if_lookup_by_name(newhop->ifname);
- return (ifp && if_is_operative (ifp));
- }
-
return 1;
}
else if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_INTERNAL))