| 689 | } |
| 690 | |
| 691 | static int |
| 692 | ProtoAliasOut(struct libalias *la, struct ip *pip, |
| 693 | struct in_addr ip_dst, u_char ip_p, u_short *ip_sum, int create) |
| 694 | { |
| 695 | /* |
| 696 | Handle outgoing IP packets. The |
| 697 | only thing which is done in this case is to alias |
| 698 | the source IP address of the packet. |
| 699 | */ |
| 700 | struct alias_link *lnk; |
| 701 | |
| 702 | LIBALIAS_LOCK_ASSERT(la); |
| 703 | |
| 704 | /* Return if proxy-only mode is enabled */ |
| 705 | if (la->packetAliasMode & PKT_ALIAS_PROXY_ONLY) |
| 706 | return (PKT_ALIAS_OK); |
| 707 | |
| 708 | if (!create) |
| 709 | return (PKT_ALIAS_IGNORED); |
| 710 | |
| 711 | lnk = FindProtoOut(la, pip->ip_src, ip_dst, ip_p); |
| 712 | if (lnk != NULL) { |
| 713 | struct in_addr alias_address; |
| 714 | |
| 715 | alias_address = GetAliasAddress(lnk); |
| 716 | |
| 717 | /* Change source address */ |
| 718 | DifferentialChecksum(ip_sum, |
| 719 | &alias_address, &pip->ip_src, 2); |
| 720 | pip->ip_src = alias_address; |
| 721 | |
| 722 | return (PKT_ALIAS_OK); |
| 723 | } |
| 724 | return (PKT_ALIAS_IGNORED); |
| 725 | } |
| 726 | |
| 727 | static int |
| 728 | UdpAliasIn(struct libalias *la, struct ip *pip) |
no test coverage detected