summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorZhiyong Yang <zhiyong.yang@intel.com>2019-05-06 04:47:22 -0400
committerDave Barach <openvpp@barachs.net>2019-05-06 12:21:42 +0000
commit7107d7ef036b48cf910cb90a03978b9371b5c3ab (patch)
tree42903f8aea9cb6ddd6fb511601dbf3dda3a65aff /src
parent0dd9165cc7544772626d157347c2635444475052 (diff)
ppp: simplify code using existing functions
Change-Id: Ib5289b4d08ca7a8d7f786cc606e6c760735b2a35 Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/vnet/ppp/node.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/vnet/ppp/node.c b/src/vnet/ppp/node.c
index 2f6e0c337e1..fd0105e4305 100644
--- a/src/vnet/ppp/node.c
+++ b/src/vnet/ppp/node.c
@@ -139,14 +139,11 @@ ppp_input (vlib_main_t * vm,
b0 = vlib_get_buffer (vm, bi0);
b1 = vlib_get_buffer (vm, bi1);
- h0 = (void *) (b0->data + b0->current_data);
- h1 = (void *) (b1->data + b1->current_data);
+ h0 = vlib_buffer_get_current (b0);
+ h1 = vlib_buffer_get_current (b1);
- b0->current_data += sizeof (h0[0]);
- b1->current_data += sizeof (h1[0]);
-
- b0->current_length -= sizeof (h0[0]);
- b1->current_length -= sizeof (h1[0]);
+ vlib_buffer_advance (b0, sizeof (ppp_header_t));
+ vlib_buffer_advance (b1, sizeof (ppp_header_t));
/* Index sparse array with network byte order. */
protocol0 = h0->protocol;
@@ -227,10 +224,9 @@ ppp_input (vlib_main_t * vm,
b0 = vlib_get_buffer (vm, bi0);
- h0 = (void *) (b0->data + b0->current_data);
+ h0 = vlib_buffer_get_current (b0);
- b0->current_data += sizeof (h0[0]);
- b0->current_length -= sizeof (h0[0]);
+ vlib_buffer_advance (b0, sizeof (ppp_header_t));
protocol0 = h0->protocol;
i0 = sparse_vec_index (rt->next_by_protocol, protocol0);