Changeset e953e2df in rtems


Ignore:
Timestamp:
Apr 15, 2005, 6:29:42 AM (15 years ago)
Author:
Ralf Corsepius <ralf.corsepius@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
10a4f75
Parents:
44557f8
Message:

Partial updates from FreeBSD.

Location:
cpukit/libnetworking
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libnetworking/net/if_arp.h

    r44557f8 re953e2df  
    5151        u_short ar_hrd BYTE_PACK;               /* format of hardware address */
    5252#define ARPHRD_ETHER    1       /* ethernet hardware format */
     53#define ARPHRD_IEEE802  6       /* token-ring hardware format */
     54#define ARPHRD_ARCNET   7       /* arcnet hardware format */
    5355#define ARPHRD_FRELAY   15      /* frame relay hardware format */
     56#define ARPHRD_IEEE1394 24      /* firewire hardware format */
    5457        u_short ar_pro BYTE_PACK;               /* format of protocol address */
    5558        u_char  ar_hln BYTE_PACK;               /* length of hardware address */
  • cpukit/libnetworking/netinet/ip.h

    r44557f8 re953e2df  
    1111 *    notice, this list of conditions and the following disclaimer in the
    1212 *    documentation and/or other materials provided with the distribution.
    13  * 3. All advertising materials mentioning features or use of this software
    14  *    must display the following acknowledgement:
    15  *      This product includes software developed by the University of
    16  *      California, Berkeley and its contributors.
    1713 * 4. Neither the name of the University nor the names of its contributors
    1814 *    may be used to endorse or promote products derived from this software
     
    3228 *
    3329 *      @(#)ip.h        8.2 (Berkeley) 6/1/94
     30 * $FreeBSD: src/sys/netinet/ip.h,v 1.29 2005/01/07 01:45:44 imp Exp $
     31 */
     32
     33/*
    3434 *      $Id$
    3535 */
     
    4646/*
    4747 * Structure of an internet header, naked of options.
    48  *
    49  * We declare ip_len and ip_off to be short, rather than u_short
    50  * pragmatically since otherwise unsigned comparisons can result
    51  * against negative integers quite easily, and fail in subtle ways.
    5248 */
    5349struct ip {
     
    5652#else
    5753#if BYTE_ORDER == LITTLE_ENDIAN
    58         u_char  ip_hl:4,                /* header length */
     54        u_int   ip_hl:4,                /* header length */
    5955                ip_v:4;                 /* version */
    6056#endif
    6157#if BYTE_ORDER == BIG_ENDIAN
    62         u_char  ip_v:4,                 /* version */
     58        u_int   ip_v:4,                 /* version */
    6359                ip_hl:4;                /* header length */
    6460#endif
     
    8682#endif
    8783
     84#ifdef CTASSERT
     85CTASSERT(sizeof (struct ip) == 20);
     86#endif
     87
    8888#define IP_MAXPACKET    65535           /* maximum packet size */
    8989
     
    9595#define IPTOS_RELIABILITY       0x04
    9696#define IPTOS_MINCOST           0x02
     97#if 1
     98/* ECN RFC3168 obsoletes RFC2481, and these will be deprecated soon. */
     99#define IPTOS_CE                0x01
     100#define IPTOS_ECT               0x02
     101#endif
    97102
    98103/*
     
    109114
    110115/*
     116 * ECN (Explicit Congestion Notification) codepoints in RFC3168
     117 * mapped to the lower 2 bits of the TOS field.
     118 */
     119#define IPTOS_ECN_NOTECT        0x00    /* not-ECT */
     120#define IPTOS_ECN_ECT1          0x01    /* ECN-capable transport (1) */
     121#define IPTOS_ECN_ECT0          0x02    /* ECN-capable transport (0) */
     122#define IPTOS_ECN_CE            0x03    /* congestion experienced */
     123#define IPTOS_ECN_MASK          0x03    /* ECN field mask */
     124
     125/*
    111126 * Definitions for options.
    112127 */
     
    127142#define IPOPT_SECURITY          130             /* provide s,c,h,tcc */
    128143#define IPOPT_LSRR              131             /* loose source route */
     144#define IPOPT_ESO               133             /* extended security */
     145#define IPOPT_CIPSO             134             /* commerical security */
    129146#define IPOPT_SATID             136             /* satnet id */
    130147#define IPOPT_SSRR              137             /* strict source route */
     
    147164        u_char  ipt_ptr;                /* index of current entry */
    148165#if BYTE_ORDER == LITTLE_ENDIAN
    149         u_char  ipt_flg:4,              /* flags, see below */
     166        u_int   ipt_flg:4,              /* flags, see below */
    150167                ipt_oflw:4;             /* overflow counter */
    151168#endif
    152169#if BYTE_ORDER == BIG_ENDIAN
    153         u_char  ipt_oflw:4,             /* overflow counter */
     170        u_int   ipt_oflw:4,             /* overflow counter */
    154171                ipt_flg:4;              /* flags, see below */
    155172#endif
     
    189206#define IP_MSS          576             /* default maximum segment size */
    190207
    191 #endif
     208/*
     209 * This is the real IPv4 pseudo header, used for computing the TCP and UDP
     210 * checksums. For the Internet checksum, struct ipovly can be used instead.
     211 * For stronger checksums, the real thing must be used.
     212 */
     213struct ippseudo {
     214        struct  in_addr ippseudo_src;   /* source internet address */
     215        struct  in_addr ippseudo_dst;   /* destination internet address */
     216        u_char          ippseudo_pad;   /* pad, must be zero */
     217        u_char          ippseudo_p;     /* protocol */
     218        u_short         ippseudo_len;   /* protocol length */
     219};
     220#endif
  • cpukit/libnetworking/netinet/ip_icmp.c

    r44557f8 re953e2df  
    1111 *    notice, this list of conditions and the following disclaimer in the
    1212 *    documentation and/or other materials provided with the distribution.
    13  * 3. All advertising materials mentioning features or use of this software
    14  *    must display the following acknowledgement:
    15  *      This product includes software developed by the University of
    16  *      California, Berkeley and its contributors.
    1713 * 4. Neither the name of the University nor the names of its contributors
    1814 *    may be used to endorse or promote products derived from this software
     
    3228 *
    3329 *      @(#)ip_icmp.c   8.2 (Berkeley) 1/4/94
    34  *      $Id$
     30 * $FreeBSD: src/sys/netinet/ip_icmp.c,v 1.98 2005/01/07 01:45:44 imp Exp $
     31 */
     32
     33/*
     34 * $Id$
    3535 */
    3636
     
    5858#include <netinet/icmp_var.h>
    5959
     60#ifdef IPSEC
     61#include <netinet6/ipsec.h>
     62#include <netkey/key.h>
     63#endif
     64
     65#ifdef FAST_IPSEC
     66#include <netipsec/ipsec.h>
     67#include <netipsec/key.h>
     68#define IPSEC
     69#endif
     70
     71#include <machine/in_cksum.h>
     72
    6073/*
    6174 * ICMP routines: error generation, receive packet processing, and
     
    8194#endif
    8295
    83 static void     icmp_reflect __P((struct mbuf *));
    84 static void     icmp_send __P((struct mbuf *, struct mbuf *));
    85 static int      ip_next_mtu __P((int, int));
     96static void     icmp_reflect(struct mbuf *);
     97static void     icmp_send(struct mbuf *, struct mbuf *);
     98static int      ip_next_mtu(int, int);
    8699
    87100extern  struct protosw inetsw[];
     
    132145        if (m == NULL)
    133146                goto freeit;
    134         icmplen = oiplen + min(8, oip->ip_len);
     147#ifdef MAC
     148        mac_create_mbuf_netlayer(n, m);
     149#endif
     150        icmplen = min(oiplen + 8, oip->ip_len);
     151        if (icmplen < sizeof(struct ip))
     152                panic("icmp_error: bad length");
    135153        m->m_len = icmplen + ICMP_MINLEN;
    136154        MH_ALIGN(m, m->m_len);
     
    192210 */
    193211void
    194 icmp_input(m, hlen)
    195         register struct mbuf *m;
    196         int hlen;
     212icmp_input(m, off)
     213        struct mbuf *m;
     214        int off;
    197215{
    198         register struct icmp *icp;
    199         register struct ip *ip = mtod(m, struct ip *);
     216        struct icmp *icp;
     217        struct in_ifaddr *ia;
     218        struct ip *ip = mtod(m, struct ip *);
     219        int hlen = off;
    200220        int icmplen = ip->ip_len;
    201         register int i;
    202         struct in_ifaddr *ia;
    203         void (*ctlfunc) __P((int, struct sockaddr *, void *));
    204         int code;
     221        int i, code;
     222        void (*ctlfunc)(int, struct sockaddr *, void *);
    205223
    206224        /*
     
    258276                        case ICMP_UNREACH_PORT:
    259277                        case ICMP_UNREACH_SRCFAIL:
    260                                 code += PRC_UNREACH_NET;
     278                                code = PRC_UNREACH_NET;
    261279                                break;
    262280
     
    507525        struct mbuf *m;
    508526{
    509         register struct ip *ip = mtod(m, struct ip *);
    510         register struct in_ifaddr *ia;
     527        struct ip *ip = mtod(m, struct ip *);
     528        struct in_ifaddr *ia;
    511529        struct in_addr t;
    512530        struct mbuf *opts = 0;
     
    576594                                    len = 1;
    577595                            else {
     596                                    if (cnt < IPOPT_OLEN + sizeof(*cp))
     597                                            break;
    578598                                    len = cp[IPOPT_OLEN];
    579                                     if (len <= 0 || len > cnt)
     599                                    if (len < IPOPT_OLEN + sizeof(*cp) ||
     600                                        len > cnt)
    580601                                            break;
    581602                            }
Note: See TracChangeset for help on using the changeset viewer.