summaryrefslogtreecommitdiff
path: root/proto/rip
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2013-06-24 16:37:30 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2013-06-24 16:37:30 +0200
commitef4a50be10c6dd0abffd957132cd146029c3d79d (patch)
treef01df1b69d1d5f495dcad82e2f0e30478be55cb8 /proto/rip
parentfad04c750ca6906fb095f1b45958dec0ac8e210c (diff)
Better packet priority and traffic class handling.
Implements support for IPv6 traffic class, sets higher priority for OSPF and RIP outgoing packets by default and allows to configure ToS/DS/TClass IP header field and the local priority of outgoing packets.
Diffstat (limited to 'proto/rip')
-rw-r--r--proto/rip/config.Y6
-rw-r--r--proto/rip/rip.c7
-rw-r--r--proto/rip/rip.h2
3 files changed, 12 insertions, 3 deletions
diff --git a/proto/rip/config.Y b/proto/rip/config.Y
index cd4f30e7..ec82aa3d 100644
--- a/proto/rip/config.Y
+++ b/proto/rip/config.Y
@@ -27,7 +27,7 @@ CF_DECLS
CF_KEYWORDS(RIP, INFINITY, METRIC, PORT, PERIOD, GARBAGE, TIMEOUT,
MODE, BROADCAST, MULTICAST, QUIET, NOLISTEN, VERSION1,
AUTHENTICATION, NONE, PLAINTEXT, MD5,
- HONOR, NEVER, NEIGHBOR, ALWAYS,
+ HONOR, NEVER, NEIGHBOR, ALWAYS, TX, PRIORITY,
RIP_METRIC, RIP_TAG)
%type <i> rip_mode rip_auth
@@ -76,6 +76,8 @@ rip_mode:
rip_iface_item:
| METRIC expr { RIP_IPATT->metric = $2; }
| MODE rip_mode { RIP_IPATT->mode |= $2; }
+ | TX tos { RIP_IPATT->tx_tos = $2; }
+ | TX PRIORITY expr { RIP_IPATT->tx_priority = $3; }
;
rip_iface_opts:
@@ -94,6 +96,8 @@ rip_iface_init:
add_tail(&RIP_CFG->iface_list, NODE this_ipatt);
init_list(&this_ipatt->ipn_list);
RIP_IPATT->metric = 1;
+ RIP_IPATT->tx_tos = IP_PREC_INTERNET_CONTROL;
+ RIP_IPATT->tx_priority = sk_priority_control;
}
;
diff --git a/proto/rip/rip.c b/proto/rip/rip.c
index 341df7eb..c09eae79 100644
--- a/proto/rip/rip.c
+++ b/proto/rip/rip.c
@@ -707,7 +707,8 @@ new_iface(struct proto *p, struct iface *new, unsigned long flags, struct iface_
if (new)
{
rif->sock->ttl = 1;
- rif->sock->tos = IP_PREC_INTERNET_CONTROL;
+ rif->sock->tos = PATT->tx_tos;
+ rif->sock->priority = PATT->tx_priority;
rif->sock->flags = SKF_LADDR_RX;
}
@@ -1007,7 +1008,9 @@ static int
rip_pat_compare(struct rip_patt *a, struct rip_patt *b)
{
return ((a->metric == b->metric) &&
- (a->mode == b->mode));
+ (a->mode == b->mode) &&
+ (a->tx_tos == b->tx_tos) &&
+ (a->tx_priority == b->tx_priority));
}
static int
diff --git a/proto/rip/rip.h b/proto/rip/rip.h
index e0816d0e..2cce8c81 100644
--- a/proto/rip/rip.h
+++ b/proto/rip/rip.h
@@ -128,6 +128,8 @@ struct rip_patt {
#define IM_QUIET 4
#define IM_NOLISTEN 8
#define IM_VERSION1 16
+ int tx_tos;
+ int tx_priority;
};
struct rip_proto_config {