Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1044,8 +1044,12 @@ void ContextImpl::tickSearch(SearchKind kind, bool poked)
// flags and reserved.
// initially flags[7] is cleared (bcast)
auto pflags = M.save();
to_wire(M, uint8_t(kind == SearchKind::discover ?
pva_search_flags::MustReply : 0u)); // must-reply to discovery, ignore regular negative search
to_wire(M, uint8_t(
// must-reply to discovery, ignore regular negative search
(kind == SearchKind::discover ? pva_search_flags::MustReply : 0u)
| pva_search_flags::ReplySrcPort
)
);
to_wire(M, uint8_t(0u));
to_wire(M, uint16_t(0u));

Expand Down
23 changes: 13 additions & 10 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ SockEndpoint::SockEndpoint(const char* ep, uint16_t defport)
iface = at+1;
}

auto& ifmap = IfaceMap::instance();
auto ifmap(IfaceMap::instance());

if(addr.family()==AF_INET6) {
if(iface.empty() && addr->in6.sin6_scope_id) {
Expand Down Expand Up @@ -90,7 +90,7 @@ MCastMembership SockEndpoint::resolve() const
if(!addr.isMCast())
throw std::logic_error("not mcast");

auto& ifmap = IfaceMap::instance();
auto ifmap(IfaceMap::instance());

MCastMembership m;
m.af = addr.family();
Expand Down Expand Up @@ -282,7 +282,8 @@ void printAddresses(std::vector<std::string>& out, const std::vector<SockEndpoin
// Fill out address list by appending broadcast addresses
// of any and all local interface addresses already included
void expandAddrList(const std::vector<SockEndpoint>& ifaces,
std::vector<SockEndpoint>& addrs)
std::vector<SockEndpoint>& addrs,
const IfaceMap& ifmap)
{
SockAttach attach;
evsocket dummy(AF_INET, SOCK_DGRAM, 0);
Expand All @@ -307,9 +308,9 @@ void expandAddrList(const std::vector<SockEndpoint>& ifaces,
}

void addGroups(std::vector<SockEndpoint>& ifaces,
const std::vector<SockEndpoint>& addrs)
const std::vector<SockEndpoint>& addrs,
const IfaceMap& ifmap)
{
auto& ifmap = IfaceMap::instance();
std::set<std::string> allifaces;

for(const auto& addr : addrs) {
Expand Down Expand Up @@ -492,7 +493,7 @@ void Config::expand()
ifaces.emplace_back(SockAddr::any(AF_INET));
}

auto& ifmap = IfaceMap::instance();
auto ifmap(IfaceMap::instance());

for(size_t i=0; i<ifaces.size(); i++) {
auto& ep = ifaces[i];
Expand All @@ -512,8 +513,8 @@ void Config::expand()
// use interface list add ipv4 broadcast addresses to beaconDestinations.
// 0.0.0.0 -> adds all bcasts
// otherwise add bcast for each iface address
expandAddrList(ifaces, bdest);
addGroups(ifaces, bdest);
expandAddrList(ifaces, bdest, ifmap);
addGroups(ifaces, bdest, ifmap);
auto_beacon = false;
}

Expand Down Expand Up @@ -622,6 +623,8 @@ void Config::updateDefs(defs_t& defs) const

void Config::expand()
{
auto ifmap(IfaceMap::instance());

if(udp_port==0)
throw std::runtime_error("Client can't use UDP random port");

Expand All @@ -635,8 +638,8 @@ void Config::expand()
ifaces.emplace_back(SockAddr::any(AF_INET));

if(autoAddrList) {
expandAddrList(ifaces, addrs);
addGroups(ifaces, addrs);
expandAddrList(ifaces, addrs, ifmap);
addGroups(ifaces, addrs, ifmap);
autoAddrList = false;
}

Expand Down
Loading
Loading