Skip to content

Commit

Permalink
conf.help done. Sample conf files added in sample_confs directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
0xba1a committed Aug 17, 2013
1 parent 28bd029 commit a07e0e1
Show file tree
Hide file tree
Showing 8 changed files with 233 additions and 33 deletions.
1 change: 1 addition & 0 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
* Have one more look at IPv6 extension headers
* Add support for type-1, type-2 routing headers
* Add support for short form of IPv6 prefix in RA prefix option
* MAC validation is yet to be added
35 changes: 6 additions & 29 deletions conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,12 @@ IPV6_DST_ADDR=E23::9AD
IPV6_EXT_HDRS=0

ICMP6
ICMP6_TYPE=134
ICMP6_TYPE=128
ICMP6_CODE=0
ICMP6_CHECKSUM=-1

NDISC_RA
NDISC_RA_CUR_HOP_LIMIT=124
NDISC_RA_M_FLAG=1
NDISC_RA_O_FLAG=1
NDISC_RA_ROUTER_LIFETIME=1223
NDISC_RA_REACHABLE_TIME=2342
NDISC_RA_RETRANS_TIMER=45543
NDISC_RA_OPTION_NUM=3

NDISC_RA_OPTION=NDISC_RA_PREFIX_INFO
NDISC_RA_OP_TYPE=3
NDISC_RA_OP_LEN=4
NDISC_RA_PREFIX_LEN=64
NDISC_RA_L_FLAG=1
NDISC_RA_A_FLAG=0
NDISC_RA_PREFIX_VALID_LIFETIME=12345
NDISC_RA_PREFIX_PREFERRED_LIFETIME=54321
NDISC_RA_PREFIX=2001:23

NDISC_RA_OPTION=NDISC_RA_SRC_LINK_ADDR
NDISC_RA_OP_TYPE=1
NDISC_RA_OP_LEN=1
NDISC_RA_OP_SRC_LINK_ADDR=00:01:02:03:04:05

NDISC_RA_OPTION=NDISC_RA_MTU
NDISC_RA_OP_TYPE=5
NDISC_RA_OP_LEN=1
NDISC_RA_MTU=245
ECHO6
ECHO6_IDENTIFIER=1234
ECHO6_SEQ=3
#ECHO6_DATA=NO_DATA
ECHO6_DATA=0xff00ff
95 changes: 94 additions & 1 deletion conf.help
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
This is help file for the pgen configuration file. It gives a minimal
information about all possible options. pgen expects the user to give options
in the same order that appears in a packet. Also some sample conf files have
been given in sample_confs directory.

***** Common *****
1. BUFF_SIZE
Size of the packet buffer. Any decimal number in the range of an 32-bit
Expand Down Expand Up @@ -283,6 +288,7 @@ are,
Type of RA option. pgen supports following types,
NDISC_RA_PREFIX_INFO 3
NDISC_RA_SRC_LINK_ADDR 1
NDISC_RA_TAR_LINK_ADDR 1
NDISC_RA_MTU 5

11. NDISC_RA_OP_LEN
Expand Down Expand Up @@ -311,9 +317,96 @@ user has to give full prefix value.
--- For Source Link Layer Address option ---
18. NDISC_RA_OP_SRC_LINK_ADDR
The Source Link Layer Address. As of now the MAC address of the underlying
hardware.
hardware. For Target Link Layer Address option, use NDISC_RA_TYPE value 2.

--- For MTU option ---
19. NDISC_RA_MTU
The MTU value.
-------------------------------------------------------------------------------

Router Solicitation------------------------------------------------------------
1. NDISC_RS
Starting of Router Solicitation message

2. NDISC_RS_OPTION
The Router Solicitaion option. pgen supports followint RS options
NDISC_RS_SRC_LINK_ADDR

3. NDISC_RS_OP_TYPE
Option type for the RS option. For Target Source Link Layer address option
use NDISC_RS_OP_TYPE as 2

4. NDISC_RS_OP_LEN
Option length in 8-bit octet unit.

5. NDISC_RS_SRC_LINK_ADDR
The Link Layer Address. As of now the Hardware mac address Source/Target
-------------------------------------------------------------------------------

Neighbor Advertisement---------------------------------------------------------
1. NDISC_NA
NA data starts here

2. NDISC_NA_R
NA R flag. 1 for set and 0 for reset

3. NDISC_NA_S
NA S flag. 1 for set and 0 for reset

4. NDISC_NA_O
NA O flag. 1 for set and 0 for reset

5. NDISC_NA_TARGET_ADDR
The target address from which this advertisement is being sent

6. NDISC_NA_OPTION
The NA option. pgen supports
NDISC_NA_SRC_LINK_ADDR

7. NDISC_NA_OP_TYPE
Type of NA option. For Target Link Layer Address, type will be 2

8. NDISC_NA_OP_LEN
Length of NA option in 8-octets unit

9. NDISC_NA_OP_TAR_LINK_ADDR
The Target Link Layer Address. The Hardware MAC address.
-------------------------------------------------------------------------------

Neighbor Solicitation----------------------------------------------------------
1. NDISC_NS
Neighbor Solicitaion starts here

2. NDISC_NS_TARGET_ADDR
Target Address of NS

3. NDISC_NS_OPTION
Neighbor Soliciation option. The only supported option is
NDISC_NS_SRC_LINK_ADDR

3. NDISC_NS_OP_TYPE
Type of NS option. 1 for Source Link Layer Address option and 2 for Target
Link Layer Address option.

4. NDISC_NS_OP_LEN
Length of NS option in 8-octets unit

5. NDISC_NS_OP_SRC_LINK_ADDR
Source Link Layer Address. The hardware MAC address of the sender.
-------------------------------------------------------------------------------

ICMPv6 Echo--------------------------------------------------------------------
1. ECHO6
The ICMPv6 Echo packet starts here

2. ECHO6_IDENTIFIER
Identifier of the Echo6 packet

3. ECHO6_SEQ
Sequence of Echo6 packet

4. ECHO6_DATA
Data for Echo6 packet.
NO_DATA For no data
Or the user has to give the data he wants in hex.
-------------------------------------------------------------------------------
6 changes: 3 additions & 3 deletions icmp6.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,7 @@ char* pgen_ndisc_rs_writer(FILE *fp, char *cp_cur) {

/* Source Link Layer address and the only known option */
else if (!strcmp(value, "NDISC_RS_SRC_LINK_ADDR")) {
op = (char *)&(pkt->option);
if (pgen_parse_option(fp, option, value))
goto err;
if (!strcmp(option, "NDISC_RS_OP_TYPE")) {
Expand Down Expand Up @@ -757,6 +758,7 @@ char* pgen_ndisc_na_writer(FILE *fp, char *cp_cur) {

/* This is only known option as of now. [RFC-4861] */
else if (!strcmp(value, "NDISC_NA_SRC_LINK_ADDR")) {
op_ptr = (char *)&(pkt->option);

if (pgen_parse_option(fp, option, value))
goto err;
Expand Down Expand Up @@ -866,9 +868,7 @@ char* pgen_icmp6_writer(FILE *fp, char *cp_cur) {

if (!strcmp(option, "NO_ICMP6_BODY"));
/* we are fine here. Do nothing */
else if (!strcmp(option, "ECHO_REQ"))
cp_cur = pgen_echo6_writer(fp, cp_cur);
else if (!strcmp(option, "ECHO_REP"))
else if (!strcmp(option, "ECHO6"))
cp_cur = pgen_echo6_writer(fp, cp_cur);
else if (!strcmp(option, "NDISC_NS"))
cp_cur = pgen_ndisc_ns_writer(fp, cp_cur);
Expand Down
35 changes: 35 additions & 0 deletions sample_confs/conf_icmp6_NA.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
BUFF_SIZE=1024

IF_NAME=lo
PK_DST_MAC=00:01:9B:04:03:3C

ETHER_HEADER
DST_MAC=ff:ff:ff:ff:ff:ff
SRC_MAC=5C:D9:98:C1:8E:FE
ETHR_TYPE=34525

IPV6
IPV6_VERSION=6
IPV6_TRAFFIC_CLASS=255
IPV6_FLOW_LABEL=1234
IPV6_PAYLOAD_LENGTH=64
IPV6_NEXT_HEADER=58
IPV6_HOP_LIMIT=128
IPV6_SRC_ADDR=fe80::213
IPV6_DST_ADDR=E23::9AD
IPV6_EXT_HDRS=0

ICMP6
ICMP6_TYPE=136
ICMP6_CODE=0
ICMP6_CHECKSUM=-1

NDISC_NA
NDISC_NA_R=1
NDISC_NA_S=0
NDISC_NA_O=1
NDISC_NA_TARGET_ADDR=fe89::34
NDISC_NA_OPTION=NDISC_NA_SRC_LINK_ADDR
NDISC_NA_OP_TYPE=2
NDISC_NA_OP_LEN=1
NDISC_NA_OP_TAR_LINK_ADDR=12:AB:34:CD:56:EF
32 changes: 32 additions & 0 deletions sample_confs/conf_icmp6_NS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
BUFF_SIZE=1024

IF_NAME=lo
PK_DST_MAC=00:01:9B:04:03:3C

ETHER_HEADER
DST_MAC=ff:ff:ff:ff:ff:ff
SRC_MAC=5C:D9:98:C1:8E:FE
ETHR_TYPE=34525

IPV6
IPV6_VERSION=6
IPV6_TRAFFIC_CLASS=255
IPV6_FLOW_LABEL=1234
IPV6_PAYLOAD_LENGTH=64
IPV6_NEXT_HEADER=58
IPV6_HOP_LIMIT=128
IPV6_SRC_ADDR=fe80::213
IPV6_DST_ADDR=E23::9AD
IPV6_EXT_HDRS=0

ICMP6
ICMP6_TYPE=135
ICMP6_CODE=0
ICMP6_CHECKSUM=-1

NDISC_NS
NDISC_NS_TARGET_ADDR=2001::24
NDISC_NS_OPTION=NDISC_NS_SRC_LINK_ADDR
NDISC_NS_OP_TYPE=2
NDISC_NS_OP_LEN=1
NDISC_NS_OP_SRC_LINK_ADDR=90:87:87:12:34:44
31 changes: 31 additions & 0 deletions sample_confs/conf_icmp6_RS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
BUFF_SIZE=1024

IF_NAME=lo
PK_DST_MAC=00:01:9B:04:03:3C

ETHER_HEADER
DST_MAC=ff:ff:ff:ff:ff:ff
SRC_MAC=5C:D9:98:C1:8E:FE
ETHR_TYPE=34525

IPV6
IPV6_VERSION=6
IPV6_TRAFFIC_CLASS=255
IPV6_FLOW_LABEL=1234
IPV6_PAYLOAD_LENGTH=64
IPV6_NEXT_HEADER=58
IPV6_HOP_LIMIT=128
IPV6_SRC_ADDR=fe80::213
IPV6_DST_ADDR=E23::9AD
IPV6_EXT_HDRS=0

ICMP6
ICMP6_TYPE=133
ICMP6_CODE=0
ICMP6_CHECKSUM=-1

NDISC_RS
NDISC_RS_OPTION=NDISC_RS_SRC_LINK_ADDR
NDISC_RS_OP_TYPE=2
NDISC_RS_OP_LEN=1
NDISC_RS_OP_SRC_LINK_ADDR=12:23:34:45:56:ab
31 changes: 31 additions & 0 deletions sample_confs/conf_icmp6_echo6.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
BUFF_SIZE=1024

IF_NAME=lo
PK_DST_MAC=00:01:9B:04:03:3C

ETHER_HEADER
DST_MAC=ff:ff:ff:ff:ff:ff
SRC_MAC=5C:D9:98:C1:8E:FE
ETHR_TYPE=34525

IPV6
IPV6_VERSION=6
IPV6_TRAFFIC_CLASS=255
IPV6_FLOW_LABEL=1234
IPV6_PAYLOAD_LENGTH=64
IPV6_NEXT_HEADER=58
IPV6_HOP_LIMIT=128
IPV6_SRC_ADDR=fe80::213
IPV6_DST_ADDR=E23::9AD
IPV6_EXT_HDRS=0

ICMP6
ICMP6_TYPE=128
ICMP6_CODE=0
ICMP6_CHECKSUM=-1

ECHO6
ECHO6_IDENTIFIER=1234
ECHO6_SEQ=3
#ECHO6_DATA=NO_DATA
ECHO6_DATA=0xff00ff

0 comments on commit a07e0e1

Please sign in to comment.