ip.c (134789) | ip.c (134833) |
---|---|
1/*- 2 * Copyright (c) 1996 - 2001 Brian Somers <brian@Awfulhak.org> 3 * based on work by Toshiharu OHNO <tony-o@iij.ad.jp> 4 * Internet Initiative Japan, Inc (IIJ) 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 11 unchanged lines hidden (view full) --- 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * | 1/*- 2 * Copyright (c) 1996 - 2001 Brian Somers <brian@Awfulhak.org> 3 * based on work by Toshiharu OHNO <tony-o@iij.ad.jp> 4 * Internet Initiative Japan, Inc (IIJ) 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 11 unchanged lines hidden (view full) --- 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * |
28 * $FreeBSD: head/usr.sbin/ppp/ip.c 134789 2004-09-05 01:46:52Z brian $ | 28 * $FreeBSD: head/usr.sbin/ppp/ip.c 134833 2004-09-06 00:07:58Z marcel $ |
29 */ 30 31#include <sys/param.h> 32#include <sys/socket.h> 33#include <netinet/in.h> 34#include <netinet/in_systm.h> 35#include <netinet/ip.h> 36#ifndef NOINET6 --- 866 unchanged lines hidden (view full) --- 903 ssize_t nw; 904 size_t nb; 905 struct tun_data tun; 906 char *data; 907 unsigned secs, alivesecs; 908 909 nb = m_length(bp); 910 if (nb > sizeof tun.data) { | 29 */ 30 31#include <sys/param.h> 32#include <sys/socket.h> 33#include <netinet/in.h> 34#include <netinet/in_systm.h> 35#include <netinet/ip.h> 36#ifndef NOINET6 --- 866 unchanged lines hidden (view full) --- 903 ssize_t nw; 904 size_t nb; 905 struct tun_data tun; 906 char *data; 907 unsigned secs, alivesecs; 908 909 nb = m_length(bp); 910 if (nb > sizeof tun.data) { |
911 log_Printf(LogWARN, "ip_Input: %s: Packet too large (got %d, max %d)\n", | 911 log_Printf(LogWARN, "ip_Input: %s: Packet too large (got %zd, max %d)\n", |
912 l->name, nb, (int)(sizeof tun.data)); 913 m_freem(bp); 914 return 0; 915 } 916 mbuf_Read(bp, tun.data, nb); 917 918 secs = 0; 919 if (PacketCheck(bundle, af, tun.data, nb, &bundle->filter.in, --- 12 unchanged lines hidden (view full) --- 932 nb += sizeof tun - sizeof tun.data; 933 data = (char *)&tun; 934 } else 935 data = tun.data; 936 937 nw = write(bundle->dev.fd, data, nb); 938 if (nw != (ssize_t)nb) { 939 if (nw == -1) | 912 l->name, nb, (int)(sizeof tun.data)); 913 m_freem(bp); 914 return 0; 915 } 916 mbuf_Read(bp, tun.data, nb); 917 918 secs = 0; 919 if (PacketCheck(bundle, af, tun.data, nb, &bundle->filter.in, --- 12 unchanged lines hidden (view full) --- 932 nb += sizeof tun - sizeof tun.data; 933 data = (char *)&tun; 934 } else 935 data = tun.data; 936 937 nw = write(bundle->dev.fd, data, nb); 938 if (nw != (ssize_t)nb) { 939 if (nw == -1) |
940 log_Printf(LogERROR, "ip_Input: %s: wrote %d, got %s\n", | 940 log_Printf(LogERROR, "ip_Input: %s: wrote %zd, got %s\n", |
941 l->name, nb, strerror(errno)); 942 else | 941 l->name, nb, strerror(errno)); 942 else |
943 log_Printf(LogERROR, "ip_Input: %s: wrote %d, got %d\n", l->name, nb, nw); | 943 log_Printf(LogERROR, "ip_Input: %s: wrote %zd, got %zd\n", l->name, nb, 944 nw); |
944 } 945 946 return nb; 947} 948 949struct mbuf * 950ipv4_Input(struct bundle *bundle, struct link *l, struct mbuf *bp) 951{ --- 36 unchanged lines hidden --- | 945 } 946 947 return nb; 948} 949 950struct mbuf * 951ipv4_Input(struct bundle *bundle, struct link *l, struct mbuf *bp) 952{ --- 36 unchanged lines hidden --- |