MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ClearFWHole

Function ClearFWHole

freebsd/netinet/libalias/alias_db.c:2760–2780  ·  view source on GitHub ↗

Remove a hole in a firewall associated with a particular alias lnk. Calling this too often is harmless. */

Source from the content-addressed store, hash-verified

2758/* Remove a hole in a firewall associated with a particular alias
2759 lnk. Calling this too often is harmless. */
2760static void
2761ClearFWHole(struct alias_link *lnk)
2762{
2763 struct libalias *la;
2764
2765 la = lnk->la;
2766 if (lnk->link_type == LINK_TCP) {
2767 int fwhole = lnk->data.tcp->fwhole; /* Where is the firewall
2768 * hole? */
2769 struct ip_fw rule;
2770
2771 if (fwhole < 0)
2772 return;
2773
2774 memset(&rule, 0, sizeof rule); /* useless for ipfw2 */
2775 while (!setsockopt(la->fireWallFD, IPPROTO_IP, IP_FW_DEL,
2776 &fwhole, sizeof fwhole));
2777 fw_clrfield(la, la->fireWallField, fwhole);
2778 lnk->data.tcp->fwhole = -1;
2779 }
2780}
2781
2782/* Clear out the entire range dedicated to firewall holes. */
2783static void

Callers 1

DeleteLinkFunction · 0.85

Calls 2

memsetFunction · 0.85
setsockoptFunction · 0.50

Tested by

no test coverage detected