1 commit 06ba776f6be670e547c4cf527a0a386f3917e567
2 Author: Itohan <itohan.ukponmwan@intel.com>
3 Date: Fri Dec 8 00:12:07 2017 +0000
7 Signed-off-by: Itohan <itohan.ukponmwan@intel.com>
9 diff --git a/src/plugins/snat/out2in.c b/src/plugins/snat/out2in.c
10 index 7de85eb..e2e6cec 100644
11 --- a/src/plugins/snat/out2in.c
12 +++ b/src/plugins/snat/out2in.c
16 * Copyright (c) 2016 Cisco and/or its affiliates.
17 * Licensed under the Apache License, Version 2.0 (the "License");
18 @@ -648,6 +649,25 @@ snat_out2in_node_fn (vlib_main_t * vm,
19 n_left_from = frame->n_vectors;
20 next_index = node->cached_next_index;
23 + ip4_address_t * sdnc_addr = malloc(4);
24 + char line_input[128];
25 + char * path = "/opt/config/ip.txt";
26 + FILE * f = fopen(path, "r");
28 + while (fgets(line_input, 128, f) != NULL){
29 + if (!strcmp(strtok(line_input, " "),"sdnc_ip:")){
30 + char * ip = strtok(NULL, " ");
31 + char * num = strtok(ip, ".");
32 + sdnc_addr->data[0] = atoi(num);
33 + for (int i = 1; i < 4; i ++){
34 + num = strtok(NULL, ".");
35 + sdnc_addr->data[i] = atoi(num);
41 while (n_left_from > 0)
44 @@ -723,6 +743,13 @@ snat_out2in_node_fn (vlib_main_t * vm,
46 proto0 = ip_proto_to_snat_proto (ip0->protocol);
49 + if (PREDICT_TRUE (ip0->src_address.data_u32 != sdnc_addr->data_u32))
51 + next0 = SNAT_OUT2IN_NEXT_LOOKUP;
55 if (PREDICT_FALSE (proto0 == ~0))
58 @@ -858,6 +885,13 @@ snat_out2in_node_fn (vlib_main_t * vm,
60 proto1 = ip_proto_to_snat_proto (ip1->protocol);
63 + if (PREDICT_TRUE (ip1->src_address.data_u32 != sdnc_addr->data_u32))
65 + next1 = SNAT_OUT2IN_NEXT_LOOKUP;
69 if (PREDICT_FALSE (proto1 == ~0))
72 @@ -1017,6 +1051,13 @@ snat_out2in_node_fn (vlib_main_t * vm,
74 proto0 = ip_proto_to_snat_proto (ip0->protocol);
77 + if (PREDICT_TRUE (ip0->src_address.data_u32 != sdnc_addr->data_u32))
79 + next0 = SNAT_OUT2IN_NEXT_LOOKUP;
83 if (PREDICT_FALSE (proto0 == ~0))
86 @@ -1153,6 +1194,7 @@ snat_out2in_node_fn (vlib_main_t * vm,
87 vlib_node_increment_counter (vm, snat_out2in_node.index,
88 SNAT_OUT2IN_ERROR_OUT2IN_PACKETS,
91 return frame->n_vectors;
94 diff --git a/src/vnet/dhcp/client.c b/src/vnet/dhcp/client.c
95 index 7c3f7f6..41bc2c7 100644
96 --- a/src/vnet/dhcp/client.c
97 +++ b/src/vnet/dhcp/client.c
98 @@ -426,6 +426,16 @@ send_dhcp_pkt (dhcp_client_main_t * dcm, dhcp_client_t * c,
99 clib_memcpy (o->data, c->option_55_data, vec_len(c->option_55_data));
100 o = (dhcp_option_t *) (((uword) o) + (o->length + 2));
103 + u8 sub2_len = vec_len(hw->hw_address);
105 + o->length = sub2_len + 2;
107 + clib_memcpy (o->data, &sub_option, 1);
108 + clib_memcpy (o->data + 1,&sub2_len, 1);
109 + clib_memcpy (o->data + 2, hw->hw_address, vec_len(hw->hw_address));
110 + o = (dhcp_option_t *) (((uword) o) + (o->length +2));