From owner-freebsd-isdn Thu Aug 27 14:39:20 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id OAA05601 for freebsd-isdn-outgoing; Thu, 27 Aug 1998 14:39:20 -0700 (PDT) (envelope-from owner-freebsd-isdn@FreeBSD.ORG) Received: from peedub.muc.de (newpc.muc.ditec.de [194.120.126.33]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id OAA05528 for ; Thu, 27 Aug 1998 14:38:50 -0700 (PDT) (envelope-from garyj@peedub.muc.de) Received: from peedub.muc.de (localhost [127.0.0.1]) by peedub.muc.de (8.8.8/8.6.9) with ESMTP id XAA00534 for ; Thu, 27 Aug 1998 23:25:55 +0200 (CEST) Message-Id: <199808272125.XAA00534@peedub.muc.de> X-Mailer: exmh version 2.0.2 2/24/98 To: freebsd-isdn@FreeBSD.ORG Subject: sppp and NAT From: Gary Jennejohn Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 27 Aug 1998 23:25:55 +0200 Sender: owner-freebsd-isdn@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org would those of you who are using sppp and NAT please try out this patch ? I hope that this will solve the problem of NAT not being informed when the interface gets a new address. Please report back to the list with your results. I tested this out with sppp but without NAT. It seemed to work OK. -------------------------- *** if_spppsubr.c.orig Tue Aug 25 23:02:24 1998 --- if_spppsubr.c Thu Aug 27 23:03:03 1998 *************** *** 56,61 **** --- 56,62 ---- #include #include #include + #include #include *************** *** 3914,3920 **** static void sppp_set_ip_addr(struct sppp *sp, u_long src) { ! struct ifnet *ifp = &sp->pp_if; struct ifaddr *ifa; struct sockaddr_in *si; --- 3915,3921 ---- static void sppp_set_ip_addr(struct sppp *sp, u_long src) { ! STDDCL; struct ifaddr *ifa; struct sockaddr_in *si; *************** *** 3940,3947 **** if (si) break; } ! if (ifa && si) si->sin_addr.s_addr = htonl(src); } static int --- 3941,3974 ---- if (si) break; } ! if (ifa && si) { ! /* delete the old address first XXX */ ! if (debug) ! log(LOG_DEBUG, SPP_FMT "\ndeleting route1\n", ! SPP_ARGS(ifp)); ! rtinit(ifa, (int)RTM_DELETE, 0); si->sin_addr.s_addr = htonl(src); + + /* seems like this is the place to modify any routing info */ + /* + * XXXX + * BEWARE !! if the semantics for a dynamic + * address (IP == 0 || IP == 1) are changed, then this + * will *not* work anymore !!!! + */ + if (src == 0) { /* deleting the address */ + if (debug) + log(LOG_DEBUG, SPP_FMT "\ndeleting route2\n", + SPP_ARGS(ifp)); + /* XXX RTF_HOST or 0 ?? */ + rtinit(ifa, (int)RTM_DELETE, 0); + } else if (src && src != 1) { /* adding a new address */ + if (debug) + log(LOG_DEBUG, SPP_FMT "adding route\n", + SPP_ARGS(ifp)); + rtinit(ifa, (int)RTM_ADD, 0|RTF_UP); + } + } } static int -------- Gary Jennejohn Home - garyj@muc.de Work - garyj@fkr.dec.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-isdn" in the body of the message