Lines Matching full:lnk

207 GetNewPort(struct libalias *la, struct alias_link *lnk, int alias_port_param)  in GetNewPort()  argument
227 lnk->alias_port = (u_short) alias_port_param; in GetNewPort()
241 lnk->link_type == LINK_UDP) { in GetNewPort()
246 la, lnk->src_addr, lnk->src_port, lnk->link_type); in GetNewPort()
248 lnk->alias_port = search_result->alias_port; in GetNewPort()
260 ? lnk->src_port in GetNewPort()
268 grp = StartPointIn(la, lnk->alias_addr, port, lnk->link_type, 0); in GetNewPort()
276 lnk->link_type == LINK_UDP) in GetNewPort()
280 if (lnk->dst_addr.s_addr == in GetNewPort()
282 lnk->dst_port == search_result->dst_port) in GetNewPort()
299 (lnk->flags & LINK_PARTIALLY_SPECIFIED) && in GetNewPort()
300 ((lnk->link_type == LINK_TCP) || in GetNewPort()
301 (lnk->link_type == LINK_UDP))) { in GetNewPort()
302 if (!GetSocket(la, port, &lnk->sockfd, lnk->link_type)) { in GetNewPort()
307 lnk->alias_port = port; in GetNewPort()
446 struct alias_link *lnk, *lnk_tmp; in CleanupAliasData() local
451 TAILQ_FOREACH_SAFE(lnk, &la->checkExpire, expire.list, lnk_tmp) in CleanupAliasData()
452 DeleteLink(&lnk, deletePermanent); in CleanupAliasData()
455 CleanupLink(struct libalias *la, struct alias_link **lnk, int deletePermanent) in CleanupLink() argument
459 if (lnk == NULL || *lnk == NULL) in CleanupLink()
462 if (LibAliasTime - (*lnk)->timestamp > (*lnk)->expire.time) { in CleanupLink()
463 DeleteLink(lnk, deletePermanent); in CleanupLink()
464 if ((*lnk) == NULL) in CleanupLink()
469 TAILQ_REMOVE(&la->checkExpire, (*lnk), expire.list); in CleanupLink()
470 TAILQ_INSERT_TAIL(&la->checkExpire, (*lnk), expire.list); in CleanupLink()
474 UseLink(struct libalias *la, struct alias_link *lnk) in UseLink() argument
476 CleanupLink(la, &lnk, 0); in UseLink()
477 if (lnk != NULL) in UseLink()
478 lnk->timestamp = LibAliasTime; in UseLink()
479 return (lnk); in UseLink()
485 struct alias_link *lnk = *plnk; in DeleteLink() local
486 struct libalias *la = lnk->la; in DeleteLink()
490 if (!deletePermanent && (lnk->flags & LINK_PERMANENT)) in DeleteLink()
495 ClearFWHole(lnk); in DeleteLink()
498 switch (lnk->link_type) { in DeleteLink()
500 LIST_REMOVE(lnk, pptp.list); in DeleteLink()
506 if (lnk->server != NULL) { in DeleteLink()
509 head = curr = lnk->server; in DeleteLink()
516 SPLAY_REMOVE(splay_out, &la->linkSplayOut, lnk); in DeleteLink()
520 LIST_REMOVE(lnk, all.in); in DeleteLink()
524 &la->linkSplayInternalEndpoint, lnk); in DeleteLink()
527 grp = StartPointIn(la, lnk->alias_addr, lnk->alias_port, lnk->link_type, 0); in DeleteLink()
539 TAILQ_REMOVE(&la->checkExpire, lnk, expire.list); in DeleteLink()
543 if (lnk->sockfd != -1) { in DeleteLink()
545 close(lnk->sockfd); in DeleteLink()
549 switch (lnk->link_type) { in DeleteLink()
558 free(lnk->data.tcp); in DeleteLink()
568 if (lnk->data.frag_ptr != NULL) in DeleteLink()
569 free(lnk->data.frag_ptr); in DeleteLink()
579 free(lnk); in DeleteLink()
593 struct alias_link *lnk; in AddLink() local
597 lnk = malloc(sizeof(struct alias_link)); in AddLink()
598 if (lnk == NULL) { in AddLink()
606 lnk->la = la; in AddLink()
607 lnk->src_addr = src_addr; in AddLink()
608 lnk->dst_addr = dst_addr; in AddLink()
609 lnk->alias_addr = alias_addr; in AddLink()
610 lnk->proxy_addr.s_addr = INADDR_ANY; in AddLink()
611 lnk->src_port = src_port; in AddLink()
612 lnk->dst_port = dst_port; in AddLink()
613 lnk->proxy_port = 0; in AddLink()
614 lnk->server = NULL; in AddLink()
615 lnk->link_type = link_type; in AddLink()
617 lnk->sockfd = -1; in AddLink()
619 lnk->flags = 0; in AddLink()
620 lnk->pflags = 0; in AddLink()
621 lnk->timestamp = LibAliasTime; in AddLink()
626 lnk->expire.time = ICMP_EXPIRE_TIME; in AddLink()
629 lnk->expire.time = UDP_EXPIRE_TIME; in AddLink()
632 lnk->expire.time = TCP_EXPIRE_INITIAL; in AddLink()
635 lnk->expire.time = FRAGMENT_ID_EXPIRE_TIME; in AddLink()
638 lnk->expire.time = FRAGMENT_PTR_EXPIRE_TIME; in AddLink()
641 lnk->expire.time = PROTO_EXPIRE_TIME; in AddLink()
647 lnk->flags |= LINK_UNKNOWN_DEST_ADDR; in AddLink()
649 lnk->flags |= LINK_UNKNOWN_DEST_PORT; in AddLink()
652 if (GetNewPort(la, lnk, alias_port_param) != 0) { in AddLink()
653 free(lnk); in AddLink()
674 free(lnk); in AddLink()
686 lnk->data.tcp = aux_tcp; in AddLink()
707 LIST_INSERT_HEAD(&la->pptpList, lnk, pptp.list); in AddLink()
712 grp = StartPointIn(la, alias_addr, lnk->alias_port, link_type, 1); in AddLink()
714 free(lnk); in AddLink()
719 SPLAY_INSERT(splay_out, &la->linkSplayOut, lnk); in AddLink()
722 if (lnk->flags & LINK_PARTIALLY_SPECIFIED) in AddLink()
723 LIST_INSERT_HEAD(&grp->partial, lnk, all.in); in AddLink()
725 LIST_INSERT_HEAD(&grp->full, lnk, all.in); in AddLink()
729 &la->linkSplayInternalEndpoint, lnk); in AddLink()
735 TAILQ_INSERT_TAIL(&la->checkExpire, lnk, expire.list); in AddLink()
740 return (lnk); in AddLink()
782 struct alias_link *lnk; in _SearchLinkOut() local
791 lnk = SPLAY_FIND(splay_out, &la->linkSplayOut, &needle); in _SearchLinkOut()
792 return (UseLink(la, lnk)); in _SearchLinkOut()
803 struct alias_link *lnk; in _FindLinkOut() local
806 lnk = _SearchLinkOut(la, src_addr, dst_addr, src_port, dst_port, link_type); in _FindLinkOut()
807 if (lnk != NULL || !replace_partial_links) in _FindLinkOut()
808 return (lnk); in _FindLinkOut()
812 lnk = _SearchLinkOut(la, src_addr, dst_addr, src_port, 0, in _FindLinkOut()
814 if (lnk == NULL) in _FindLinkOut()
815 lnk = _SearchLinkOut(la, src_addr, ANY_ADDR, src_port, in _FindLinkOut()
818 if (lnk == NULL && in _FindLinkOut()
820 lnk = _SearchLinkOut(la, src_addr, ANY_ADDR, src_port, 0, in _FindLinkOut()
823 if (lnk != NULL) { in _FindLinkOut()
824 lnk = ReLink(lnk, in _FindLinkOut()
825 src_addr, dst_addr, lnk->alias_addr, in _FindLinkOut()
826 src_port, dst_port, lnk->alias_port, in _FindLinkOut()
829 return (lnk); in _FindLinkOut()
840 struct alias_link *lnk; in FindLinkOut() local
843 lnk = _FindLinkOut(la, src_addr, dst_addr, src_port, dst_port, in FindLinkOut()
846 if (lnk == NULL) { in FindLinkOut()
855 lnk = _FindLinkOut(la, ANY_ADDR, dst_addr, src_port, dst_port, in FindLinkOut()
859 return (lnk); in FindLinkOut()
872 struct alias_link *lnk; in _FindLinkIn() local
900 LIST_FOREACH(lnk, &grp->full, all.in) { in _FindLinkIn()
901 if (lnk->dst_addr.s_addr == dst_addr.s_addr && in _FindLinkIn()
902 lnk->dst_port == dst_port) { in _FindLinkIn()
905 found = UseLink(la, lnk); in _FindLinkIn()
917 LIST_FOREACH(lnk, &grp->full, all.in) { in _FindLinkIn()
918 if(lnk->dst_addr.s_addr == dst_addr.s_addr) { in _FindLinkIn()
919 lnk_unknown_dst_port = lnk; in _FindLinkIn()
925 LIST_FOREACH(lnk, &grp->full, all.in) { in _FindLinkIn()
926 if(lnk->dst_port == dst_port) { in _FindLinkIn()
927 lnk_unknown_dst_addr = lnk; in _FindLinkIn()
938 LIST_FOREACH(lnk, &grp->partial, all.in) { in _FindLinkIn()
939 int flags = (flags_in | lnk->flags) & LINK_PARTIALLY_SPECIFIED; in _FindLinkIn()
943 lnk_unknown_all = lnk; in _FindLinkIn()
945 lnk->dst_port == dst_port && in _FindLinkIn()
947 lnk_unknown_dst_addr = lnk; in _FindLinkIn()
949 lnk->dst_addr.s_addr == dst_addr.s_addr) { in _FindLinkIn()
950 lnk_unknown_dst_port = lnk; in _FindLinkIn()
956 lnk = (lnk_unknown_dst_port != NULL) ? lnk_unknown_dst_port in _FindLinkIn()
960 if (lnk == NULL || !replace_partial_links) in _FindLinkIn()
961 return (lnk); in _FindLinkIn()
963 if (lnk->server != NULL) { /* LSNAT link */ in _FindLinkIn()
964 src_addr = lnk->server->addr; in _FindLinkIn()
965 src_port = lnk->server->port; in _FindLinkIn()
966 lnk->server = lnk->server->next; in _FindLinkIn()
968 src_addr = lnk->src_addr; in _FindLinkIn()
969 src_port = lnk->src_port; in _FindLinkIn()
973 lnk->src_addr = src_addr; in _FindLinkIn()
974 lnk->src_port = src_port; in _FindLinkIn()
976 lnk = ReLink(lnk, in _FindLinkIn()
981 return (lnk); in _FindLinkIn()
992 struct alias_link *lnk; in FindLinkIn() local
995 lnk = _FindLinkIn(la, dst_addr, alias_addr, dst_port, alias_port, in FindLinkIn()
998 if (lnk == NULL && in FindLinkIn()
1002 lnk = _FindLinkIn(la, ANY_ADDR, alias_addr, 0, alias_port, in FindLinkIn()
1006 if (lnk == NULL) { in FindLinkIn()
1015 lnk = _FindLinkIn(la, dst_addr, ANY_ADDR, dst_port, alias_port, in FindLinkIn()
1019 return (lnk); in FindLinkIn()
1058 struct alias_link *lnk; in FindIcmpIn() local
1061 lnk = FindLinkIn(la, dst_addr, alias_addr, in FindIcmpIn()
1064 if (lnk == NULL && create && !(la->packetAliasMode & PKT_ALIAS_DENY_INCOMING)) { in FindIcmpIn()
1068 lnk = AddLink(la, target_addr, dst_addr, alias_addr, in FindIcmpIn()
1072 return (lnk); in FindIcmpIn()
1081 struct alias_link *lnk; in FindIcmpOut() local
1084 lnk = FindLinkOut(la, src_addr, dst_addr, in FindIcmpOut()
1087 if (lnk == NULL && create) { in FindIcmpOut()
1091 lnk = AddLink(la, src_addr, dst_addr, alias_addr, in FindIcmpOut()
1095 return (lnk); in FindIcmpOut()
1103 struct alias_link *lnk; in FindFragmentIn1() local
1106 lnk = FindLinkIn(la, dst_addr, alias_addr, in FindFragmentIn1()
1110 if (lnk == NULL) { in FindFragmentIn1()
1111 lnk = AddLink(la, ANY_ADDR, dst_addr, alias_addr, in FindFragmentIn1()
1115 return (lnk); in FindFragmentIn1()
1154 struct alias_link *lnk; in FindProtoIn() local
1157 lnk = FindLinkIn(la, dst_addr, alias_addr, in FindProtoIn()
1161 if (lnk == NULL && !(la->packetAliasMode & PKT_ALIAS_DENY_INCOMING)) { in FindProtoIn()
1165 lnk = AddLink(la, target_addr, dst_addr, alias_addr, in FindProtoIn()
1169 return (lnk); in FindProtoIn()
1177 struct alias_link *lnk; in FindProtoOut() local
1180 lnk = FindLinkOut(la, src_addr, dst_addr, in FindProtoOut()
1184 if (lnk == NULL) { in FindProtoOut()
1188 lnk = AddLink(la, src_addr, dst_addr, alias_addr, in FindProtoOut()
1192 return (lnk); in FindProtoOut()
1204 struct alias_link *lnk; in FindUdpTcpIn() local
1219 lnk = FindLinkIn(la, dst_addr, alias_addr, in FindUdpTcpIn()
1223 if (lnk == NULL && create && !(la->packetAliasMode & PKT_ALIAS_DENY_INCOMING)) { in FindUdpTcpIn()
1227 lnk = AddLink(la, target_addr, dst_addr, alias_addr, in FindUdpTcpIn()
1231 return (lnk); in FindUdpTcpIn()
1243 struct alias_link *lnk; in FindUdpTcpOut() local
1258 lnk = FindLinkOut(la, src_addr, dst_addr, src_port, dst_port, link_type, create); in FindUdpTcpOut()
1260 if (lnk == NULL && create) { in FindUdpTcpOut()
1264 lnk = AddLink(la, src_addr, dst_addr, alias_addr, in FindUdpTcpOut()
1268 return (lnk); in FindUdpTcpOut()
1277 struct alias_link *lnk; in AddPptp() local
1280 lnk = AddLink(la, src_addr, dst_addr, alias_addr, in AddPptp()
1284 return (lnk); in AddPptp()
1292 struct alias_link *lnk; in FindPptpOutByCallId() local
1295 LIST_FOREACH(lnk, &la->pptpList, pptp.list) in FindPptpOutByCallId()
1296 if (lnk->src_addr.s_addr == src_addr.s_addr && in FindPptpOutByCallId()
1297 lnk->dst_addr.s_addr == dst_addr.s_addr && in FindPptpOutByCallId()
1298 lnk->src_port == src_call_id) in FindPptpOutByCallId()
1301 return (UseLink(la, lnk)); in FindPptpOutByCallId()
1309 struct alias_link *lnk; in FindPptpOutByPeerCallId() local
1312 LIST_FOREACH(lnk, &la->pptpList, pptp.list) in FindPptpOutByPeerCallId()
1313 if (lnk->src_addr.s_addr == src_addr.s_addr && in FindPptpOutByPeerCallId()
1314 lnk->dst_addr.s_addr == dst_addr.s_addr && in FindPptpOutByPeerCallId()
1315 lnk->dst_port == dst_call_id) in FindPptpOutByPeerCallId()
1318 return (UseLink(la, lnk)); in FindPptpOutByPeerCallId()
1326 struct alias_link *lnk; in FindPptpInByCallId() local
1330 LIST_FOREACH(lnk, &la->pptpList, pptp.list) in FindPptpInByCallId()
1331 if (lnk->dst_port == dst_call_id && in FindPptpInByCallId()
1332 lnk->dst_addr.s_addr == dst_addr.s_addr && in FindPptpInByCallId()
1333 lnk->alias_addr.s_addr == alias_addr.s_addr) in FindPptpInByCallId()
1336 return (UseLink(la, lnk)); in FindPptpInByCallId()
1344 struct alias_link *lnk; in FindPptpInByPeerCallId() local
1347 LIST_FOREACH(lnk, &la->pptpList, pptp.list) in FindPptpInByPeerCallId()
1348 if (lnk->alias_port == alias_call_id && in FindPptpInByPeerCallId()
1349 lnk->dst_addr.s_addr == dst_addr.s_addr && in FindPptpInByPeerCallId()
1350 lnk->alias_addr.s_addr == alias_addr.s_addr) in FindPptpInByPeerCallId()
1353 return (lnk); in FindPptpInByPeerCallId()
1364 struct alias_link *lnk; in FindRtspOut() local
1379 lnk = FindLinkOut(la, src_addr, dst_addr, src_port, 0, link_type, 1); in FindRtspOut()
1381 if (lnk == NULL) { in FindRtspOut()
1385 lnk = AddLink(la, src_addr, dst_addr, alias_addr, in FindRtspOut()
1389 return (lnk); in FindRtspOut()
1395 struct alias_link *lnk; in FindOriginalAddress() local
1398 lnk = FindLinkIn(la, ANY_ADDR, alias_addr, in FindOriginalAddress()
1400 if (lnk == NULL) { in FindOriginalAddress()
1409 if (lnk->server != NULL) { /* LSNAT link */ in FindOriginalAddress()
1412 src_addr = lnk->server->addr; in FindOriginalAddress()
1413 lnk->server = lnk->server->next; in FindOriginalAddress()
1415 } else if (lnk->src_addr.s_addr == INADDR_ANY) in FindOriginalAddress()
1419 return (lnk->src_addr); in FindOriginalAddress()
1426 struct alias_link *lnk; in FindAliasAddress() local
1429 lnk = FindLinkOut(la, original_addr, ANY_ADDR, in FindAliasAddress()
1431 if (lnk == NULL) { in FindAliasAddress()
1435 if (lnk->alias_addr.s_addr == INADDR_ANY) in FindAliasAddress()
1439 return (lnk->alias_addr); in FindAliasAddress()
1458 SetFragmentAddr(struct alias_link *lnk, struct in_addr src_addr) in SetFragmentAddr() argument
1460 lnk->data.frag_addr = src_addr; in SetFragmentAddr()
1464 GetFragmentAddr(struct alias_link *lnk, struct in_addr *src_addr) in GetFragmentAddr() argument
1466 *src_addr = lnk->data.frag_addr; in GetFragmentAddr()
1470 SetFragmentPtr(struct alias_link *lnk, void *fptr) in SetFragmentPtr() argument
1472 lnk->data.frag_ptr = fptr; in SetFragmentPtr()
1476 GetFragmentPtr(struct alias_link *lnk, void **fptr) in GetFragmentPtr() argument
1478 *fptr = lnk->data.frag_ptr; in GetFragmentPtr()
1482 SetStateIn(struct alias_link *lnk, int state) in SetStateIn() argument
1487 if (lnk->data.tcp->state.out != ALIAS_TCP_STATE_CONNECTED) in SetStateIn()
1488 lnk->expire.time = TCP_EXPIRE_DEAD; in SetStateIn()
1490 lnk->expire.time = TCP_EXPIRE_SINGLEDEAD; in SetStateIn()
1493 if (lnk->data.tcp->state.out == ALIAS_TCP_STATE_CONNECTED) in SetStateIn()
1494 lnk->expire.time = TCP_EXPIRE_CONNECTED; in SetStateIn()
1503 lnk->data.tcp->state.in = state; in SetStateIn()
1507 SetStateOut(struct alias_link *lnk, int state) in SetStateOut() argument
1512 if (lnk->data.tcp->state.in != ALIAS_TCP_STATE_CONNECTED) in SetStateOut()
1513 lnk->expire.time = TCP_EXPIRE_DEAD; in SetStateOut()
1515 lnk->expire.time = TCP_EXPIRE_SINGLEDEAD; in SetStateOut()
1518 if (lnk->data.tcp->state.in == ALIAS_TCP_STATE_CONNECTED) in SetStateOut()
1519 lnk->expire.time = TCP_EXPIRE_CONNECTED; in SetStateOut()
1528 lnk->data.tcp->state.out = state; in SetStateOut()
1532 GetStateIn(struct alias_link *lnk) in GetStateIn() argument
1535 return (lnk->data.tcp->state.in); in GetStateIn()
1539 GetStateOut(struct alias_link *lnk) in GetStateOut() argument
1542 return (lnk->data.tcp->state.out); in GetStateOut()
1546 GetOriginalAddress(struct alias_link *lnk) in GetOriginalAddress() argument
1548 if (lnk->src_addr.s_addr == INADDR_ANY) in GetOriginalAddress()
1549 return (lnk->la->aliasAddress); in GetOriginalAddress()
1551 return (lnk->src_addr); in GetOriginalAddress()
1555 GetDestAddress(struct alias_link *lnk) in GetDestAddress() argument
1557 return (lnk->dst_addr); in GetDestAddress()
1561 GetAliasAddress(struct alias_link *lnk) in GetAliasAddress() argument
1563 if (lnk->alias_addr.s_addr == INADDR_ANY) in GetAliasAddress()
1564 return (lnk->la->aliasAddress); in GetAliasAddress()
1566 return (lnk->alias_addr); in GetAliasAddress()
1584 GetOriginalPort(struct alias_link *lnk) in GetOriginalPort() argument
1586 return (lnk->src_port); in GetOriginalPort()
1590 GetAliasPort(struct alias_link *lnk) in GetAliasPort() argument
1592 return (lnk->alias_port); in GetAliasPort()
1597 GetDestPort(struct alias_link *lnk) in GetDestPort() argument
1599 return (lnk->dst_port); in GetDestPort()
1606 SetAckModified(struct alias_link *lnk) in SetAckModified() argument
1608 lnk->data.tcp->state.ack_modified = 1; in SetAckModified()
1612 GetProxyAddress(struct alias_link *lnk) in GetProxyAddress() argument
1614 return (lnk->proxy_addr); in GetProxyAddress()
1618 SetProxyAddress(struct alias_link *lnk, struct in_addr addr) in SetProxyAddress() argument
1620 lnk->proxy_addr = addr; in SetProxyAddress()
1624 GetProxyPort(struct alias_link *lnk) in GetProxyPort() argument
1626 return (lnk->proxy_port); in GetProxyPort()
1630 SetProxyPort(struct alias_link *lnk, u_short port) in SetProxyPort() argument
1632 lnk->proxy_port = port; in SetProxyPort()
1637 GetAckModified(struct alias_link *lnk) in GetAckModified() argument
1639 return (lnk->data.tcp->state.ack_modified); in GetAckModified()
1649 GetDeltaAckIn(u_long ack, struct alias_link *lnk) in GetDeltaAckIn() argument
1656 i = lnk->data.tcp->state.index; in GetDeltaAckIn()
1663 x = lnk->data.tcp->ack[i]; in GetDeltaAckIn()
1691 GetDeltaSeqOut(u_long seq, struct alias_link *lnk) in GetDeltaSeqOut() argument
1698 i = lnk->data.tcp->state.index; in GetDeltaSeqOut()
1705 x = lnk->data.tcp->ack[i]; in GetDeltaSeqOut()
1733 AddSeq(struct alias_link *lnk, int delta, u_int ip_hl, u_short ip_len, in AddSeq() argument
1749 i = lnk->data.tcp->state.index; in AddSeq()
1750 lnk->data.tcp->ack[i] = x; in AddSeq()
1754 lnk->data.tcp->state.index = 0; in AddSeq()
1756 lnk->data.tcp->state.index = i; in AddSeq()
1760 SetExpire(struct alias_link *lnk, int expire) in SetExpire() argument
1763 lnk->flags &= ~LINK_PERMANENT; in SetExpire()
1764 DeleteLink(&lnk, 0); in SetExpire()
1766 lnk->flags |= LINK_PERMANENT; in SetExpire()
1768 lnk->expire.time = expire; in SetExpire()
1778 SetProtocolFlags(struct alias_link *lnk, int pflags) in SetProtocolFlags() argument
1780 lnk->pflags = pflags; in SetProtocolFlags()
1784 GetProtocolFlags(struct alias_link *lnk) in GetProtocolFlags() argument
1786 return (lnk->pflags); in GetProtocolFlags()
1790 SetDestCallId(struct alias_link *lnk, u_int16_t cid) in SetDestCallId() argument
1792 LIBALIAS_LOCK_ASSERT(lnk->la); in SetDestCallId()
1793 ReLink(lnk, lnk->src_addr, lnk->dst_addr, lnk->alias_addr, in SetDestCallId()
1794 lnk->src_port, cid, lnk->alias_port, lnk->link_type, 1); in SetDestCallId()
1851 struct alias_link * lnk = TAILQ_FIRST(&la->checkExpire); in HouseKeeping() local
1853 CleanupLink(la, &lnk, 0); in HouseKeeping()
1921 struct alias_link *lnk; in LibAliasRedirectPort() local
1939 lnk = NULL; in LibAliasRedirectPort()
1943 lnk = AddLink(la, src_addr, dst_addr, alias_addr, in LibAliasRedirectPort()
1947 if (lnk != NULL) { in LibAliasRedirectPort()
1948 lnk->flags |= LINK_PERMANENT; in LibAliasRedirectPort()
1959 return (lnk); in LibAliasRedirectPort()
1964 LibAliasAddServer(struct libalias *la, struct alias_link *lnk, struct in_addr addr, u_short port) in LibAliasAddServer() argument
1972 switch (lnk->link_type) { in LibAliasAddServer()
1987 head = lnk->server; in LibAliasAddServer()
1991 SPLAY_REMOVE(splay_out, &la->linkSplayOut, lnk); in LibAliasAddServer()
2000 lnk->server = server; in LibAliasAddServer()
2017 struct alias_link *lnk; in LibAliasRedirectProto() local
2020 lnk = AddLink(la, src_addr, dst_addr, alias_addr, in LibAliasRedirectProto()
2024 if (lnk != NULL) { in LibAliasRedirectProto()
2025 lnk->flags |= LINK_PERMANENT; in LibAliasRedirectProto()
2035 return (lnk); in LibAliasRedirectProto()
2043 struct alias_link *lnk; in LibAliasRedirectAddr() local
2046 lnk = AddLink(la, src_addr, ANY_ADDR, alias_addr, in LibAliasRedirectAddr()
2050 if (lnk != NULL) { in LibAliasRedirectAddr()
2051 lnk->flags |= LINK_PERMANENT; in LibAliasRedirectAddr()
2061 return (lnk); in LibAliasRedirectAddr()
2066 LibAliasRedirectDynamic(struct libalias *la, struct alias_link *lnk) in LibAliasRedirectDynamic() argument
2073 if (lnk->flags & LINK_PARTIALLY_SPECIFIED) in LibAliasRedirectDynamic()
2076 lnk->flags &= ~LINK_PERMANENT; in LibAliasRedirectDynamic()
2086 LibAliasRedirectDelete(struct libalias *la, struct alias_link *lnk) in LibAliasRedirectDelete() argument
2090 DeleteLink(&lnk, 1); in LibAliasRedirectDelete()
2380 PunchFWHole(struct alias_link *lnk) in PunchFWHole() argument
2387 la = lnk->la; in PunchFWHole()
2392 lnk->link_type != LINK_TCP) in PunchFWHole()
2427 if (GetOriginalPort(lnk) != 0 && GetDestPort(lnk) != 0) { in PunchFWHole()
2433 GetOriginalAddress(lnk), ntohs(GetOriginalPort(lnk)), in PunchFWHole()
2434 GetDestAddress(lnk), ntohs(GetDestPort(lnk))); in PunchFWHole()
2441 GetDestAddress(lnk), ntohs(GetDestPort(lnk)), in PunchFWHole()
2442 GetOriginalAddress(lnk), ntohs(GetOriginalPort(lnk))); in PunchFWHole()
2449 lnk->data.tcp->fwhole = fwhole; in PunchFWHole()
2454 lnk. Calling this too often is harmless. */
2456 ClearFWHole(struct alias_link *lnk) in ClearFWHole() argument
2460 la = lnk->la; in ClearFWHole()
2461 if (lnk->link_type == LINK_TCP) { in ClearFWHole()
2462 int fwhole = lnk->data.tcp->fwhole; /* Where is the firewall hole? */ in ClearFWHole()
2472 lnk->data.tcp->fwhole = -1; in ClearFWHole()
2523 struct alias_link *lnk; in FindSctpRedirectAddress() local
2527 lnk = FindLinkIn(la, sm->ip_hdr->ip_src, sm->ip_hdr->ip_dst, in FindSctpRedirectAddress()
2529 if (lnk != NULL) { in FindSctpRedirectAddress()
2531 return (lnk->src_addr); in FindSctpRedirectAddress()
2537 lnk = FindLinkIn(la, sm->ip_hdr->ip_src, sm->ip_hdr->ip_dst, in FindSctpRedirectAddress()
2539 if (lnk != NULL) in FindSctpRedirectAddress()
2541 return (lnk->src_addr); in FindSctpRedirectAddress()