diff options
author | Brian Somers <brian@FreeBSD.org> | 1998-06-14 01:21:24 +0000 |
---|---|---|
committer | Brian Somers <brian@FreeBSD.org> | 1998-06-14 01:21:24 +0000 |
commit | eee772ec70cd9667a62b8edef5f70ceb6d6c5ade (patch) | |
tree | d03a577b4fecc7c9caae9e8df42da34d025099e2 /usr.sbin/ppp/ip.c | |
parent | 42c57c8682fe98396181900a3634f6b0f5882671 (diff) | |
download | src-eee772ec70cd9667a62b8edef5f70ceb6d6c5ade.tar.gz src-eee772ec70cd9667a62b8edef5f70ceb6d6c5ade.zip |
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.
Notes
Notes:
svn path=/head/; revision=36961
Diffstat (limited to 'usr.sbin/ppp/ip.c')
-rw-r--r-- | usr.sbin/ppp/ip.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/usr.sbin/ppp/ip.c b/usr.sbin/ppp/ip.c index 7a889e03de13..f08031f545ac 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; |