From cac607bd8850e00356e4d97b05e7c8adfb3fa640 Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Tue, 18 Jan 2011 17:17:46 +0100 Subject: Show correct line numbers in restore output for parser errors Parser errors are reported by a wrong lineno at restore, bug reported by Holger Eitzenberger: create foo6 hash:ip hashsize 64 family inet6 add foo6 20a1:1234:5678::/64 add foo6 20a1:1234:5679::/64 you get: ipset v5.2: Error in line 1: Syntax error: plain IP address must be supplied: 20a1:1234:5678::/64 Should be line 2 though. The solution is to set the session lineno before parsing. --- lib/session.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib') diff --git a/lib/session.c b/lib/session.c index 311e5df..a193143 100644 --- a/lib/session.c +++ b/lib/session.c @@ -98,6 +98,19 @@ ipset_saved_type(const struct ipset_session *session) return session->saved_type; } +/** + * ipset_session_lineno - set session lineno + * @session: session structure + * + * Set session lineno to report parser errors correctly. + */ +void +ipset_session_lineno(struct ipset_session *session, uint32_t lineno) +{ + assert(session); + session->lineno = lineno; +} + /* * Environment options */ -- cgit v1.2.3