Skip to content

Commit

Permalink
LEN_ORIG removed. It doesn't make sense [may be for now]
Browse files Browse the repository at this point in the history
  • Loading branch information
0xba1a committed Aug 16, 2013
1 parent 55de297 commit 30773a9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 52 deletions.
3 changes: 0 additions & 3 deletions conf
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ NDISC_RA_OPTION_NUM=3
NDISC_RA_OPTION=NDISC_RA_PREFIX_INFO
NDISC_RA_OP_TYPE=3
NDISC_RA_OP_LEN=4
NDISC_RA_OP_LEN_ORIG=4
NDISC_RA_PREFIX_LEN=64
NDISC_RA_L_FLAG=1
NDISC_RA_A_FLAG=1
Expand All @@ -84,12 +83,10 @@ NDISC_RA_PREFIX=2013
NDISC_RA_OPTION=NDISC_RA_SRC_LINK_ADDR
NDISC_RA_OP_TYPE=1
NDISC_RA_OP_LEN=1
NDISC_RA_OP_LEN_ORIG=1
NDISC_RA_OP_SRC_LINK_ADDR=5C:D9:98:C1:8E:FE
NDISC_RA_OPTION=NDISC_RA_MTU
NDISC_RA_TYPE=5
NDISC_RA_LEN=1
NDISC_RA_LEN_ORIG=1
NDISC_RA_MTU=1500

/*
Expand Down
66 changes: 17 additions & 49 deletions icmp6.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ char* pgen_ndisc_ra_writer(FILE *fp, char *cp_cur) {

while (op_num--) {
if (!strcmp(value, "NO_OPTION"))
op_len = 0;
op_len += 0;

/* Source Link Layer address */
else if (!strcmp(value, "NDISC_RA_SRC_LINK_ADDR")) {
Expand All @@ -350,17 +350,9 @@ char* pgen_ndisc_ra_writer(FILE *fp, char *cp_cur) {
if (pgen_store_dec(&tmp, value))
goto err;
*op = (uint8_t)tmp;
op++;
}
else
goto err;

if (pgen_parse_option(fp, option, value))
goto err;
if (!strcmp(option, "NDISC_RA_OP_LEN_ORIG")) {
if (pgen_store_dec(&tmp, value))
goto err;
/* Option length will be 8 octets unit */
op_len += tmp * 8;
op++;
}
else
goto err;
Expand Down Expand Up @@ -395,17 +387,9 @@ char* pgen_ndisc_ra_writer(FILE *fp, char *cp_cur) {
if (pgen_store_dec(&tmp, value))
goto err;
*op = (uint8_t)tmp;
op++;
}
else
goto err;

if (pgen_parse_option(fp, option, value))
goto err;
if (!strcmp(option, "NDISC_RA_OP_LEN_ORIG")) {
if (pgen_store_dec(&tmp, value))
goto err;
/* option length is in 8 octets uint */
op_len += tmp * 8;
op++;
}
else
goto err;
Expand Down Expand Up @@ -502,6 +486,8 @@ char* pgen_ndisc_ra_writer(FILE *fp, char *cp_cur) {
if (pgen_store_dec(&tmp, value))
goto err;
*op = (uint8_t)tmp;
/* Option length will be in 8 octets uint */
op_len += tmp * 8;
op++;
}
else
Expand All @@ -510,16 +496,6 @@ char* pgen_ndisc_ra_writer(FILE *fp, char *cp_cur) {
/* 2-Bytes Reserverd */
op += 2;

if (pgen_parse_option(fp, option, value))
goto err;
if (!strcmp(option, "NDISC_RA_LEN_ORIG")) {
if (pgen_store_dec(&tmp, value))
goto err;
op_len += tmp * 8;
}
else
goto err;

if (pgen_parse_option(fp, option, value))
goto err;
if (!strcmp(option, "NDISC_RA_MTU")) {
Expand Down Expand Up @@ -573,15 +549,15 @@ char* pgen_ndisc_rs_writer(FILE *fp, char *cp_cur) {
* Having 1 item
* 1. Option - variable length
*/
int32_t tmp, op_len;
int32_t tmp, op_len = 0;

if (pgen_parse_option(fp, option, value))
goto err;

/* Program expects the option to be in order */
if (!strcmp(option, "NDISC_RS_OPTION")) {
if (!strcmp(value, "NO_OPTION"))
op_len = 0;
op_len += 0;

/* Source Link Layer address and the only known option */
else if (!strcmp(value, "NDISC_RS_SRC_LINK_ADDR")) {
Expand All @@ -602,21 +578,13 @@ char* pgen_ndisc_rs_writer(FILE *fp, char *cp_cur) {
if (pgen_store_dec(&tmp, value))
goto err;
*op = (uint8_t)tmp;
/* option length will be in 8 octets unit */
op_len += tmp * 8;
op++;
}
else
goto err;

if (pgen_parse_option(fp, option, value))
goto err;
if (!strcmp(option, "NDISC_RS_OP_LEN_ORIG")) {
if (pgen_store_dec(&tmp, value))
goto err;
op_len = tmp * 8;
}
else
goto err;

if (pgen_parse_option(fp, option, value))
goto err;
if (!strcmp(option, "NDISC_RS_OP_SRC_LINK_ADDR")) {
Expand Down Expand Up @@ -661,7 +629,7 @@ char* pgen_ndisc_ns_writer(FILE *fp, char *cp_cur) {
* 1.Target address - 16B
* 2.Option - Variable length
*/
int32_t items = 2, tmp, op_len;
int32_t items = 2, tmp, op_len = 0;

while (items--) {
if (pgen_parse_option(fp, option, value))
Expand All @@ -674,7 +642,7 @@ char* pgen_ndisc_ns_writer(FILE *fp, char *cp_cur) {
else if (!strcmp(option, "NDISC_NS_OPTION")) {
/* Program expects the option to be in order */
if (!strcmp(value, "NO_OPTION"))
op_len = 0;
op_len += 0;

/* This is only known option as of now. [RFC-4861] */
else if (!strcmp(value, "NDISC_NS_SRC_LINK_ADDR")) {
Expand Down Expand Up @@ -712,7 +680,7 @@ char* pgen_ndisc_ns_writer(FILE *fp, char *cp_cur) {
goto err;

/* len is in 8 octets uint */
op_len = tmp * 8;
op_len += tmp * 8;
}
else
goto err;
Expand Down Expand Up @@ -753,7 +721,7 @@ char* pgen_ndisc_na_writer(FILE *fp, char *cp_cur) {
* 4. Target addr
* 5. The option
*/
int32_t items = 5, tmp, op_len;
int32_t items = 5, tmp, op_len = 0;

while (items--) {
if (pgen_parse_option(fp, option, value))
Expand Down Expand Up @@ -784,7 +752,7 @@ char* pgen_ndisc_na_writer(FILE *fp, char *cp_cur) {
else if (!strcmp(option, "NDISC_NA_OPTION")) {
/* Program expects the options to be in order */
if (!strcmp(value, "NO_OPTION"))
op_len = 0;
op_len += 0;

/* This is only known option as of now. [RFC-4861] */
else if (!strcmp(value, "NDISC_NA_SRC_LINK_ADDR")) {
Expand Down Expand Up @@ -821,7 +789,7 @@ char* pgen_ndisc_na_writer(FILE *fp, char *cp_cur) {
goto err;

/* len in 8 octets unit */
op_len = tmp * 8;
op_len += tmp * 8;
}
else
goto err;
Expand Down

0 comments on commit 30773a9

Please sign in to comment.