| Summary: | /usr/sbin/ppp is not able to bind the natd(8) -alias_address option. | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | Masanori Takeishi <marina> | ||||||||
| Component: | bin | Assignee: | Brian Somers <brian> | ||||||||
| Status: | Closed FIXED | ||||||||||
| Severity: | Affects Only Me | ||||||||||
| Priority: | Normal | ||||||||||
| Version: | 4.6-STABLE | ||||||||||
| Hardware: | Any | ||||||||||
| OS: | Any | ||||||||||
| Attachments: |
|
||||||||||
Responsible Changed From-To: freebsd-bugs->brian I believe that brian actively maintains our ppp(8). Brian, would you please take care of this PR? This patch may help lots of Japanese users who subscribe NTT's flets service (ISDN/ADSL/Optical). brian> I'm not sure I understand the problem. What is meant by an brian> unnumbered PPPoE connection ? In this situation, a subscriber has assigned a static IPv4 address block. Imagine the block is a.b.c.0/28, and a subscriber uses FreeBSD box for a router. The router has an internal private network, and FreeBSD box also provides NAT facility for that network. Please note that when a subscriber makes an uplink to ISP (via PPPoE for example), ISP assigns "a.b.c.0" IPv4 address for subscriber's side of point-to-point network. I've heard that the address is passwd by IPCP type3 packet, not IPCP type0 packet. This is by design of this service, and there are no other choices. After the connection was established, most of connections from a.b.c.X (where 0 < X < 15) is OK. However, a connection from the private network is NATed to the connection from a.b.c.0, in the viewpoint of external networks. It should cause zero problem, but the life is not easy; a subscriber meets troubles that they can't connect to some websites (or services available in the Internet). If the source address of NATed packet can be changed to something other than a.b.c.0, a subscriber is happy. In natd(8), this feature is available by the option '-alias_address'. The PR submitter want to implement exactly the same feature to ppp(8). brian> Perhaps rather than ``nat alias 1.2.3.1'' we just need ``set brian> ifaddr 1.2.3.1'' ? Sorry I don't know it works or not. Takeishi-san, would you please explain your situations also, and try 'set ifaddr a.b.c.1' works or not? -- - Makoto `MAR' Matsushita I tried it. " set ifaddr a.b.c.1/32 10.0.0.1/0 255.255.255.248 a.b.c.1" but, connect src ip address is "a.b.c.0" ----------------------------------------------------- Masanori Takeishi, E-Mail: marina@yaya.forks.co.jp I tried it. " set ifaddr a.b.c.1/32 10.0.0.1/0 255.255.255.248 a.b.c.1" but, connect src ip address is "a.b.c.0" ----------------------------------------------------- Masanori Takeishi, E-Mail: marina@yaya.forks.co.jp I entered into real practical use and not able to test. There is the problem that ppp is not able to pass a fragment packet and this one. I use router unit. I apologize for not be cooperate. ----------------------------------------------------- Masanori Takeishi, E-Mail: marina @yaya.forks.co.jp State Changed From-To: open->feedback Requesting information from anybody that still has a connection with this ISP State Changed From-To: feedback->closed Feedback timeout |
When several providers is make unnumberd PPPoE conect the allocation address for a network address. if Allocation area is x.x.x.0/28 My Side: IP = x.x.x.0 !! too BAD!! Fix: /usr/sbin/ppp is able to bind the natd(8) -alias_address option. sample ppp.conf: + nat alias x.x.x.1 patch: +extern struct in_addr alias_address_addr; + #ifndef NONAT static int NatEnable(struct cmdargs const *arg) @@ -2378,8 +2382,12 @@ if (arg->argc == arg->argn+1) { 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); + if (arg->bundle->ncp.ipcp.fsm.state == ST_OPENED){ + if (alias_address_addr.s_addr == INADDR_NONE || alias_address_addr.s_ addr == 0) + PacketAliasSetAddress(arg->bundle->ncp.ipcp.my_ip); + else + PacketAliasSetAddress(alias_address_addr); + } arg->bundle->NatEnabled = 1; } return 0; +extern struct in_addr alias_address_addr; + int ipcp_InterfaceUp(struct ipcp *ipcp) { @@ -1006,8 +1008,12 @@ } #ifndef NONAT - if (ipcp->fsm.bundle->NatEnabled) - PacketAliasSetAddress(ipcp->my_ip); + if (ipcp->fsm.bundle->NatEnabled) { + if (alias_address_addr.s_addr == INADDR_NONE || alias_address_addr.s_addr = = 0) + PacketAliasSetAddress(ipcp->my_ip); + else + PacketAliasSetAddress(alias_address_addr); + } #endif return 1; +struct in_addr alias_address_addr; + +int +nat_SetAlias(struct cmdargs const *arg) +{ + if (arg->argc != arg->argn + 1) + return -1; + + if (!strcasecmp(arg->argv[arg->argn], "MYADDR")) { + alias_address_addr.s_addr = INADDR_ANY; + PacketAliasSetAddress(alias_address_addr); + return 0; + } + + alias_address_addr = GetIpAddr(arg->argv[arg->argn]); + if (alias_address_addr.s_addr == INADDR_NONE) { + log_Printf(LogWARN, "%s: invalid address\n", arg->argv[arg->argn]); + return 1; + } + + PacketAliasSetAddress(alias_address_addr); + return 0; +} + static struct mbuf * nat_LayerPush(struct bundle *bundle, struct link *l, struct mbuf *bp, int pri, u_short *proto) extern struct layer natlayer;--kosqBIQQbtglzB0tawJNj7nix3zRnU9zO244T4dpzBiPkbKf Content-Type: text/plain; name="file.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="file.diff" diff -urN ppp.org/command.c ppp/command.c --- ppp.org/command.c Sat Jun 8 15:37:48 2002 +++ ppp/command.c Sat Jun 8 15:30:32 2002 @@ -641,6 +641,8 @@ (const void *) PKT_ALIAS_SAME_PORTS}, {"target", NULL, nat_SetTarget, LOCAL_AUTH, "Default address for incoming connections", "nat target addr" }, + {"alias", NULL, nat_SetAlias, LOCAL_AUTH, + "Use addr as the aliasing address", "nat alias addr" }, {"unregistered_only", NULL, NatOption, LOCAL_AUTH, "translate unregistered (private) IP address space only", "nat unregistered_only yes|no", @@ -2371,6 +2373,8 @@ return 0; } How-To-Repeat: Present condition becomes so