From f64820aa8450c6cc2c546493cbfef43c86fda048 Mon Sep 17 00:00:00 2001 From: Gilles Chehade Date: Fri, 25 Nov 2016 09:21:22 +0000 Subject: assign an id to each rule in the ruleset, first step towards an MTA layer and scheduler simplification ok eric@ --- usr.sbin/smtpd/parse.y | 5 ++++- usr.sbin/smtpd/smtpd.h | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y index 3a73371cf08..0bc65098a26 100644 --- a/usr.sbin/smtpd/parse.y +++ b/usr.sbin/smtpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.190 2016/09/12 07:33:00 eric Exp $ */ +/* $OpenBSD: parse.y,v 1.191 2016/11/25 09:21:21 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -93,6 +93,7 @@ char *symget(const char *); struct smtpd *conf = NULL; static int errors = 0; +static uint64_t ruleid = 0; struct filter_conf *filter = NULL; struct table *table = NULL; @@ -1409,6 +1410,7 @@ accept_params : opt_accept accept_params rule : ACCEPT { rule = xcalloc(1, sizeof(*rule), "parse rule: ACCEPT"); + rule->r_id = ++ruleid; rule->r_action = A_NONE; rule->r_decision = R_ACCEPT; rule->r_desttype = DEST_DOM; @@ -1441,6 +1443,7 @@ rule : ACCEPT { } | REJECT { rule = xcalloc(1, sizeof(*rule), "parse rule: REJECT"); + rule->r_id = ++ruleid; rule->r_decision = R_REJECT; rule->r_desttype = DEST_DOM; } decision { diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h index ed308198545..46819c5e9e6 100644 --- a/usr.sbin/smtpd/smtpd.h +++ b/usr.sbin/smtpd/smtpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.h,v 1.524 2016/11/17 17:34:55 eric Exp $ */ +/* $OpenBSD: smtpd.h,v 1.525 2016/11/25 09:21:21 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -376,6 +376,7 @@ enum decision { }; struct rule { + uint64_t r_id; TAILQ_ENTRY(rule) r_entry; enum decision r_decision; uint8_t r_nottag; -- cgit v1.2.3