Date: Thu, 27 Aug 1998 23:25:55 +0200 From: Gary Jennejohn <garyj@muc.de> To: freebsd-isdn@FreeBSD.ORG Subject: sppp and NAT Message-ID: <199808272125.XAA00534@peedub.muc.de>
next in thread | raw e-mail | index | archive | help
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 <net/if.h> #include <net/netisr.h> #include <net/if_types.h> + #include <net/route.h> #include <machine/stdarg.h> *************** *** 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199808272125.XAA00534>