Commit 27e02c33 authored by Kaarle Ritvanen's avatar Kaarle Ritvanen

TTL adjustment rules

parent 4ff16c68
......@@ -472,6 +472,17 @@ attribute named **classify**, must specify the class using the
**class** attribute. These rules apply to the both directions of the
matching traffic.
#### TTL Adjustment Rules
TTL adjustment rules are used to set the TTL field of the IPv4 packets
matching the specified criteria. The TTL adjustment rules are contained
in the top-level list attribute named **ttl** and define an attribute
named **ttl**. If the value is a non-negative integer, the TTL of the
packet is set to the value. If it is a negative integer, the TTL value
is decremented accordingly. The TTL value can be incremented by a
constant by setting the attribute value to a string representing a
positive integer, prepended with the plus sign (**+**).
#### Transparent Proxy Rules
Transparent proxy rules divert the matching packets to a local proxy
TTL adjustment module for Alpine Wall
Copyright (C) 2012-2016 Kaarle Ritvanen
See LICENSE file for license details
local model = require('awall.model')
local TTLRule = model.class(model.Rule)
function TTLRule:trules()
local res = {}
for _, rule in ipairs(TTLRule.super(self):trules()) do
if == 'inet' then table.insert(res, rule) end
return res
function TTLRule:table() return 'mangle' end
function TTLRule:target()
if not self.ttl then self:error('TTL not specified') end
if type(self.ttl) == 'string' then
if self.ttl:sub(1, 1) == '+' then
return 'TTL --ttl-inc '..self.ttl:sub(2, -1)
else self.ttl = tonumber(self.ttl) end
if type(self.ttl) ~= 'number' then
self:error('Invalid TTL specification')
return 'TTL --ttl-'..(self.ttl < 0 and 'dec' or 'set')..' '..
return {export={ttl={class=TTLRule}}}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment