+ getothers();
+}
+
+/*
+ * Look in a file for any gateways we should configure
+ * outside the directly connected ones. This is a kludge,
+ * but until we can find out about gateways on the "other side"
+ * of the ARPANET using GGP, it's a must.
+ *
+ * File format is one entry per line,
+ * destination gateway flags (all hex #'s)
+ *
+ * We don't really know the distance to the gateway, so we
+ * assume it's a neighbor.
+ */
+getothers()
+{
+ struct sockaddr_in dst, gate;
+ FILE *fp;
+ struct rt_entry *rt;
+ char flags[132];
+
+ fp = fopen("/etc/gateways", "r");
+ if (fp == NULL)
+ return;
+ bzero((char *)&dst, sizeof (dst));
+ bzero((char *)&gate, sizeof (gate));
+ dst.sin_family = AF_INET;
+ gate.sin_family = AF_INET;
+ flags[0] = '\0';
+ while (fscanf(fp, "dst %x gateway %x %s\n", &dst.sin_addr.s_addr,
+ &gate.sin_addr.s_addr, flags) != EOF) {
+ if (rt = rtlookup((struct sockaddr *)&dst)) {
+ flags[0] = '\0';
+ continue;
+ }
+ rtadd((struct sockaddr *)&dst,(struct sockaddr *)&gate,1);
+ rt = rtlookup(&dst);
+ if (strcmp(flags, "passive") == 0)
+ rt->rt_state |= RTS_PASSIVE;
+ flags[0] = '\0';
+ }
+ fclose(fp);