diff options
Diffstat (limited to 'isisd')
| -rw-r--r-- | isisd/isis_lsp.c | 16 | ||||
| -rw-r--r-- | isisd/isis_network.c | 12 | ||||
| -rw-r--r-- | isisd/isis_pdu.c | 19 | ||||
| -rw-r--r-- | isisd/isis_tlv.c | 15 | 
4 files changed, 25 insertions, 37 deletions
| diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c index 8dae147f..52d8884d 100644 --- a/isisd/isis_lsp.c +++ b/isisd/isis_lsp.c @@ -369,7 +369,6 @@ lsp_update_data (struct isis_lsp *lsp, struct stream *stream,    /* copying only the relevant part of our stream */    lsp->pdu = stream_new (stream->endp); -  lsp->pdu->putp = stream->putp;    lsp->pdu->getp = stream->getp;    lsp->pdu->endp = stream->endp;    memcpy (lsp->pdu->data, stream->data, stream->endp); @@ -509,7 +508,7 @@ lsp_new (u_char * lsp_id, u_int16_t rem_lifetime, u_int32_t seq_num,    lsp->level = level;    lsp->age_out = ZERO_AGE_LIFETIME; -  stream_set_putp (lsp->pdu, ISIS_FIXED_HDR_LEN + ISIS_LSP_HDR_LEN); +  stream_forward_endp (lsp->pdu, ISIS_FIXED_HDR_LEN + ISIS_LSP_HDR_LEN);    /* #ifdef EXTREME_DEBUG */    /* logging */ @@ -1141,7 +1140,7 @@ lsp_build_nonpseudo (struct isis_lsp *lsp, struct isis_area *area)  	}      } -  stream_set_putp (lsp->pdu, ISIS_FIXED_HDR_LEN + ISIS_LSP_HDR_LEN); +  stream_forward_endp (lsp->pdu, ISIS_FIXED_HDR_LEN + ISIS_LSP_HDR_LEN);    if (lsp->tlv_data.nlpids)      tlv_add_nlpid (lsp->tlv_data.nlpids, lsp->pdu); @@ -1159,7 +1158,7 @@ lsp_build_nonpseudo (struct isis_lsp *lsp, struct isis_area *area)      tlv_add_ipv6_reachs (lsp->tlv_data.ipv6_reachs, lsp->pdu);  #endif /* HAVE_IPV6 */ -  lsp->lsp_header->pdu_len = htons (stream_get_putp (lsp->pdu)); +  lsp->lsp_header->pdu_len = htons (stream_get_endp (lsp->pdu));    return;  } @@ -1200,7 +1199,7 @@ lsp_tlv_fit (struct isis_lsp *lsp, struct list **from, struct list **to,  	}        tlv_build_func (*to, lsp->pdu);      } -  lsp->lsp_header->pdu_len = htons (stream_get_putp (lsp->pdu)); +  lsp->lsp_header->pdu_len = htons (stream_get_endp (lsp->pdu));    return;  } @@ -1319,7 +1318,7 @@ lsp_build_nonpseudo (struct isis_lsp *lsp, struct isis_area *area)    /*     * Building the zero lsp     */ -  stream_set_putp (lsp->pdu, ISIS_FIXED_HDR_LEN + ISIS_LSP_HDR_LEN); +  stream_forward_endp (lsp->pdu, ISIS_FIXED_HDR_LEN + ISIS_LSP_HDR_LEN);    /*     * Add the authentication info if its present     */ @@ -1929,7 +1928,7 @@ lsp_build_pseudo (struct isis_lsp *lsp, struct isis_circuit *circuit,  	}      } -  stream_set_putp (lsp->pdu, ISIS_FIXED_HDR_LEN + ISIS_LSP_HDR_LEN); +  stream_forward_endp (lsp->pdu, ISIS_FIXED_HDR_LEN + ISIS_LSP_HDR_LEN);    /*     * Add the authentication info if it's present     */ @@ -1947,7 +1946,7 @@ lsp_build_pseudo (struct isis_lsp *lsp, struct isis_circuit *circuit,    if (lsp->tlv_data.es_neighs && listcount (lsp->tlv_data.es_neighs) > 0)      tlv_add_is_neighs (lsp->tlv_data.es_neighs, lsp->pdu); -  lsp->lsp_header->pdu_len = htons (stream_get_putp (lsp->pdu)); +  lsp->lsp_header->pdu_len = htons (stream_get_endp (lsp->pdu));    iso_csum_create (STREAM_DATA (lsp->pdu) + 12,  		   ntohs (lsp->lsp_header->pdu_len) - 12, 12); @@ -2473,7 +2472,6 @@ build_topology_lsp_data (struct isis_lsp *lsp, struct isis_area *area,      }    /* thanks to hannes, another bug bites the dust */ -  lsp->pdu->putp = ntohs (lsp->lsp_header->pdu_len);    lsp->pdu->endp = ntohs (lsp->lsp_header->pdu_len);  }  #endif /* TOPOLOGY_GENERATE */ diff --git a/isisd/isis_network.c b/isisd/isis_network.c index a0df32e3..2e901f1a 100644 --- a/isisd/isis_network.c +++ b/isisd/isis_network.c @@ -422,7 +422,6 @@ isis_recv_pdu_bcast (struct isis_circuit *circuit, u_char * ssnpa)    /* then we lose the LLC */    memcpy (STREAM_DATA (circuit->rcv_stream),  	  sock_buff + LLC_LEN, bytesread - LLC_LEN); -  circuit->rcv_stream->putp = bytesread - LLC_LEN;    circuit->rcv_stream->endp = bytesread - LLC_LEN;    memcpy (ssnpa, &s_addr.sll_addr, s_addr.sll_halen); @@ -453,7 +452,6 @@ isis_recv_pdu_p2p (struct isis_circuit *circuit, u_char * ssnpa)        return ISIS_WARNING;      } -  circuit->rcv_stream->putp = bytesread;    circuit->rcv_stream->endp = bytesread;    /* If we don't have protocol type 0x00FE which is @@ -503,7 +501,7 @@ isis_send_pdu_bcast (struct isis_circuit *circuit, int level)    /* now we can send this */    written = sendto (circuit->fd, sock_buff, -		    circuit->snd_stream->putp + LLC_LEN, 0, +		    stream_get_endp(circuit->snd_stream) + LLC_LEN, 0,  		    (struct sockaddr *) &sa, sizeof (struct sockaddr_ll));    return ISIS_OK; @@ -531,7 +529,8 @@ isis_send_pdu_p2p (struct isis_circuit *circuit, int level)    /* lets try correcting the protocol */    sa.sll_protocol = htons (0x00FE);    written = sendto (circuit->fd, circuit->snd_stream->data, -		    circuit->snd_stream->putp, 0, (struct sockaddr *) &sa, +		    stream_get_endp (circuit->snd_stream), 0,  +		    (struct sockaddr *) &sa,  		    sizeof (struct sockaddr_ll));    return ISIS_OK; @@ -576,7 +575,6 @@ isis_recv_pdu_bcast (struct isis_circuit *circuit, u_char * ssnpa)    memcpy (STREAM_DATA (circuit->rcv_stream),  	  readbuff + offset, bpf_hdr->bh_caplen - LLC_LEN - ETHER_HDR_LEN); -  circuit->rcv_stream->putp = bpf_hdr->bh_caplen - LLC_LEN - ETHER_HDR_LEN;    circuit->rcv_stream->endp = bpf_hdr->bh_caplen - LLC_LEN - ETHER_HDR_LEN;    circuit->rcv_stream->getp = 0; @@ -603,7 +601,6 @@ isis_recv_pdu_p2p (struct isis_circuit *circuit, u_char * ssnpa)        return ISIS_WARNING;      } -  circuit->rcv_stream->putp = bytesread;    circuit->rcv_stream->endp = bytesread;    return ISIS_OK; @@ -641,7 +638,8 @@ isis_send_pdu_bcast (struct isis_circuit *circuit, int level)    /* now we can send this */    written = write (circuit->fd, sock_buff, -		   circuit->snd_stream->putp + LLC_LEN + ETHER_HDR_LEN); +		   stream_get_endp (circuit->snd_stream)  +		    + LLC_LEN + ETHER_HDR_LEN);    return ISIS_OK;  } diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c index b6a035e1..6dcc75e9 100644 --- a/isisd/isis_pdu.c +++ b/isisd/isis_pdu.c @@ -1938,7 +1938,7 @@ send_hello (struct isis_circuit *circuit, int level)    hello_hdr.hold_time = htons ((u_int16_t) interval);    hello_hdr.pdu_len = 0;	/* Update the PDU Length later */ -  len_pointer = stream_get_putp (circuit->snd_stream) + 3 + ISIS_SYS_ID_LEN; +  len_pointer = stream_get_endp (circuit->snd_stream) + 3 + ISIS_SYS_ID_LEN;    /* copy the shared part of the hello to the p2p hello if needed */    if (circuit->circ_type == CIRCUIT_T_P2P) @@ -2012,7 +2012,7 @@ send_hello (struct isis_circuit *circuit, int level)      if (tlv_add_padding (circuit->snd_stream))        return ISIS_WARNING; -  length = stream_get_putp (circuit->snd_stream); +  length = stream_get_endp (circuit->snd_stream);    /* Update PDU length */    stream_putw_at (circuit->snd_stream, len_pointer, (u_int16_t) length); @@ -2132,7 +2132,7 @@ build_csnp (int level, u_char * start, u_char * stop, struct list *lsps,     * Fill Level 1 or 2 Complete Sequence Numbers header     */ -  lenp = stream_get_putp (circuit->snd_stream); +  lenp = stream_get_endp (circuit->snd_stream);    stream_putw (circuit->snd_stream, 0);	/* PDU length - when we know it */    /* no need to send the source here, it is always us if we csnp */    stream_put (circuit->snd_stream, isis->sysid, ISIS_SYS_ID_LEN); @@ -2159,7 +2159,7 @@ build_csnp (int level, u_char * start, u_char * stop, struct list *lsps,      {        retval = tlv_add_lsp_entries (lsps, circuit->snd_stream);      } -  length = (u_int16_t) stream_get_putp (circuit->snd_stream); +  length = (u_int16_t) stream_get_endp (circuit->snd_stream);    assert (length >= ISIS_CSNP_HDRLEN);    /* Update PU length */    stream_putw_at (circuit->snd_stream, lenp, length); @@ -2287,7 +2287,7 @@ build_psnp (int level, struct isis_circuit *circuit, struct list *lsps)    /*     * Fill Level 1 or 2 Partial Sequence Numbers header     */ -  lenp = stream_get_putp (circuit->snd_stream); +  lenp = stream_get_endp (circuit->snd_stream);    stream_putw (circuit->snd_stream, 0);	/* PDU length - when we know it */    stream_put (circuit->snd_stream, isis->sysid, ISIS_SYS_ID_LEN);    stream_putc (circuit->snd_stream, circuit->idx); @@ -2325,7 +2325,7 @@ build_psnp (int level, struct isis_circuit *circuit, struct list *lsps)        }      } -  length = (u_int16_t) stream_get_putp (circuit->snd_stream); +  length = (u_int16_t) stream_get_endp (circuit->snd_stream);    assert (length >= ISIS_PSNP_HDRLEN);    /* Update PDU length */    stream_putw_at (circuit->snd_stream, lenp, length); @@ -2446,7 +2446,7 @@ build_link_state (struct isis_lsp *lsp, struct isis_circuit *circuit,    unsigned long length;    stream_put (stream, lsp->pdu, ntohs (lsp->lsp_header->pdu_len)); -  length = stream_get_putp (stream); +  length = stream_get_endp (stream);    return;  } */ @@ -2501,7 +2501,6 @@ send_lsp (struct thread *thread)  	    }  	  /* copy our lsp to the send buffer */  	  circuit->snd_stream->getp = lsp->pdu->getp; -	  circuit->snd_stream->putp = lsp->pdu->putp;  	  circuit->snd_stream->endp = lsp->pdu->endp;  	  memcpy (circuit->snd_stream->data, lsp->pdu->data, lsp->pdu->endp); @@ -2577,7 +2576,7 @@ ack_lsp (struct isis_link_state_hdr *hdr, struct isis_circuit *circuit,  			      circuit->snd_stream); -  lenp = stream_get_putp (circuit->snd_stream); +  lenp = stream_get_endp (circuit->snd_stream);    stream_putw (circuit->snd_stream, 0);	/* PDU length  */    stream_put (circuit->snd_stream, isis->sysid, ISIS_SYS_ID_LEN);    stream_putc (circuit->snd_stream, circuit->idx); @@ -2589,7 +2588,7 @@ ack_lsp (struct isis_link_state_hdr *hdr, struct isis_circuit *circuit,    stream_putl (circuit->snd_stream, ntohl (hdr->seq_num));    stream_putw (circuit->snd_stream, ntohs (hdr->checksum)); -  length = (u_int16_t) stream_get_putp (circuit->snd_stream); +  length = (u_int16_t) stream_get_endp (circuit->snd_stream);    /* Update PDU length */    stream_putw_at (circuit->snd_stream, lenp, length); diff --git a/isisd/isis_tlv.c b/isisd/isis_tlv.c index 84f36c93..bc653632 100644 --- a/isisd/isis_tlv.c +++ b/isisd/isis_tlv.c @@ -751,7 +751,7 @@ int  add_tlv (u_char tag, u_char len, u_char * value, struct stream *stream)  { -  if (STREAM_SIZE (stream) - stream_get_putp (stream) < (unsigned) len + 2) +  if (STREAM_SIZE (stream) - stream_get_endp (stream) < (unsigned) len + 2)      {        zlog_warn ("No room for TLV of type %d", tag);        return ISIS_WARNING; @@ -1065,7 +1065,6 @@ tlv_add_ipv6_reachs (struct list *ipv6_reachs, struct stream *stream)  int  tlv_add_padding (struct stream *stream)  { -  unsigned long putp, endp;    int fullpads, i, left;    /* @@ -1078,15 +1077,10 @@ tlv_add_padding (struct stream *stream)  	goto err;        if (!stream_putc (stream, (u_char) 255))	/* LENGHT */  	goto err; -      endp = stream_get_endp (stream); -      putp = stream_get_putp (stream); -      if (putp != endp) -	zlog_warn ("tvl_add_padding endp %ld while putp %ld", endp, putp); -      stream_set_putp (stream, putp + 255);	/* VALUE */ -      stream->endp = stream->putp; +      stream_forward_endp (stream, 255);	/* VALUE */      } -  left = STREAM_SIZE (stream) - stream_get_putp (stream); +  left = STREAM_SIZE (stream) - stream_get_endp (stream);    if (left < 2)      return ISIS_OK; @@ -1100,8 +1094,7 @@ tlv_add_padding (struct stream *stream)    stream_putc (stream, PADDING);    stream_putc (stream, left - 2); -  stream_set_putp (stream, stream_get_putp (stream) + left - 2); -  stream->endp = stream->putp; +  stream_forward_endp (stream, left - 2);    return ISIS_OK; | 
