summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/ip.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1998-06-14 01:21:24 +0000
committerbrian <brian@FreeBSD.org>1998-06-14 01:21:24 +0000
commit0f59469cadaabf668b63f693782701a078e56c4f (patch)
tree60690da1d8998fc24537d8545f5f322f6941f651 /usr.sbin/ppp/ip.c
parent0e5f5ba899a4b90b622d4db2235bb06e2d592f50 (diff)
downloadFreeBSD-src-0f59469cadaabf668b63f693782701a078e56c4f.zip
FreeBSD-src-0f59469cadaabf668b63f693782701a078e56c4f.tar.gz
Deal with PROTO_IGMP and PROTO_IPIP packets correctly.
Submitted by: Mark Tinguely <tinguely@plains.NoDak.edu> This change will allow a PPP host enabled with the "-alias" option to run mrouted. This does not intend to forward the IGMP nor tunneled packets to another host on the far side if the tun0 interface.
Diffstat (limited to 'usr.sbin/ppp/ip.c')
-rw-r--r--usr.sbin/ppp/ip.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/usr.sbin/ppp/ip.c b/usr.sbin/ppp/ip.c
index 7a889e0..f08031f 100644
--- a/usr.sbin/ppp/ip.c
+++ b/usr.sbin/ppp/ip.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: ip.c,v 1.38.2.26 1998/05/06 23:50:11 brian Exp $
+ * $Id: ip.c,v 1.41 1998/05/21 21:45:37 brian Exp $
*
* TODO:
* o Return ICMP message for filterd packet
@@ -137,6 +137,8 @@ FilterCheck(struct ip *pip, struct filter *filter)
snprintf(dbuff, sizeof dbuff, "sport = %d", sport);
break;
case IPPROTO_UDP:
+ case IPPROTO_IGMP:
+ case IPPROTO_IPIP:
cproto = P_UDP;
uh = (struct udphdr *) ptop;
sport = ntohs(uh->uh_sport);
@@ -286,6 +288,28 @@ PacketCheck(struct bundle *bundle, char *cp, int nb, struct filter *filter)
loglen += strlen(logbuf + loglen);
}
break;
+ case IPPROTO_IPIP:
+ if (logit && loglen < sizeof logbuf) {
+ uh = (struct udphdr *) ptop;
+ snprintf(logbuf + loglen, sizeof logbuf - loglen,
+ "IPIP: %s:%d ---> ", inet_ntoa(pip->ip_src), ntohs(uh->uh_sport));
+ loglen += strlen(logbuf + loglen);
+ snprintf(logbuf + loglen, sizeof logbuf - loglen,
+ "%s:%d", inet_ntoa(pip->ip_dst), ntohs(uh->uh_dport));
+ loglen += strlen(logbuf + loglen);
+ }
+ break;
+ case IPPROTO_IGMP:
+ if (logit && loglen < sizeof logbuf) {
+ uh = (struct udphdr *) ptop;
+ snprintf(logbuf + loglen, sizeof logbuf - loglen,
+ "IGMP: %s:%d ---> ", inet_ntoa(pip->ip_src), ntohs(uh->uh_sport));
+ loglen += strlen(logbuf + loglen);
+ snprintf(logbuf + loglen, sizeof logbuf - loglen,
+ "%s:%d", inet_ntoa(pip->ip_dst), ntohs(uh->uh_dport));
+ loglen += strlen(logbuf + loglen);
+ }
+ break;
case IPPROTO_TCP:
th = (struct tcphdr *) ptop;
if (pip->ip_tos == IPTOS_LOWDELAY)
@@ -357,6 +381,7 @@ ip_Input(struct bundle *bundle, struct mbuf * bp)
int nb, nw;
struct tun_data tun;
struct ip *pip = (struct ip *)tun.data;
+ struct ip *piip = (struct ip *)((char *)pip + (pip->ip_hl << 2));
tun_fill_header(tun, AF_INET);
cp = tun.data;
@@ -374,7 +399,8 @@ ip_Input(struct bundle *bundle, struct mbuf * bp)
}
#ifndef NOALIAS
- if (alias_IsEnabled()) {
+ if (alias_IsEnabled() && pip->ip_p != IPPROTO_IGMP &&
+ (pip->ip_p != IPPROTO_IPIP || !IN_CLASSD(ntohl(piip->ip_dst.s_addr)))) {
struct tun_data *frag;
int iresult;
char *fptr;
OpenPOWER on IntegriCloud