diff options
author | piso <piso@FreeBSD.org> | 2008-03-12 14:34:34 +0000 |
---|---|---|
committer | piso <piso@FreeBSD.org> | 2008-03-12 14:34:34 +0000 |
commit | f2e5e0ae4524d1a3d5058c7486915c7904b59944 (patch) | |
tree | 52eec78dcdf540e701d11949082f5bd24807c298 | |
parent | 0c792dea7078c0f11e629f340594d1c41e1305b9 (diff) | |
download | FreeBSD-src-f2e5e0ae4524d1a3d5058c7486915c7904b59944.zip FreeBSD-src-f2e5e0ae4524d1a3d5058c7486915c7904b59944.tar.gz |
Update to the "new" libalias API (and thus fix world breakage).
-rw-r--r-- | usr.sbin/ppp/command.c | 8 | ||||
-rw-r--r-- | usr.sbin/ppp/ipcp.c | 4 | ||||
-rw-r--r-- | usr.sbin/ppp/main.c | 3 | ||||
-rw-r--r-- | usr.sbin/ppp/nat_cmd.c | 38 |
4 files changed, 30 insertions, 23 deletions
diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c index 04ad080..cc23518 100644 --- a/usr.sbin/ppp/command.c +++ b/usr.sbin/ppp/command.c @@ -193,6 +193,8 @@ static int NatEnable(struct cmdargs const *); static int NatOption(struct cmdargs const *); #endif +extern struct libalias *la; + static const char * showcx(struct cmdtab const *cmd) { @@ -2632,7 +2634,7 @@ NatEnable(struct cmdargs const *arg) if (strcasecmp(arg->argv[arg->argn], "yes") == 0) { if (!arg->bundle->NatEnabled) { if (arg->bundle->ncp.ipcp.fsm.state == ST_OPENED) - PacketAliasSetAddress(arg->bundle->ncp.ipcp.my_ip); + LibAliasSetAddress(la, arg->bundle->ncp.ipcp.my_ip); arg->bundle->NatEnabled = 1; } return 0; @@ -2656,13 +2658,13 @@ NatOption(struct cmdargs const *arg) if (arg->argc == arg->argn+1) { if (strcasecmp(arg->argv[arg->argn], "yes") == 0) { if (arg->bundle->NatEnabled) { - PacketAliasSetMode(param, param); + LibAliasSetMode(la, param, param); return 0; } log_Printf(LogWARN, "nat not enabled\n"); } else if (strcmp(arg->argv[arg->argn], "no") == 0) { if (arg->bundle->NatEnabled) { - PacketAliasSetMode(0, param); + LibAliasSetMode(la, 0, param); return 0; } log_Printf(LogWARN, "nat not enabled\n"); diff --git a/usr.sbin/ppp/ipcp.c b/usr.sbin/ppp/ipcp.c index e2da0e5..8991063 100644 --- a/usr.sbin/ppp/ipcp.c +++ b/usr.sbin/ppp/ipcp.c @@ -118,6 +118,8 @@ static void IpcpSendTerminateAck(struct fsm *, u_char); static void IpcpDecodeConfig(struct fsm *, u_char *, u_char *, int, struct fsm_decode *); +extern struct libalias *la; + static struct fsm_callbacks ipcp_Callbacks = { IpcpLayerUp, IpcpLayerDown, @@ -915,7 +917,7 @@ ipcp_InterfaceUp(struct ipcp *ipcp) #ifndef NONAT if (ipcp->fsm.bundle->NatEnabled) - PacketAliasSetAddress(ipcp->my_ip); + LibAliasSetAddress(la, ipcp->my_ip); #endif return 1; diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c index 694b744..b4d5e29 100644 --- a/usr.sbin/ppp/main.c +++ b/usr.sbin/ppp/main.c @@ -107,6 +107,7 @@ static void TerminalStop(int); static struct bundle *SignalBundle; static struct prompt *SignalPrompt; +struct libalias *la; void Cleanup() @@ -327,7 +328,7 @@ main(int argc, char **argv) log_Open(name ? name + 1 : argv[0]); #ifndef NONAT - PacketAliasInit(); + la = LibAliasInit(NULL); #endif label = ProcessArgs(argc, argv, &sw); diff --git a/usr.sbin/ppp/nat_cmd.c b/usr.sbin/ppp/nat_cmd.c index 4e76464..b4d6ad2 100644 --- a/usr.sbin/ppp/nat_cmd.c +++ b/usr.sbin/ppp/nat_cmd.c @@ -88,6 +88,8 @@ static int StrToPortRange(const char *, u_short *, u_short *, const char *); static int StrToAddrAndPort(const char *, struct in_addr *, u_short *, u_short *, const char *); +extern struct libalias *la; + static void lowhigh(u_short *a, u_short *b) { @@ -174,7 +176,7 @@ nat_RedirectPort(struct cmdargs const *arg) } while (laliasport <= haliasport) { - link = PacketAliasRedirectPort(localaddr, htons(llocalport), + link = LibAliasRedirectPort(la, localaddr, htons(llocalport), remoteaddr, htons(lremoteport), aliasaddr, htons(laliasport), proto_constant); @@ -220,7 +222,7 @@ nat_RedirectAddr(struct cmdargs const *arg) arg->cmd->syntax); return 1; } - link = PacketAliasRedirectAddr(localaddr, aliasaddr); + link = LibAliasRedirectAddr(la, localaddr, aliasaddr); if (link == NULL) { prompt_Printf(arg->prompt, "address redirect: packet aliasing" " engine error\n"); @@ -289,7 +291,7 @@ nat_RedirectProto(struct cmdargs const *arg) } else remoteIP.s_addr = INADDR_ANY; - link = PacketAliasRedirectProto(localIP, remoteIP, publicIP, pe->p_proto); + link = LibAliasRedirectProto(la, localIP, remoteIP, publicIP, pe->p_proto); if (link == NULL) { prompt_Printf(arg->prompt, "proto redirect: packet aliasing" " engine error\n"); @@ -408,7 +410,7 @@ nat_ProxyRule(struct cmdargs const *arg) pos += len; } - return PacketAliasProxyRule(cmd); + return LibAliasProxyRule(la, cmd); } int @@ -418,7 +420,7 @@ nat_SetTarget(struct cmdargs const *arg) if (arg->argc == arg->argn) { addr.s_addr = INADDR_ANY; - PacketAliasSetTarget(addr); + LibAliasSetTarget(la, addr); return 0; } @@ -427,7 +429,7 @@ nat_SetTarget(struct cmdargs const *arg) if (!strcasecmp(arg->argv[arg->argn], "MYADDR")) { addr.s_addr = INADDR_ANY; - PacketAliasSetTarget(addr); + LibAliasSetTarget(la, addr); return 0; } @@ -437,7 +439,7 @@ nat_SetTarget(struct cmdargs const *arg) return 1; } - PacketAliasSetTarget(addr); + LibAliasSetTarget(la, addr); return 0; } @@ -449,7 +451,7 @@ nat_PunchFW(struct cmdargs const *arg) long base, count; if (arg->argc == arg->argn) { - PacketAliasSetMode(0, PKT_ALIAS_PUNCH_FW); + LibAliasSetMode(la, 0, PKT_ALIAS_PUNCH_FW); return 0; } @@ -464,8 +466,8 @@ nat_PunchFW(struct cmdargs const *arg) if (*end != '\0' || count < 0) return -1; - PacketAliasSetFWBase(base, count); - PacketAliasSetMode(PKT_ALIAS_PUNCH_FW, PKT_ALIAS_PUNCH_FW); + LibAliasSetFWBase(la, base, count); + LibAliasSetMode(la, PKT_ALIAS_PUNCH_FW, PKT_ALIAS_PUNCH_FW); return 0; } @@ -478,7 +480,7 @@ nat_SkinnyPort(struct cmdargs const *arg) long port; if (arg->argc == arg->argn) { - PacketAliasSetSkinnyPort(0); + LibAliasSetSkinnyPort(la, 0); return 0; } @@ -489,7 +491,7 @@ nat_SkinnyPort(struct cmdargs const *arg) if (*end != '\0' || port < 0) return -1; - PacketAliasSetSkinnyPort(port); + LibAliasSetSkinnyPort(la, port); return 0; } @@ -505,7 +507,7 @@ nat_LayerPush(struct bundle *bundle, struct link *l __unused, struct mbuf *bp, m_settype(bp, MB_NATOUT); /* Ensure there's a bit of extra buffer for the NAT code... */ bp = m_pullup(m_append(bp, NULL, NAT_EXTRABUF)); - PacketAliasOut(MBUF_CTOP(bp), bp->m_len); + LibAliasOut(la, MBUF_CTOP(bp), bp->m_len); bp->m_len = ntohs(((struct ip *)MBUF_CTOP(bp))->ip_len); return bp; @@ -527,7 +529,7 @@ nat_LayerPull(struct bundle *bundle, struct link *l __unused, struct mbuf *bp, m_settype(bp, MB_NATIN); /* Ensure there's a bit of extra buffer for the NAT code... */ bp = m_pullup(m_append(bp, NULL, NAT_EXTRABUF)); - ret = PacketAliasIn(MBUF_CTOP(bp), bp->m_len); + ret = LibAliasIn(la, MBUF_CTOP(bp), bp->m_len); bp->m_len = ntohs(((struct ip *)MBUF_CTOP(bp))->ip_len); if (bp->m_len > MAX_MRU) { @@ -550,7 +552,7 @@ nat_LayerPull(struct bundle *bundle, struct link *l __unused, struct mbuf *bp, bp = NULL; } else { bp = mbuf_Read(bp, fptr, bp->m_len); - PacketAliasSaveFragment(fptr); + LibAliasSaveFragment(la, fptr); log_Printf(LogDEBUG, "Store another frag (%lu) - now %d\n", (unsigned long)((struct ip *)fptr)->ip_id, ++gfrags); } @@ -560,9 +562,9 @@ nat_LayerPull(struct bundle *bundle, struct link *l __unused, struct mbuf *bp, /* Fetch all the saved fragments and chain them on the end of `bp' */ last = &bp->m_nextpkt; nfrags = 0; - while ((fptr = PacketAliasGetFragment(MBUF_CTOP(bp))) != NULL) { + while ((fptr = LibAliasGetFragment(la, MBUF_CTOP(bp))) != NULL) { nfrags++; - PacketAliasFragmentIn(MBUF_CTOP(bp), fptr); + LibAliasFragmentIn(la, MBUF_CTOP(bp), fptr); len = ntohs(((struct ip *)fptr)->ip_len); *last = m_get(len, MB_NATIN); memcpy(MBUF_CTOP(*last), fptr, len); @@ -576,7 +578,7 @@ nat_LayerPull(struct bundle *bundle, struct link *l __unused, struct mbuf *bp, break; case PKT_ALIAS_IGNORED: - if (PacketAliasSetMode(0, 0) & PKT_ALIAS_DENY_INCOMING) { + if (LibAliasSetMode(la, 0, 0) & PKT_ALIAS_DENY_INCOMING) { log_Printf(LogTCPIP, "NAT engine denied data:\n"); m_freem(bp); bp = NULL; |