Skip to content

Commit

Permalink
Исправлены небольшие ошибки
Browse files Browse the repository at this point in the history
  • Loading branch information
max197616 committed Mar 2, 2018
1 parent 58b7d68 commit 14741d6
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/flow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ static int compare_ipv6(const void *key1, const void *key2, size_t key_len)
flow->proto == pkt_infos->proto);
else if(direction==2)
return !(flow->port_src == pkt_infos->port_dst &&
flow->port_src == pkt_infos->port_dst &&
flow->proto ==pkt_infos->proto);
flow->port_dst == pkt_infos->port_src &&
flow->proto == pkt_infos->proto);
else
return 1;

Expand Down
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void extFilter::initParams()
memset(prm, 0, sizeof(global_params_t));

int scale = config().getInt("dpi.scale", 10);
if(scale < 1 && scale > 10)
if(scale < 1 || scale > 10)
{
throw Poco::Exception("scale must be between 1..10");
}
Expand Down Expand Up @@ -609,7 +609,7 @@ int extFilter::_check_lcore_params(void)
logger().error("Lcore %d is not enabled in lcore mask", (int) lcore);
return -1;
}
if ((socketid = rte_lcore_to_socket_id(lcore) != 0) && (_numa_on == 0))
if ((socketid = rte_lcore_to_socket_id(lcore)) != 0 && _numa_on == 0)
{
logger().warning("Lcore %d is on socket %d with numa off", (int) lcore, (int) socketid);
}
Expand Down
6 changes: 3 additions & 3 deletions src/sender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ void BSender::sendPacket(void *ip_from, void *ip_to, int ip_ver, int port_from,
// Send the packet
if(Send((uint8_t *)&datagram, pkt_len,(struct sockaddr *)&sin, sizeof(sin)) < 0 )
{
Poco::Net::IPAddress ipa(ip_to, ip_ver == 4 ? sizeof(in_addr) : sizeof(in6_addr));
Poco::Net::IPAddress ipa(ip_to, sizeof(in_addr));
_logger.error("sendto() failed to %s:%d errno: %d",ipa.toString(), port_to, errno);
}
} else {
// Send the packet
if(Send((uint8_t *)&datagram, pkt_len, (struct sockaddr *)&sin6, sizeof(sin6)) < 0 )
{
Poco::Net::IPAddress ipa(ip_to, ip_ver == 4 ? sizeof(in_addr) : sizeof(in6_addr));
Poco::Net::IPAddress ipb(ip_from, ip_ver == 4 ? sizeof(in_addr) : sizeof(in6_addr));
Poco::Net::IPAddress ipa(ip_to, sizeof(in6_addr));
Poco::Net::IPAddress ipb(ip_from, sizeof(in6_addr));
_logger.error("sendto() failed to [%s]:%d from [%s]:%d errno: %d", ipa.toString(), ntohs(port_to), ipb.toString(), ntohs(port_from), errno);
}
}
Expand Down
1 change: 0 additions & 1 deletion src/tries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ int TriesManager::checkURLBlocked(int thread_id, const char *hostname, uint32_t
{
buf_len = sizeof(revhostname)-1;
host_len = sizeof(revhostname)-1;
host_len = sizeof(revhostname)-1;
url_entry = &url_buf[sizeof(revhostname)-1];
rhost = &revhostname[0];
uri_len = 0;
Expand Down
6 changes: 3 additions & 3 deletions src/worker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ dpi_identification_result_t WorkerThread::getAppProtocol(uint8_t *host_key, uint
{
node->cmn.blocked = true;
} else {
if(_need_block == false && pkt_infos->data_length > 0 && node->cmn.blocked)
if(pkt_infos->data_length > 0 && node->cmn.blocked)
{
switch (r.protocol.l7prot)
{
Expand All @@ -487,7 +487,7 @@ dpi_identification_result_t WorkerThread::getAppProtocol(uint8_t *host_key, uint
{
node_ipv6->cmn.blocked = true;
} else {
if(_need_block == false && pkt_infos->data_length > 0 && node_ipv6->cmn.blocked)
if(pkt_infos->data_length > 0 && node_ipv6->cmn.blocked)
{
switch (r.protocol.l7prot)
{
Expand Down Expand Up @@ -658,7 +658,7 @@ bool WorkerThread::analyzePacket(struct rte_mbuf* m, uint64_t timestamp)
{
if(m_WorkerConfig.block_ssl_no_sni)
{
if(acl_action == ACL::ACL_SSL && payload_len > 0)
if(acl_action == ACL::ACL_SSL)
{
m_ThreadStats.matched_ssl_ip++;
if(ip_version == 4)
Expand Down

0 comments on commit 14741d6

Please sign in to comment.