Patch: Win95 connects to Linux Box without DNS or IP configs

Patch: Win95 connects to Linux Box without DNS or IP configs

Post by Christoph Lamet » Sun, 19 Nov 1995 04:00:00



I have patched pppd to handle Micro$oft DNS Negotiation.

This is NOT a client this is for Serving Dialin Connections only!

This allow you to:
1. Serve Win95 PPP connections WITHOUT the clients having to configure DNS
2. In connection with mgetty 0.99 with autoPPP support allows configuration
   of an ISP service WITHOUT any scripts or DNS or IP configuration! Just
   tell your Win95 users to configure the phone number of your service.

   mgetty is on hpsystem2.informatik.tu-muenchen.de
   directory /pub/comp/networking/communication/modem/mgetty

To install:
1. Get the source code (this is for pppd 2.1.2b from Slackware 2.3).
2. Patch it with the patch at the end of this message
3. Install the new pppd
4. Add the following option to your /etc/ppp/options file

ms-dns 192.168.1.1

Replace the DNS Address with the DNS address that your dialin users should
use.

Any additional ideas are welcome. Oh yeah the exact data for Micro$ofts
specs (This is a rejected RFC!!!) are on
http://info.internet.isi.edu/0/in-drafts/files/draft-rfced-info-cobb-...

diff -u pppd.new/ipcp.c pppd/ipcp.c
--- pppd.new/ipcp.c     Wed May 25 23:44:41 1994

     wo->old_addrs = 0;
     wo->ouraddr = 0;
     wo->hisaddr = 0;
+    wo->dnsaddr = 0;

     wo->neg_vj = 1;

            ho->hisaddr = ciaddr1;
            break;

+       /* Handle Micro$oft DNS Stuff */
+       case CI_MS_DNS:
+           IPCPDEBUG((LOG_INFO, "ipcp: received Micro$oft DNS Request "));
+
+           /* If we do not have a DNS address then we cannot send it */
+           if (wo->dnsaddr == 0 ||
+               cilen != CILEN_ADDR) {  /* Check CI length */
+               orc = CONFREJ;          /* Reject CI */
+               break;
+           }
+           GETLONG(tl,p);
+           if (htonl(tl) != wo->dnsaddr)
+            { /* Send him our DNS Ideas */
+              DECPTR(sizeof (long),p);
+              tl = ntohl(wo->dnsaddr);
+              PUTLONG(tl, p);
+              orc = CONFNAK;
+            }
+            break;
+            /* That all we do for this Micro$oft feature!!! */
+              
        case CI_COMPRESSTYPE:
            IPCPDEBUG((LOG_INFO, "ipcp: received COMPRESSTYPE "));
            if (!ao->neg_vj ||
diff -u pppd.new/ipcp.h pppd/ipcp.h
--- pppd.new/ipcp.h     Tue May 24 23:47:36 1994

 #define CI_COMPRESSTYPE        2       /* Compression Type */
 #define        CI_ADDR         3

+#define CI_MS_DNS      129     /* Micro$oft Win95 DNS Negotiation */
+
 #define MAX_STATES 16          /* from slcompress.h */


     u_short vj_protocol;       /* protocol value to use in VJ option */
     u_char maxslotindex, cflag;        /* values for RFC1332 VJ compression neg. */
     u_long ouraddr, hisaddr;   /* Addresses in NETWORK BYTE ORDER */
+    u_long dnsaddr;          /* DNS Address in Network Byte Order */
 } ipcp_options;

 extern fsm ipcp_fsm[];
diff -u pppd.new/options.c pppd/options.c
--- pppd.new/options.c  Thu May 26 19:06:09 1994

 static int setdisconnector __ARGS((char **));
 static int setdomain __ARGS((char **));
 static int setnetmask __ARGS((char **));
+static int setdnsaddr __ARGS((char **));
 static int setcrtscts __ARGS((void));
 static int setxonxoff __ARGS((void));

     {"chap-interval", 1, setchapintv}, /* Set interval for rechallenge */
     {"ipcp-accept-local", 0, setipcpaccl}, /* Accept peer's address for us */
     {"ipcp-accept-remote", 0, setipcpaccr}, /* Accept peer's address for it */
+    {"ms-dns", 1, setdnsaddr},                /* Micro$oft DNS */
     {NULL, 0, NULL}
 };

        modem           Use modem control lines\n\
        mru <n>           Set MRU value to <n> for negotiation\n\
        netmask <n>       Set interface netmask to <n>\n\
+       ms-dns <n>                Set DNS Address for Win95 DNS Negotiation
 See pppd(8) for more options.\n\
 ";

     }

     netmask = mask;
+    return (1);
+}
+
+/*
+ * setdnsaddr - set the dns address to be used with Win95
+ */
+static int
+setdnsaddr(argv)
+    char **argv;
+{
+    u_long dns;
+
+    if ((dns = inet_addr(*argv)) == -1) {
+       fprintf(stderr, "Invalid DNS Address %s\n", *argv);
+       return 0;
+    }
+
+    ipcp_wantoptions[0].dnsaddr = dns;
+    ipcp_allowoptions[0].dnsaddr = dns;
     return (1);
 }

--
-----------------------------------------------------------------------------
 Christoph Lameter            FTS Box 466, Pasadena, CA 91182
 Internet Administrator       Who is like Jesus... who is like God...?