head 1.4; access; symbols pkgsrc-2013Q2:1.4.0.8 pkgsrc-2013Q2-base:1.4 pkgsrc-2012Q4:1.4.0.6 pkgsrc-2012Q4-base:1.4 pkgsrc-2011Q4:1.4.0.4 pkgsrc-2011Q4-base:1.4 pkgsrc-2011Q2:1.4.0.2 pkgsrc-2011Q2-base:1.4 pkgsrc-2010Q4:1.3.0.28 pkgsrc-2010Q4-base:1.3 pkgsrc-2010Q3:1.3.0.26 pkgsrc-2010Q3-base:1.3 pkgsrc-2010Q2:1.3.0.24 pkgsrc-2010Q2-base:1.3 pkgsrc-2010Q1:1.3.0.22 pkgsrc-2010Q1-base:1.3 pkgsrc-2009Q4:1.3.0.20 pkgsrc-2009Q4-base:1.3 pkgsrc-2009Q3:1.3.0.18 pkgsrc-2009Q3-base:1.3 pkgsrc-2009Q2:1.3.0.16 pkgsrc-2009Q2-base:1.3 pkgsrc-2009Q1:1.3.0.14 pkgsrc-2009Q1-base:1.3 pkgsrc-2008Q4:1.3.0.12 pkgsrc-2008Q4-base:1.3 pkgsrc-2008Q3:1.3.0.10 pkgsrc-2008Q3-base:1.3 cube-native-xorg:1.3.0.8 cube-native-xorg-base:1.3 pkgsrc-2008Q2:1.3.0.6 pkgsrc-2008Q2-base:1.3 cwrapper:1.3.0.4 pkgsrc-2008Q1:1.3.0.2 pkgsrc-2008Q1-base:1.3 pkgsrc-2007Q4:1.1.0.2 pkgsrc-2007Q4-base:1.1; locks; strict; comment @# @; 1.4 date 2011.03.19.19.59.47; author spz; state dead; branches; next 1.3; 1.3 date 2008.01.14.12.39.55; author spz; state Exp; branches; next 1.2; 1.2 date 2008.01.05.14.35.22; author spz; state Exp; branches; next 1.1; 1.1 date 2007.12.31.09.15.15; author spz; state Exp; branches; next ; desc @@ 1.4 log @remove obsolete irrtoolset-nox11 @ text @$NetBSD: patch-dj,v 1.3 2008/01/14 12:39:55 spz Exp $ --- src/irr/rawhoisc.cc.orig 2007-02-13 01:25:01.000000000 +0100 +++ src/irr/rawhoisc.cc @@@@ -557,26 +557,61 @@@@ bool RAWhoisClient::expandAS(char *as, } bool RAWhoisClient::expandASSet(SymID asset, SetOfUInt *result) { - char *response; - if (!QueryResponse(response, "!i%s,1", asset)) return false; - for (char *word = strtok(response, " \t\n"); - word; - word = strtok(NULL, " \t\n")) - result->add(atoi(word+2)); - if (response) - delete [] response; + Set *set = NULL; + if (queryCache(asset, set)) { + AttrGenericIterator itr(set, "members"); + for (Item *pt = itr.first(); pt; pt = itr.next()) { + if (typeid(*pt) == typeid(ItemASNAME)) { // ASNAME (aka as-set) + const SetOfUInt *tmp = IRR::expandASSet(((ItemASNAME *)pt)->name); + if (tmp) + *result |= *(SetOfUInt *) tmp; + } else { + if (typeid(*pt) == typeid(ItemASNO)) { + result->add(((ItemASNO *)pt)->asno); + } else { + cerr << "WARNING: irrd/rawhoisd cannot resolve as-set " << asset << "!"; + cerr << "Unknown element found in as-set definition!\n"; + } + } + if (set) + delete [] set; + } + } else { + char *response; + if (!QueryResponse(response, "!i%s,1", asset)) return false; + for (char *word = strtok(response, " \t\n"); + word; + word = strtok(NULL, " \t\n")) + result->add(atoi(word+2)); + if (response) + delete [] response; + } return true; } bool RAWhoisClient::expandRSSet(SymID rsset, MPPrefixRanges *result) { - char *response; - if (!QueryResponse(response, "!i%s,1", rsset)) return false; - for (char *word = strtok(response, " \t\n"); - word; - word = strtok(NULL, " \t\n")) - result->push_back(MPPrefix(word)); - if (response) - delete [] response; + Set *set = NULL; + if (queryCache(rsset, set)) { + AttrGenericIterator itr(set, "members"); + for (Item *pt = itr.first(); pt; pt = itr.next()) { + expandItem(pt, result); + } + AttrGenericIterator itr1(set, "mp-members"); + for (Item *pt = itr1.first(); pt; pt = itr1.next()) { + expandItem(pt, result); + } + if (set) + delete [] set; + } else { + char *response; + if (!QueryResponse(response, "!i%s,1", rsset)) return false; + for (char *word = strtok(response, " \t\n"); + word; + word = strtok(NULL, " \t\n")) + result->push_back(MPPrefix(word)); + if (response) + delete [] response; + } return true; } @ 1.3 log @reduced Hagen Boehms cache patch to the bare minimum nececssary and also adding a pair of extra {}. It's a marvel what these can do for you. :) Thanks to Daryl Collins for bringing the problem to my attention. @ text @d1 1 a1 1 $NetBSD$ @ 1.2 log @Hagen Boehms cache patch broke RAWhoisClient::getSet for all objects but RSSets and ASSets, which are also getting served by this function (so that eg "peval -compressed fltr-bogons" no longer worked). Revert the change to RAWhoisClient::getSet; introduce RAWhoisClient::getASSet for ASSets and RSSets and use that in RAWhoisClient::expandASSet and RAWhoisClient::expandRSSet @ text @d5 1 a5 14 @@@@ -516,6 +516,12 @@@@ bool RAWhoisClient::getAutNum(char *as, return len; } +// get asset or rsset +bool RAWhoisClient::getASSet(SymID sname, char *&text, int &len) { + len = QueryResponse(text, "!i%s,1", sname); + return len; +} + bool RAWhoisClient::getSet(SymID sname, char *clss, char *&text, int &len) { len = QueryResponse(text, "!m%s,%s", clss, sname); return len; @@@@ -557,26 +563,58 @@@@ bool RAWhoisClient::expandAS(char *as, a17 1 + d20 1 a20 1 + for (Item *pt = itr.first(); pt; pt = itr.next()) a24 2 + } else if (typeid(*pt) == typeid(ItemASNO)) { + result->add(((ItemASNO *)pt)->asno); d26 6 a31 2 + cerr << "WARNING: irrd/rawhoisd cannot resolve as-set " << asset << "!"; + cerr << "Unknown element found in as-set definition!\n"; d33 3 a35 1 + if (set != NULL) free (set); d37 8 a44 7 + char *text; + int len; + if (getASSet(asset, text, len)) { + for (char *word = strtok(text, " \t\n"); word; word = strtok(NULL, "\t\n")) + result->add(atoi(word+2)); + } + if (text != NULL) free(text); a45 1 + d59 1 a59 2 + + if (queryCache(rsset, set)) { d68 2 a69 1 + if (set != NULL) free (set); d71 8 a78 7 + char *text; + int len; + if (getASSet(rsset, text, len)) { + for (char *word = strtok(text, " \t\n"); word; word = strtok(NULL, "\t\n")) + result->push_back(MPPrefix(word)); + } + if (text != NULL) free(text); a79 1 + @ 1.1 log @sneaking in an update for a quite leafy package :) - remove patches/patch-bv since if you use gmake it's for a generated file, even if the original tar contains it (and the diff grows rather large due to differing yacc versions) - add irrd-cache-usage-patch by Hagen Boehm - add JunOS @@RtConfig import patch by Stan Barber - add IPv6 ACL list numbers patch by Timo Koehler @ text @d5 2 a6 1 @@@@ -517,7 +517,7 @@@@ bool RAWhoisClient::getAutNum(char *as, d9 6 d16 1 a16 2 - len = QueryResponse(text, "!m%s,%s", clss, sname); + len = QueryResponse(text, "!i%s,1", sname); d18 1 a18 3 } @@@@ -557,26 +557,58 @@@@ bool RAWhoisClient::expandAS(char *as, d49 1 a49 1 + if (getSet(asset, "as-set", text, len)) { d83 1 a83 1 + if (getSet(rsset, "route-set", text, len)) { @