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

Function ProtoAliasIn

freebsd/netinet/libalias/alias.c:658–689  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

656}
657
658static int
659ProtoAliasIn(struct libalias *la, struct in_addr ip_src,
660 struct ip *pip, u_char ip_p, u_short *ip_sum)
661{
662/*
663 Handle incoming IP packets. The
664 only thing which is done in this case is to alias
665 the dest IP address of the packet to our inside
666 machine.
667*/
668 struct alias_link *lnk;
669
670 LIBALIAS_LOCK_ASSERT(la);
671/* Return if proxy-only mode is enabled */
672 if (la->packetAliasMode & PKT_ALIAS_PROXY_ONLY)
673 return (PKT_ALIAS_OK);
674
675 lnk = FindProtoIn(la, ip_src, pip->ip_dst, ip_p);
676 if (lnk != NULL) {
677 struct in_addr original_address;
678
679 original_address = GetOriginalAddress(lnk);
680
681/* Restore original IP address */
682 DifferentialChecksum(ip_sum,
683 &original_address, &pip->ip_dst, 2);
684 pip->ip_dst = original_address;
685
686 return (PKT_ALIAS_OK);
687 }
688 return (PKT_ALIAS_IGNORED);
689}
690
691static int
692ProtoAliasOut(struct libalias *la, struct ip *pip,

Callers 1

LibAliasInLockedFunction · 0.85

Calls 3

FindProtoInFunction · 0.85
GetOriginalAddressFunction · 0.85
DifferentialChecksumFunction · 0.85

Tested by

no test coverage detected