diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-08-28 15:25:49 -0400 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-08-28 15:25:49 -0400 |
| commit | 8e1b897f0ae8a228799058153e9dda0a18aeb4c1 (patch) | |
| tree | 3a99209553868b39808d95e542b47eaddec635c6 | |
| parent | 3745377872fe89cc06fb08de9b998c64c31e765c (diff) | |
| download | infinitytier-8e1b897f0ae8a228799058153e9dda0a18aeb4c1.tar.gz infinitytier-8e1b897f0ae8a228799058153e9dda0a18aeb4c1.zip | |
Add etherTypes to netconf response.
| -rw-r--r-- | netconf-service/netconf.cpp | 14 | ||||
| -rw-r--r-- | node/Filter.cpp | 2 |
2 files changed, 14 insertions, 2 deletions
diff --git a/netconf-service/netconf.cpp b/netconf-service/netconf.cpp index bf64fff1..65ee6268 100644 --- a/netconf-service/netconf.cpp +++ b/netconf-service/netconf.cpp @@ -121,7 +121,6 @@ int main(int argc,char **argv) dbCon = new Connection(mysqlDatabase,mysqlHost,mysqlUser,mysqlPassword,(unsigned int)strtol(mysqlPort,(char **)0,10)); if (dbCon->connected()) { fprintf(stderr,"connected to mysql server successfully\n"); - break; } else { fprintf(stderr,"unable to connect to database server\n"); return -1; @@ -232,6 +231,18 @@ int main(int argc,char **argv) } } + std::string etherTypeWhitelist; + { + Query q = dbCon->query(); + q << "SELECT DISTINCT etherType FROM NetworkEthertypes WHERE Network_id = " << nwid; + StoreQueryResult rs = q.store(); + for(unsigned long i=0;i<rs.num_rows();++i) { + if (etherTypeWhitelist.length() > 0) + etherTypeWhitelist.push_back(','); + etherTypeWhitelist.append(rs[i]["etherType"].c_str()); + } + } + Dictionary netconf; netconf["peer"] = peerIdentity.address().toString(); @@ -240,6 +251,7 @@ int main(int argc,char **argv) netconf["isOpen"] = (isOpen ? "1" : "0"); netconf["name"] = name; netconf["desc"] = desc; + netconf["etherTypes"] = etherTypeWhitelist; sprintf(buf,"%llx",(unsigned long long)Utils::now()); netconf["ts"] = buf; diff --git a/node/Filter.cpp b/node/Filter.cpp index d41589d6..75a7036a 100644 --- a/node/Filter.cpp +++ b/node/Filter.cpp @@ -263,7 +263,7 @@ Filter::Filter(const char *s) throw std::invalid_argument("filter string too long"); char *saveptr = (char *)0; unsigned int fn = 0; - for(char *f=Utils::stok(tmp,"-",&saveptr);(f);f=Utils::stok((char *)0,"-",&saveptr)) { + for(char *f=Utils::stok(tmp,",",&saveptr);(f);f=Utils::stok((char *)0,",",&saveptr)) { try { _rules.push_back(Rule(f)); ++fn; |
