mirror of
https://gitlab.labs.nic.cz/labs/bird.git
synced 2024-05-11 16:54:54 +00:00
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.
This commit is contained in:
@@ -131,7 +131,7 @@ CF_KEYWORDS(NONE, SIMPLE, AUTHENTICATION, STRICT, CRYPTOGRAPHIC)
|
||||
CF_KEYWORDS(ELIGIBLE, POLL, NETWORKS, HIDDEN, VIRTUAL, CHECK, LINK)
|
||||
CF_KEYWORDS(RX, BUFFER, LARGE, NORMAL, STUBNET, HIDDEN, SUMMARY, TAG, EXTERNAL)
|
||||
CF_KEYWORDS(WAIT, DELAY, LSADB, ECMP, LIMIT, WEIGHT, NSSA, TRANSLATOR, STABILITY)
|
||||
CF_KEYWORDS(GLOBAL, LSID, ROUTER, SELF, INSTANCE, REAL, NETMASK)
|
||||
CF_KEYWORDS(GLOBAL, LSID, ROUTER, SELF, INSTANCE, REAL, NETMASK, TX, PRIORITY)
|
||||
|
||||
%type <t> opttext
|
||||
%type <ld> lsadb_args
|
||||
@@ -305,6 +305,8 @@ ospf_iface_item:
|
||||
| RX BUFFER LARGE { OSPF_PATT->rxbuf = OSPF_RXBUF_LARGE ; }
|
||||
| RX BUFFER NORMAL { OSPF_PATT->rxbuf = OSPF_RXBUF_NORMAL ; }
|
||||
| RX BUFFER expr { OSPF_PATT->rxbuf = $3 ; if (($3 < OSPF_RXBUF_MINSIZE) || ($3 > OSPF_MAX_PKT_SIZE)) cf_error("Buffer size must be in range 256-65535"); }
|
||||
| TX tos { OSPF_PATT->tx_tos = $2; }
|
||||
| TX PRIORITY expr { OSPF_PATT->tx_priority = $3; }
|
||||
| password_list
|
||||
;
|
||||
|
||||
@@ -367,6 +369,8 @@ ospf_iface_start:
|
||||
init_list(&OSPF_PATT->nbma_list);
|
||||
OSPF_PATT->autype = OSPF_AUTH_NONE;
|
||||
OSPF_PATT->ptp_netmask = 2; /* not specified */
|
||||
OSPF_PATT->tx_tos = IP_PREC_INTERNET_CONTROL;
|
||||
OSPF_PATT->tx_priority = sk_priority_control;
|
||||
reset_passwords();
|
||||
}
|
||||
;
|
||||
|
@@ -77,7 +77,8 @@ ospf_sk_open(struct ospf_iface *ifa)
|
||||
sk->dport = OSPF_PROTO;
|
||||
sk->saddr = IPA_NONE;
|
||||
|
||||
sk->tos = IP_PREC_INTERNET_CONTROL;
|
||||
sk->tos = ifa->cf->tx_tos;
|
||||
sk->priority = ifa->cf->tx_priority;
|
||||
sk->rx_hook = ospf_rx_hook;
|
||||
sk->tx_hook = ospf_tx_hook;
|
||||
sk->err_hook = ospf_err_hook;
|
||||
@@ -659,7 +660,10 @@ ospf_iface_reconfigure(struct ospf_iface *ifa, struct ospf_iface_patt *new)
|
||||
if (ifa->stub != new_stub)
|
||||
return 0;
|
||||
|
||||
if (new->real_bcast != ifa->cf->real_bcast)
|
||||
/* Change of these options would require to reset the iface socket */
|
||||
if ((new->real_bcast != ifa->cf->real_bcast) ||
|
||||
(new->tx_tos != ifa->cf->tx_tos) ||
|
||||
(new->tx_priority != ifa->cf->tx_priority))
|
||||
return 0;
|
||||
|
||||
ifa->cf = new;
|
||||
|
@@ -800,6 +800,8 @@ struct ospf_iface_patt
|
||||
u32 priority;
|
||||
u32 voa;
|
||||
u32 vid;
|
||||
int tx_tos;
|
||||
int tx_priority;
|
||||
u16 rxbuf;
|
||||
#define OSPF_RXBUF_NORMAL 0
|
||||
#define OSPF_RXBUF_LARGE 1
|
||||
|
@@ -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;
|
||||
}
|
||||
;
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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 {
|
||||
|
Reference in New Issue
Block a user