Skip to content

Commit

Permalink
Close new Agent DNS XMPP connections until end-of-config is detected.
Browse files Browse the repository at this point in the history
Closes-Bug:1605341

Provide path to store the session key generated for dynamic updates
Closes-Bug:1400879

Change-Id: I2965b6039a20715024b2fb69ff9554ca9df14078
  • Loading branch information
nipak committed Aug 8, 2016
1 parent 2835a7e commit ba40694
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/dns/agent/agent_xmpp_channel.cc
Expand Up @@ -192,6 +192,13 @@ DnsAgentXmppChannelManager::HandleXmppChannelEvent(XmppChannel *channel,
DnsAgentXmppChannel *agent_xmpp_channel =
new DnsAgentXmppChannel(channel, this);
channel_map_.insert(std::make_pair(channel, agent_xmpp_channel));
IFMapManager *ifmap_manager =
Dns::GetDnsManager()->get_ifmap_manager();
if (ifmap_manager && !ifmap_manager->GetEndOfRibComputed()) {
DNS_XMPP_TRACE(DnsXmppTrace, "Peer:" + channel->PeerAddress() +
" Close due to EndofRib not computed");
channel->Close();
}
}
} else if (state == xmps::NOT_READY) {
if (it != channel_map_.end()) {
Expand Down
6 changes: 6 additions & 0 deletions src/dns/bind/named_config.cc
Expand Up @@ -23,6 +23,7 @@ const string NamedConfig::NamedZoneFileSuffix = "zone";
const string NamedConfig::NamedZoneNSPrefix = "contrail-ns";
const string NamedConfig::NamedZoneMXPrefix = "contrail-mx";
const char NamedConfig::pid_file_name[] = "contrail-named.pid";
const char NamedConfig::sessionkey_file_name[] = "session.key";

void NamedConfig::Init(const std::string& named_config_dir,
const std::string& named_config_file,
Expand Down Expand Up @@ -178,6 +179,7 @@ void NamedConfig::WriteOptionsConfig() {
file_ << " managed-keys-directory \"" << named_config_dir_ << "\";" << endl;
file_ << " empty-zones-enable no;" << endl;
file_ << " pid-file \"" << GetPidFilePath() << "\";" << endl;
file_ << " session-keyfile \"" << GetSessionKeyFilePath() << "\";" << endl;
file_ << " listen-on port " << Dns::GetDnsPort() << " { any; };" << endl;
file_ << " allow-query { any; };" << endl;
file_ << " allow-recursion { any; };" << endl;
Expand Down Expand Up @@ -353,6 +355,10 @@ string NamedConfig::GetPidFilePath() {
return (named_config_dir_ + pid_file_name);
}

string NamedConfig::GetSessionKeyFilePath() {
return (named_config_dir_ + sessionkey_file_name);
}

string NamedConfig::GetZoneNSName(const string domain_name) {
return (NamedZoneNSPrefix + "." + domain_name);
}
Expand Down
6 changes: 6 additions & 0 deletions src/dns/bind/named_config.h
Expand Up @@ -51,6 +51,7 @@ class NamedConfig {
static const std::string NamedZoneNSPrefix;
static const std::string NamedZoneMXPrefix;
static const char pid_file_name[];
static const char sessionkey_file_name[];
static const int NameWidth = 30;
static const int NumberWidth = 10;
static const int TypeWidth = 4;
Expand Down Expand Up @@ -103,8 +104,12 @@ class NamedConfig {
const std::string &name);
virtual std::string GetResolveFile() { return "/etc/resolv.conf"; }
std::string GetPidFilePath();
std::string GetSessionKeyFilePath();
const std::string &named_config_dir() const { return named_config_dir_; }
const std::string &named_config_file() const { return named_config_file_; }
const std::string &named_sessionkey_file() const {
return named_sessionkey_file_;
}

protected:
void CreateRndcConf();
Expand All @@ -130,6 +135,7 @@ class NamedConfig {
std::ofstream file_;
std::string named_config_file_;
std::string named_config_dir_;
std::string named_sessionkey_file_;
std::string named_log_file_;
std::string rndc_config_file_;
std::string rndc_secret_;
Expand Down
1 change: 1 addition & 0 deletions src/dns/testdata/named.conf.1
Expand Up @@ -3,6 +3,7 @@ options {
managed-keys-directory "./";
empty-zones-enable no;
pid-file "./contrail-named.pid";
session-keyfile "./session.key";
listen-on port 53 { any; };
allow-query { any; };
allow-recursion { any; };
Expand Down
1 change: 1 addition & 0 deletions src/dns/testdata/named.conf.2
Expand Up @@ -3,6 +3,7 @@ options {
managed-keys-directory "./";
empty-zones-enable no;
pid-file "./contrail-named.pid";
session-keyfile "./session.key";
listen-on port 53 { any; };
allow-query { any; };
allow-recursion { any; };
Expand Down
1 change: 1 addition & 0 deletions src/dns/testdata/named.conf.3
Expand Up @@ -3,6 +3,7 @@ options {
managed-keys-directory "./";
empty-zones-enable no;
pid-file "./contrail-named.pid";
session-keyfile "./session.key";
listen-on port 53 { any; };
allow-query { any; };
allow-recursion { any; };
Expand Down
1 change: 1 addition & 0 deletions src/dns/testdata/named.conf.4
Expand Up @@ -3,6 +3,7 @@ options {
managed-keys-directory "./";
empty-zones-enable no;
pid-file "./contrail-named.pid";
session-keyfile "./session.key";
listen-on port 53 { any; };
allow-query { any; };
allow-recursion { any; };
Expand Down
1 change: 1 addition & 0 deletions src/dns/testdata/named.conf.5
Expand Up @@ -3,6 +3,7 @@ options {
managed-keys-directory "./";
empty-zones-enable no;
pid-file "./contrail-named.pid";
session-keyfile "./session.key";
listen-on port 53 { any; };
allow-query { any; };
allow-recursion { any; };
Expand Down
1 change: 1 addition & 0 deletions src/dns/testdata/named.conf.6
Expand Up @@ -3,6 +3,7 @@ options {
managed-keys-directory "./";
empty-zones-enable no;
pid-file "./contrail-named.pid";
session-keyfile "./session.key";
listen-on port 53 { any; };
allow-query { any; };
allow-recursion { any; };
Expand Down
1 change: 1 addition & 0 deletions src/dns/testdata/named.conf.7
Expand Up @@ -3,6 +3,7 @@ options {
managed-keys-directory "./";
empty-zones-enable no;
pid-file "./contrail-named.pid";
session-keyfile "./session.key";
listen-on port 53 { any; };
allow-query { any; };
allow-recursion { any; };
Expand Down
1 change: 1 addition & 0 deletions src/dns/testdata/named.conf.8
Expand Up @@ -3,6 +3,7 @@ options {
managed-keys-directory "./";
empty-zones-enable no;
pid-file "./contrail-named.pid";
session-keyfile "./session.key";
listen-on port 53 { any; };
allow-query { any; };
allow-recursion { any; };
Expand Down
1 change: 1 addition & 0 deletions src/dns/testdata/named.conf.9
Expand Up @@ -3,6 +3,7 @@ options {
managed-keys-directory "./";
empty-zones-enable no;
pid-file "./contrail-named.pid";
session-keyfile "./session.key";
listen-on port 53 { any; };
allow-query { any; };
allow-recursion { any; };
Expand Down
1 change: 1 addition & 0 deletions src/dns/testdata/named.conf.rr_ext_disabled
Expand Up @@ -3,6 +3,7 @@ options {
managed-keys-directory "./";
empty-zones-enable no;
pid-file "./contrail-named.pid";
session-keyfile "./session.key";
listen-on port 53 { any; };
allow-query { any; };
allow-recursion { any; };
Expand Down
1 change: 1 addition & 0 deletions src/dns/testdata/named.conf.rr_ext_disabled.2
Expand Up @@ -3,6 +3,7 @@ options {
managed-keys-directory "./";
empty-zones-enable no;
pid-file "./contrail-named.pid";
session-keyfile "./session.key";
listen-on port 53 { any; };
allow-query { any; };
allow-recursion { any; };
Expand Down

0 comments on commit ba40694

Please sign in to comment.