The IP over ATM Mailing List Archive by date

Cell Relay Retreat>List Archive>month:1995-Feb> msg00115



[Date Prev][Date Next][Thread Prev][Thread Next]  
  [Date Index][Thread Index][Author Index][Subject Index]

ATMARP_NAK format?

  • From: Craig Partridge <craig@aland.bbn.com>
  • Date: Thu, 23 Feb 95 10:24:50 -0800
  • CC: Uttam Shikarpur <uttam@zk3.dec.com>, ip-atm@matmos.hpl.hp.com


    
    Craig also, can you give some comment on the fixed ATM address sizes
    in the ATMARP packets that was raised as an issue last week or so?

Well, it is a classical "save space" vs "save time" issue.  Fixed sized
fields are very nice for quick packet parsing.  To illustrate the point,
if we had a rule that said that the fields were fixed sized and if not
in use, were, say, stuffed with all zeros but still there, one could
define an ATM-ARP structure something like this:

struct  aarphdr {
        u_short aar_hrd;        /* format of hardware address */
#define ARP_ATM_ADDR 19
        u_short aar_pro;        /* format of protocol address */
#define AA_TMASK 0100
#define AA_LMASK 077
#define AA_RESV  0200
#define AAT_E164 0100
#define HTL_NULL 0x40   /* null value of HTL */
        u_char  aar_shtl;       /* type & whether source ATM present */
        u_char  aar_sstl;       /* type & whether source ATM sub addr present */
        u_short aar_op;         /* one of: */
#define ARPOP_INARP     8
#define ARPOP_INARP_REPLY       9
#define ARPOP_NACK      10
        u_char  aar_thtl;       /* type & whether target ATM present */
        u_char  aar_tstl;       /* type & whether target ATM sub addr present */
	u_char  aar_atmsrc[20];
	u_char  aar_atmsrc_sub[20];
	struct in_addr aar_srcip;
	u_char  aar_atmtgt[20];
	u_char  aar_atmtgt_sub[20];
	struct in_addr aar_tgtip;
};

and the result, when you want to grab, say, the target ATM address is that
you simply check to see if aar_thtl is not HTL_NULL (or some such) and
then just access msg->aar_atmtgt

Currently you have to do something more tricky, for example:

get_tgtaddr(amp,samp)
struct arpmsg *amp;
struct sockaddr_atm *samp;
{
    register int i = AM_HDR_BYTES;
    register int j;

    /*
     * skip over source ATM address and source ATM subaddress
     * and source IP addr
     */  

    i += amp->am_hdr.aar_shtl & ~0xC0;
    i += amp->am_hdr.aar_sstl & ~0xC0;
    i += amp->am_hdr.aar_spln;

    j = amp->am_hdr.aar_thtl & ~0xC0;
    if (i+j > amp->am_len)
        goto runt;

    if (samp)
        bcopy((char *)&(amp->am_data[i]),(char *)&(samp->satm_addr),j);
    i += j;

    if (j = (amp->am_hdr.aar_tstl & ~0xC0))
    {
        if (i+j > amp->am_len)
            goto runt;
        if (samp)
            bcopy((char *)&(amp->am_data[i]),(char *)&(samp->satm_subaddr),j);
        i += j;
    }

    return(0);
runt:
    syslog(LOG_WARNING,"runt ATM ARP packet");
    return(1);
}

One can do this (and I have, in great quantity in my ARP server -- the problems
get even more fun when stuffing fields into an outbound packet -- if you
are not careful you have to bcopy already filled in data to make space for
new data, etc, plus play these offset games).

Craig