Add support for static rules
This commit is contained in:
parent
9bf5799109
commit
869fdbca2a
@ -77,10 +77,17 @@ bool conf::setup(cfg_t *cfg)
|
||||
|
||||
std::string ifname(cfg_getstr(rule_cfg, "iface"));
|
||||
|
||||
if(ifname == "")
|
||||
if(ifname.empty())
|
||||
{
|
||||
if(addr.prefix() <= 120)
|
||||
NCE("Static rule prefix /%d <= 120 - is this what you want?", addr.prefix());
|
||||
|
||||
pr->add_rule(addr);
|
||||
}
|
||||
else
|
||||
{
|
||||
pr->add_rule(addr, iface::open_ifd(ifname));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
17
src/proxy.cc
17
src/proxy.cc
@ -89,14 +89,25 @@ void proxy::handle_solicit(const address& saddr, const address& daddr,
|
||||
for(std::list<strong_ptr<rule> >::iterator it = _rules.begin();
|
||||
it != _rules.end(); it++)
|
||||
{
|
||||
DBG("comparing %s against %s",
|
||||
(*it)->addr().to_string().c_str(), taddr.to_string().c_str());
|
||||
strong_ptr<rule> ru = *it;
|
||||
|
||||
if((*it)->addr() == taddr)
|
||||
DBG("comparing %s against %s",
|
||||
ru->addr().to_string().c_str(), taddr.to_string().c_str());
|
||||
|
||||
if(ru->addr() == taddr)
|
||||
{
|
||||
if(se.is_null())
|
||||
se = session::create(_ptr, saddr, daddr, taddr);
|
||||
|
||||
if(ru->ifa().is_null())
|
||||
{
|
||||
// This rule doesn't have an interface, and thus we'll consider
|
||||
// it "static" and immediately send the response.
|
||||
|
||||
se->handle_advert();
|
||||
return;
|
||||
}
|
||||
|
||||
se->add_iface((*it)->ifa());
|
||||
}
|
||||
}
|
||||
|
@ -136,4 +136,9 @@ int session::status() const
|
||||
return _status;
|
||||
}
|
||||
|
||||
void session::status(int val)
|
||||
{
|
||||
_status = val;
|
||||
}
|
||||
|
||||
__NDPPD_NS_END
|
||||
|
@ -72,6 +72,8 @@ public:
|
||||
|
||||
int status() const;
|
||||
|
||||
void status(int val);
|
||||
|
||||
void handle_advert();
|
||||
|
||||
void send_advert();
|
||||
|
Loading…
x
Reference in New Issue
Block a user