| 1461 | } |
| 1462 | |
| 1463 | struct alias_link * |
| 1464 | FindUdpTcpIn(struct libalias *la, struct in_addr dst_addr, |
| 1465 | struct in_addr alias_addr, |
| 1466 | u_short dst_port, |
| 1467 | u_short alias_port, |
| 1468 | u_char proto, |
| 1469 | int create) |
| 1470 | { |
| 1471 | int link_type; |
| 1472 | struct alias_link *lnk; |
| 1473 | |
| 1474 | LIBALIAS_LOCK_ASSERT(la); |
| 1475 | switch (proto) { |
| 1476 | case IPPROTO_UDP: |
| 1477 | link_type = LINK_UDP; |
| 1478 | break; |
| 1479 | case IPPROTO_TCP: |
| 1480 | link_type = LINK_TCP; |
| 1481 | break; |
| 1482 | default: |
| 1483 | return (NULL); |
| 1484 | break; |
| 1485 | } |
| 1486 | |
| 1487 | lnk = FindLinkIn(la, dst_addr, alias_addr, |
| 1488 | dst_port, alias_port, |
| 1489 | link_type, create); |
| 1490 | |
| 1491 | if (lnk == NULL && create && !(la->packetAliasMode & PKT_ALIAS_DENY_INCOMING)) { |
| 1492 | struct in_addr target_addr; |
| 1493 | |
| 1494 | target_addr = FindOriginalAddress(la, alias_addr); |
| 1495 | lnk = AddLink(la, target_addr, dst_addr, alias_addr, |
| 1496 | alias_port, dst_port, alias_port, |
| 1497 | link_type); |
| 1498 | } |
| 1499 | return (lnk); |
| 1500 | } |
| 1501 | |
| 1502 | struct alias_link * |
| 1503 | FindUdpTcpOut(struct libalias *la, struct in_addr src_addr, |
no test coverage detected