diff options
author | phk <phk@FreeBSD.org> | 2004-01-17 10:52:21 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-01-17 10:52:21 +0000 |
commit | 7948e91c15e85d387bf8070d18fd9257a7d982be (patch) | |
tree | c6f9109d165b87ec210bad09db4698bcf1e09e3d /lib/libalias/alias_pptp.c | |
parent | b8698f2968ee8eae55e888c1a3ec985218257e28 (diff) | |
download | FreeBSD-src-7948e91c15e85d387bf8070d18fd9257a7d982be.zip FreeBSD-src-7948e91c15e85d387bf8070d18fd9257a7d982be.tar.gz |
Mostly mechanical rework of libalias:
Makes it possible to have multiple packet aliasing instances in a
single process by moving all static and global variables into an
instance structure called "struct libalias".
Redefine a new API based on s/PacketAlias/LibAlias/g
Add new "instance" argument to all functions in the new API.
Implement old API in terms of the new API.
Diffstat (limited to 'lib/libalias/alias_pptp.c')
-rw-r--r-- | lib/libalias/alias_pptp.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/libalias/alias_pptp.c b/lib/libalias/alias_pptp.c index 2d3d9ac..946ae2f 100644 --- a/lib/libalias/alias_pptp.c +++ b/lib/libalias/alias_pptp.c @@ -145,7 +145,8 @@ static PptpCallId AliasVerifyPptp(struct ip *, u_int16_t *); void -AliasHandlePptpOut(struct ip *pip, /* IP packet to examine/patch */ +AliasHandlePptpOut(struct libalias *la, + struct ip *pip, /* IP packet to examine/patch */ struct alias_link *link) /* The PPTP control link */ { struct alias_link *pptp_link; @@ -165,13 +166,13 @@ AliasHandlePptpOut(struct ip *pip, /* IP packet to examine/patch */ case PPTP_InCallRequest: case PPTP_InCallReply: /* Establish PPTP link for address and Call ID found in control message. */ - pptp_link = AddPptp(GetOriginalAddress(link), GetDestAddress(link), + pptp_link = AddPptp(la, GetOriginalAddress(link), GetDestAddress(link), GetAliasAddress(link), cptr->cid1); break; case PPTP_CallClearRequest: case PPTP_CallDiscNotify: /* Find PPTP link for address and Call ID found in control message. */ - pptp_link = FindPptpOutByCallId(GetOriginalAddress(link), + pptp_link = FindPptpOutByCallId(la, GetOriginalAddress(link), GetDestAddress(link), cptr->cid1); break; @@ -208,7 +209,8 @@ AliasHandlePptpOut(struct ip *pip, /* IP packet to examine/patch */ } void -AliasHandlePptpIn(struct ip *pip, /* IP packet to examine/patch */ +AliasHandlePptpIn(struct libalias *la, + struct ip *pip, /* IP packet to examine/patch */ struct alias_link *link) /* The PPTP control link */ { struct alias_link *pptp_link; @@ -234,7 +236,7 @@ AliasHandlePptpIn(struct ip *pip, /* IP packet to examine/patch */ pcall_id = &cptr->cid2; break; case PPTP_CallDiscNotify: /* Connection closed. */ - pptp_link = FindPptpInByCallId(GetDestAddress(link), + pptp_link = FindPptpInByCallId(la, GetDestAddress(link), GetAliasAddress(link), cptr->cid1); if (pptp_link != NULL) @@ -245,7 +247,7 @@ AliasHandlePptpIn(struct ip *pip, /* IP packet to examine/patch */ } /* Find PPTP link for address and Call ID found in PPTP Control Msg */ - pptp_link = FindPptpInByPeerCallId(GetDestAddress(link), + pptp_link = FindPptpInByPeerCallId(la, GetDestAddress(link), GetAliasAddress(link), *pcall_id); @@ -311,7 +313,7 @@ AliasVerifyPptp(struct ip *pip, u_int16_t *ptype) /* IP packet to examine/patch int -AliasHandlePptpGreOut(struct ip *pip) +AliasHandlePptpGreOut(struct libalias *la, struct ip *pip) { GreHdr *gr; struct alias_link *link; @@ -322,7 +324,7 @@ AliasHandlePptpGreOut(struct ip *pip) if ((ntohl(*((u_int32_t *)gr)) & PPTP_INIT_MASK) != PPTP_INIT_VALUE) return (-1); - link = FindPptpOutByPeerCallId(pip->ip_src, pip->ip_dst, gr->gh_call_id); + link = FindPptpOutByPeerCallId(la, pip->ip_src, pip->ip_dst, gr->gh_call_id); if (link != NULL) { struct in_addr alias_addr = GetAliasAddress(link); @@ -339,7 +341,7 @@ AliasHandlePptpGreOut(struct ip *pip) int -AliasHandlePptpGreIn(struct ip *pip) +AliasHandlePptpGreIn(struct libalias *la, struct ip *pip) { GreHdr *gr; struct alias_link *link; @@ -350,7 +352,7 @@ AliasHandlePptpGreIn(struct ip *pip) if ((ntohl(*((u_int32_t *)gr)) & PPTP_INIT_MASK) != PPTP_INIT_VALUE) return (-1); - link = FindPptpInByPeerCallId(pip->ip_src, pip->ip_dst, gr->gh_call_id); + link = FindPptpInByPeerCallId(la, pip->ip_src, pip->ip_dst, gr->gh_call_id); if (link != NULL) { struct in_addr src_addr = GetOriginalAddress(link); |