Permalink
Browse files

added info message on nat ip pool overflow

  • Loading branch information...
seuffert
seuffert committed May 12, 2011
1 parent b18c560 commit 7b4b91f8a5da2428d00e14f184b57fa545e9467f
Showing with 13 additions and 5 deletions.
  1. +13 −5 XBSlink/xbs_nat.cs
View
@@ -222,6 +222,8 @@ class xbs_nat
public xbs_nat_ippool ip_pool = new xbs_nat_ippool();
private Dictionary<PhysicalAddress, xbs_nat_entry> NAT_list = new Dictionary<PhysicalAddress, xbs_nat_entry>();
+ private bool natIPpoolOverflow_warning_shown = false;
+
public xbs_nat()
{
}
@@ -293,15 +295,21 @@ public EthernetPacketType NAT_incoming_packet_PacketDotNet(ref byte[] data, Phys
nat_entry = ip_pool.requestIP(sourceIP, srcMAC);
if (nat_entry == null)
{
-#if DEBUG
- xbs_messages.addInfoMessage("!! % out of NAT IPs. Could not nat incoming packet", xbs_message_sender.NAT, xbs_message_type.WARNING);
-#endif
+ if (!natIPpoolOverflow_warning_shown)
+ {
+ natIPpoolOverflow_warning_shown = true;
+ xbs_messages.addInfoMessage("!! % out of NAT IPs. Could not NAT incoming packet", xbs_message_sender.NAT, xbs_message_type.WARNING);
+ }
return p_type;
}
- NAT_list.Add(srcMAC, nat_entry);
+ else
+ {
+ natIPpoolOverflow_warning_shown = false;
+ NAT_list.Add(srcMAC, nat_entry);
#if DEBUG
- xbs_messages.addDebugMessage("% new device in NAT list: " + srcMAC + " " + nat_entry.original_source_ip + "=>" + nat_entry.natted_source_ip, xbs_message_sender.NAT);
+ xbs_messages.addDebugMessage("% new device in NAT list: " + srcMAC + " " + nat_entry.original_source_ip + "=>" + nat_entry.natted_source_ip, xbs_message_sender.NAT);
#endif
+ }
}
else
{

0 comments on commit 7b4b91f

Please sign in to comment.