mirror of
https://github.com/openvswitch/ovs
synced 2025-09-02 15:25:22 +00:00
Support matching and modifying IP TTL.
Add support matching the IPv4 TTL and IPv6 hop limit fields. This commit also adds support for modifying the IPv4 TTL. Modifying the IPv6 hop limit isn't currently supported, since we don't support modifying IPv6 headers. We will likely want to change the user-space interface, since basic matching and setting the TTL are not generally useful. We will probably want the ability to match on extraordinary events (such as TTL of 0 or 1) and a decrement action. Feature #8024 Signed-off-by: Justin Pettit <jpettit@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
This commit is contained in:
@@ -1091,6 +1091,16 @@ dp_netdev_set_ip_tos(struct ip_header *nh, uint8_t new_tos)
|
||||
*field = new_tos;
|
||||
}
|
||||
|
||||
static void
|
||||
dp_netdev_set_ip_ttl(struct ip_header *nh, uint8_t new_ttl)
|
||||
{
|
||||
uint8_t *field = &nh->ip_ttl;
|
||||
|
||||
nh->ip_csum = recalc_csum16(nh->ip_csum, htons(*field << 8),
|
||||
htons(new_ttl << 8));
|
||||
*field = new_ttl;
|
||||
}
|
||||
|
||||
static void
|
||||
dp_netdev_set_ipv4(struct ofpbuf *packet, const struct ovs_key_ipv4 *ipv4_key)
|
||||
{
|
||||
@@ -1105,6 +1115,9 @@ dp_netdev_set_ipv4(struct ofpbuf *packet, const struct ovs_key_ipv4 *ipv4_key)
|
||||
if (nh->ip_tos != ipv4_key->ipv4_tos) {
|
||||
dp_netdev_set_ip_tos(nh, ipv4_key->ipv4_tos);
|
||||
}
|
||||
if (nh->ip_ttl != ipv4_key->ipv4_ttl) {
|
||||
dp_netdev_set_ip_ttl(nh, ipv4_key->ipv4_ttl);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user