From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <199604080430.VAA01272@koala.azstarnet.com> Date: Sun, 7 Apr 1996 21:30:48 -0700 From: David Mosberger-Tang Subject: ipfwadm for Alpha Here is a tiny patch relative to ipfwadm-2.0beta2 that makes ipfwadm work under Linux/Alpha. I was able to get IP masquerading working by running the following command on the PPP-connected host with IP forwarding and masquerading enabled (this was with kernel 1.3.84, but any recent kernel should do): ipfwadm -F -a masquerade -S -D 0/0 In my case, is 192.168.1.0/24, but this obviously depends on the specific setup of the network. For more info on masquerading, see the IP masquerading FAQ available at ftp.eves.com in /pub/masq. Jos, would you mind integrating this patch into your sources? While I haven't tested it on an x86, there should be nothing that breaks the x86 case. --david diff -urN ipfwadm-2.0beta2/ipfwadm.c ipfwadm-2.0beta2-axp/ipfwadm.c --- ipfwadm-2.0beta2/ipfwadm.c Sat Feb 17 07:55:36 1996 +++ ipfwadm-2.0beta2-axp/ipfwadm.c Sun Apr 7 20:23:26 1996 @@ -894,7 +899,7 @@ { int i; static char buf[20]; - unsigned long maskaddr, bits; + __u32 maskaddr, bits; maskaddr = ntohl(mask->s_addr); @@ -1399,13 +1404,13 @@ for (nread = 0; nread < nfwlist; nread++) { fw = &fwlist[nread]; - if ((n = fscanf(fp, "%lX/%lX->%lX/%lX %16s %lX %hX %hu %hu %lu %lu", - (unsigned long *) &fw->fw_src.s_addr, - (unsigned long *) &fw->fw_smsk.s_addr, - (unsigned long *) &fw->fw_dst.s_addr, - (unsigned long *) &fw->fw_dmsk.s_addr, + if ((n = fscanf(fp, "%X/%X->%X/%X %16s %X %hX %hu %hu %lu %lu", + &fw->fw_src.s_addr, + &fw->fw_smsk.s_addr, + &fw->fw_dst.s_addr, + &fw->fw_dmsk.s_addr, fw->fw_vianame, - (unsigned long *) &fw->fw_via.s_addr, + &fw->fw_via.s_addr, &fw->fw_flg, &fw->fw_nsp, &fw->fw_ndp, &fw->fw_pcnt, &fw->fw_bcnt)) == -1) return nread; @@ -1442,10 +1447,10 @@ for (nread = 0; nread < nmslist; nread++) { ms = &mslist[nread]; - if ((n = fscanf(fp, " %s %lX:%hX %lX:%hX %hX %lX %hd %hd %lu", + if ((n = fscanf(fp, " %s %X:%hX %X:%hX %hX %lX %hd %hd %lu", buf, - (unsigned long *) &ms->src.s_addr, &ms->sport, - (unsigned long *) &ms->dst.s_addr, &ms->dport, + &ms->src.s_addr, &ms->sport, + &ms->dst.s_addr, &ms->dport, &ms->mport, &ms->initseq, &ms->delta, &ms->pdelta, &ms->expires)) == -1) return nread; @@ -1480,7 +1485,7 @@ iph = &ipfwp.fwp_iph; iph->version = IP_VERSION; - iph->ihl = sizeof(struct iphdr) / sizeof(unsigned long); + iph->ihl = sizeof(struct iphdr) / 4; iph->frag_off &= htons(~IP_OFFSET); iph->saddr = fw->fw_src.s_addr;