From c436dad7cfdd80ca4a05ceed556c39babc266f55 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Thu, 27 Sep 2012 23:48:25 +0200 Subject: iptables: support for match aliases This patch allows for match names listed on the command line to be rewritten to new names and revisions, like we did for targets before. Signed-off-by: Jan Engelhardt --- iptables/ip6tables.c | 6 +++++- iptables/iptables.c | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'iptables') diff --git a/iptables/ip6tables.c b/iptables/ip6tables.c index 752cf033..f93bfb33 100644 --- a/iptables/ip6tables.c +++ b/iptables/ip6tables.c @@ -1319,8 +1319,12 @@ static void command_match(struct iptables_command_state *cs) size = XT_ALIGN(sizeof(struct xt_entry_match)) + m->size; m->m = xtables_calloc(1, size); m->m->u.match_size = size; - strcpy(m->m->u.user.name, m->name); + strcpy(m->m->u.user.name, m->real_name); m->m->u.user.revision = m->revision; + if (m->real_name != m->name) + fprintf(stderr, "WARNING: The %s match is obsolete. " + "Use %s instead.\n", m->name, m->real_name); + xs_init_match(m); if (m == m->next) return; diff --git a/iptables/iptables.c b/iptables/iptables.c index a237e93c..5786bfdd 100644 --- a/iptables/iptables.c +++ b/iptables/iptables.c @@ -1330,8 +1330,12 @@ static void command_match(struct iptables_command_state *cs) size = XT_ALIGN(sizeof(struct xt_entry_match)) + m->size; m->m = xtables_calloc(1, size); m->m->u.match_size = size; - strcpy(m->m->u.user.name, m->name); + strcpy(m->m->u.user.name, m->real_name); m->m->u.user.revision = m->revision; + if (m->real_name != m->name) + fprintf(stderr, "WARNING: The %s match is obsolete. " + "Use %s instead.\n", m->name, m->real_name); + xs_init_match(m); if (m == m->next) return; -- cgit v1.2.3