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

Function AliasHandlePptpGreOut

freebsd/netinet/libalias/alias_pptp.c:473–495  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

471}
472
473static int
474AliasHandlePptpGreOut(struct libalias *la, struct ip *pip)
475{
476 GreHdr *gr;
477 struct alias_link *lnk;
478
479 gr = (GreHdr *) ip_next(pip);
480
481 /* Check GRE header bits. */
482 if ((ntohl(*((u_int32_t *) gr)) & PPTP_INIT_MASK) != PPTP_INIT_VALUE)
483 return (-1);
484
485 lnk = FindPptpOutByPeerCallId(la, pip->ip_src, pip->ip_dst, gr->gh_call_id);
486 if (lnk != NULL) {
487 struct in_addr alias_addr = GetAliasAddress(lnk);
488
489 /* Change source IP address. */
490 DifferentialChecksum(&pip->ip_sum,
491 &alias_addr, &pip->ip_src, 2);
492 pip->ip_src = alias_addr;
493 }
494 return (0);
495}
496
497static int
498AliasHandlePptpGreIn(struct libalias *la, struct ip *pip)

Callers 1

protohandlergreoutFunction · 0.85

Calls 4

ip_nextFunction · 0.85
FindPptpOutByPeerCallIdFunction · 0.85
GetAliasAddressFunction · 0.85
DifferentialChecksumFunction · 0.85

Tested by

no test coverage detected