Lines Matching defs:rule
395 Log(("NAT: LibAlias default rule wasn't initialized\n"));
396 AssertMsgFailed(("NAT: LibAlias default rule wasn't initialized\n"));
492 struct port_forward_rule *rule;
517 LIST_FOREACH(rule, &pData->port_forward_rule_head, list)
519 rule->activated = 0;
1528 struct port_forward_rule *rule, *tmp;
1532 LIST_FOREACH_SAFE(rule, &pData->port_forward_rule_head, list, tmp)
1541 if (rule->activated)
1551 if ( rule->guest_addr.s_addr != guest_addr
1552 && rule->guest_addr.s_addr != INADDR_ANY)
1554 if (rule->guest_addr.s_addr == INADDR_ANY)
1555 rule->guest_addr.s_addr = guest_addr;
1558 rule->proto == IPPROTO_UDP ? "UDP" : "TCP",
1559 rule->bind_ip.s_addr, rule->host_port,
1560 guest_addr, rule->guest_port));
1562 if (rule->proto == IPPROTO_UDP)
1563 so = udp_listen(pData, rule->bind_ip.s_addr, RT_H2N_U16(rule->host_port), guest_addr,
1564 RT_H2N_U16(rule->guest_port), 0);
1566 so = solisten(pData, rule->bind_ip.s_addr, RT_H2N_U16(rule->host_port), guest_addr,
1567 RT_H2N_U16(rule->guest_port), 0);
1582 rule->activated = 1;
1583 rule->so = so;
1589 (rule->proto == IPPROTO_UDP ? "UDP" : "TCP"),
1590 rule->bind_ip.s_addr, rule->host_port,
1591 guest_addr, rule->guest_port));
1592 LIST_REMOVE(rule, list);
1594 RTMemFree(rule);
1613 struct port_forward_rule *rule = NULL;
1614 LIST_FOREACH(rule, &pData->port_forward_rule_head, list)
1616 if ( rule->proto == (is_udp ? IPPROTO_UDP : IPPROTO_TCP)
1617 && rule->host_port == host_port
1618 && rule->bind_ip.s_addr == host_addr.s_addr
1619 && rule->guest_port == guest_port
1620 && rule->guest_addr.s_addr == guest_addr.s_addr
1622 return 0; /* rule has been already registered */
1625 rule = RTMemAllocZ(sizeof(struct port_forward_rule));
1626 if (rule == NULL)
1629 rule->proto = (is_udp ? IPPROTO_UDP : IPPROTO_TCP);
1630 rule->host_port = host_port;
1631 rule->guest_port = guest_port;
1632 rule->guest_addr.s_addr = guest_addr.s_addr;
1633 rule->bind_ip.s_addr = host_addr.s_addr;
1635 memcpy(rule->mac_address, ethaddr, ETH_ALEN);
1637 LIST_INSERT_HEAD(&pData->port_forward_rule_head, rule, list);
1649 struct port_forward_rule *rule = NULL;
1650 LIST_FOREACH(rule, &pData->port_forward_rule_head, list)
1652 if ( rule->proto == (is_udp ? IPPROTO_UDP : IPPROTO_TCP)
1653 && rule->host_port == host_port
1654 && rule->guest_port == guest_port
1655 && rule->bind_ip.s_addr == host_addr.s_addr
1656 && rule->guest_addr.s_addr == guest_addr.s_addr
1657 && rule->activated)
1660 rule->proto == IPPROTO_UDP ? "UDP" : "TCP",
1661 rule->bind_ip.s_addr, rule->host_port,
1662 guest_addr.s_addr, rule->guest_port));
1665 udp_detach(pData, rule->so);
1667 tcp_close(pData, sototcpcb(rule->so));
1668 LIST_REMOVE(rule, list);
1669 RTMemFree(rule);
2060 struct port_forward_rule *rule;
2084 LIST_FOREACH(rule, &pData->port_forward_rule_head, list)
2087 rule->proto == IPPROTO_UDP ? "UDP" : "TCP",
2088 rule->host_port, rule->guest_addr.s_addr, rule->guest_port,
2089 rule->activated ? ' ' : '*');