IxTclHAL Commands

arp

arp - configure the ARP parameters on a stream of a port.

SYNOPSIS

arp sub-command options

DESCRIPTION

The arp command is used to configure the ARP parameters on a stream of a port to transmit ARP frames. Any number of varying ARP frames may be generated.

STANDARD OPTIONS
destHardwareAddr

The MAC address of the interface receiving the ARP message. (default = 00 de bb 00 00 01)

destHardware

AddrMode

Indicates how the destHardwareAddr field is to vary between consequtive frames.

Option

Value

Usage

arpIdle

0

(default) no change

arpIncrement

1

increment by 1 for the count in destHardwareAddrRepeatCount.

arpDecrement

2

decrement by 1 for the count in destHardwareAddrRepeatCount.

arpContinuousIncrement

3

increment by 1 continuously.

arpContinuousDecrement

4

decrement by 1 continuously.

destHardwareAddr

RepeatCount

Indicates the repeat count for the destHardwareAddrMode increment and decrement options. (default = 0)

destProtocolAddr

Protocol address of the station that is receiving the ARP message. (default = 127.0.0.1)

destProtocolAddrMode

Indicates how the destProtocolAddr field is to vary between consequtive frames.

Option

Value

Usage

arpIdle

0

(default) no change

arpIncrement

1

increment by 1 for the count in destProtocolAddrRepeatCount.

arpDecrement

2

decrement by 1 for the count in destProtocolAddrRepeatCount.

arpContinuousIncrement

3

increment by 1 continuously.

arpContinuousDecrement

4

decrement by 1 continuously.

destProtocolAddr

RepeatCount

Indicates the repeat count for the destProtocolAddrMode increment and decrement options. (default = 0)

hardwareAddrLength

Read-Only. Number of bytes in the hardware address. (default = 6)

hardwareType

Read-Only. Indicates the hardware type that the physical layer of the network is using. Available option values are mentioned in the following table:

Option

Value

Usage

hwTypeEthernet

1

(default) Ethernet 10 Mb

hwTypeAmateur

3

Amateur radio AX.25

hwTypeProteon

4

Proteon ProNET token ring

hwTypeChaos

5

Chaos

hwTypeIEEE

6

IEEE 802 networks

hwTypeARCNET

7

ARCNET

hwTypeHyperchannel

8

Hyperchannel

hwTypeLocalTalk

11

LocalTalk

operation

The type of operation the ARP process is attempting. Available options are mentioned in the following table:

option

Value

Usage

arpRequest

1

(default) ARP request

arpReply

2

ARP reply or response

rarpRequest

3

RARP request

rarpReply

4

RARP reply or response

protocolAddrLength

Read-Only. Number of bytes that each of the protocol addresses, source and target, contains in the ARP frame. (default = 4)

protocolType

Read-Only. Indicates the type of network protocol address the local network (or subnet) is using. (default = 0x0800)

sourceHardwareAddr

The MAC address of the sending ARP interface. (default = 00 de bb 00 00 00)

sourceHardware

AddrMode

Indicates how the sourceHardwareAddr field is to vary between consecutive frames.

Option

Value

Usage

arpIdle

0

(default) no change

arpIncrement

1

increment by 1 for the count in sourceHardwareAddrRepeatCount.

arpDecrement

2

decrement by 1 for the count in sourceHardwareAddrRepeatCount.

arpContinuousIncrement

3

increment by 1 continuously.

arpContinuousDecrement

3

decrement by 1 continuously.

sourceHardware

AddrRepeatCount

Indicates the repeat count for the sourceHardwareAddrMode increment and decrement options. (default = 0)

sourceProtocolAddr

Protocol address of the station that is sending the ARP message. (default =127.0.0.1)

sourceProtocol

AddrMode

Indicates how the sourceProtocolAddr field is to vary between consequtive frames.

Option

Value

Usage

arpIdle

0

(default) no change

arpIncrement

1

increment by 1 for the count in sourceProtocolAddrRepeatCount.

ArpDecrement

2

decrement by 1 for the count in sourceProtocolAddrRepeatCount.

arpContinuousIncrement

3

increment by 1 continuously.

arpContinuousDecrement

3

decrement by 1 continuously.

sourceProtocolAddr

RepeatCount

Indicates the repeat count for the sourceProtocolAddrMode increment and decrement options. (default = 0)

COMMANDS

The arp command is invoked with the following sub-commands. If no sub-command is specified, returns a list of all sub-commands available.

arp cget option

Returns the current value of the configuration option given by option. Option may have any of the values accepted by the arp command.

arp config option value

Modify the configuration options of the arp. If no option is specified, returns a list describing all of the available options (see STANDARD OPTIONS) for arp.

arp decode capSlice chasID cardID portID

Decodes a captured slice/frame into the arp variables. If not an arp frame, returns TCL_ERROR. May be used to determine if the captured frame is a valid arp frame. Specific errors are as follows:

arp get chasID cardID portID

Gets the current configuration of the arp frame for port with id portID on card cardID, chassis chasID. from its hardware. Call this command before calling arp cget option value to get the value of the configuration option. Specific errors are as follows:

arp set chasID cardID portID

Sets the configuration of the arp in IxHAL for port with id portID on card cardID, chassis chasID by reading the configuration option values set by the arp config option value command. Specific errors are as follows:

arp setDefault

Sets to IxTclHal default values for all configuration options.

EXAMPLES

package require IxTclHal

set host woodstock

set username user

# In this example, ports 1 and 2 of a card are directly connected

# together

# ArpDecrement 2 decrement by 1 for the count in

# sourceProtocolAddrRepeatCount.

# arpContinuousIncrement 3 increment by 1 continuously.

# arpContinuousDecrement 3 decrement by 1 continuously.

# Port 1 transmits an ARP request and looks at the response packet

# Port 2 uses its address table and protocol server to respond to

# the arp

# request

# Check if we're running on UNIX - connect to the TCL Server which

# must be running on the chassis

if [isUNIX] {

if [ixConnectToTclServer $host] {

ixPuts "Could not connect to $host"

return 1

}

}

# Now connect to the chassis

if [ixConnectToChassis $host] {

ixPuts $::ixErrorInfo

return 1

}

set chas [chassis cget -id]

set card 2

set txPort 1

set rxPort 2

# Primary contents for port 2 arp table

set txPortMAC {00 00 00 01 01 01}

set rxPortMAC {00 00 00 01 01 02}

set txIP {192.168.18.1}

set rxIP {192.168.18.2}

# An extra entry for Vlan demonstration

set rxPortMAC2 {00 00 00 01 02 02}

set rxIP2 {192.168.28.2}

set portList [list [list $chas $card $txPort] [list $chas $card $rxPort]]

# Login before taking ownership

if [ixLogin $username] {

ixPuts $::ixErrorInfo

return 1

}

# Take ownership of the ports to use

if [ixTakeOwnership $portList] {

ixPuts $::ixErrorInfo

return 1

}

# Set up Transmit Port

# Nothing special about the port setup

port setFactoryDefaults $chas $card $txPort

protocol setDefault

protocol config -name ipV4

protocol config -appName Arp

protocol config -ethernetType ethernetII

# Stream: 1 packet to broadcast address

stream setDefault

stream config -numFrames 1

# A 1 packet stream can't go at 100%

stream config -percentPacketRate 1

stream config -rateMode usePercentRate

stream config -sa $txPortMAC

# Broadcast arp request

stream config -da {ff ff ff ff ff ff}

stream config -dma stopStream

# Now set up the ARP request packet

arp setDefault

arp config -sourceProtocolAddr $txIP

arp config -destProtocolAddr $rxIP

arp config -operation arpRequest

arp config -sourceHardwareAddr $txPortMAC

arp config -destHardwareAddr {ff ff ff ff ff ff}

if { [arp set $chas $card $txPort] } {

ixPuts "Error setting arp on port $chas $card $txPort"

return 1

}

if { [stream set $chas $card $txPort 1] } {

ixPuts "Error setting stream 1 on port $chas $card $txPort"

return 1

}

# Set up Receive Port for automatic ARP response

# Nothing special about the port setup

port setFactoryDefaults $chas $card $rxPort

protocol setDefault

protocol config -ethernetType ethernetII

# Add an address table item for IP/MAC

ipAddressTable setDefault

ipAddressTableItem setDefault

ipAddressTableItem config -fromIpAddress $rxIP

ipAddressTableItem config -fromMacAddress $rxPortMAC

if {[ipAddressTable addItem] } {

ixPuts "Error ipAddressTable addItem on $chas $card $rxPort"

return 1

}

# Add another with Vlan set

ipAddressTableItem config -fromIpAddress $rxIP2

ipAddressTableItem config -fromMacAddress $rxPortMAC2

ipAddressTableItem config -enableVlan true

ipAddressTableItem config -vlanId 2

if {[ipAddressTable addItem] } {

ixPuts "Error ipAddressTable addItem on $chas $card $rxPort"

return 1

}

if { [ipAddressTable set $chas $card $rxPort] } {

ixPuts "Error setting ipAddressTable on $chas $card $rxPort"

return 1

}

# Let the port respond to arp requests

protocolServer setDefault

protocolServer config -enableArpResponse true

if { [protocolServer set $chas $card $rxPort] } {

ixPuts "Error setting protocolServer on $chas $card $rxPort"

return 1

}

# Commit to hardware

if { [ixWritePortsToHardware portList] } {

ixPuts "Error ixWritePortsToHardware"

return 1

}

# Make sure link is up

after 3000

ixCheckLinkState portList

ixStartPortCapture $chas $card $txPort

ixStartPortTransmit $chas $card $txPort

after 1000

ixCheckPortTransmitDone $chas $card $txPort

ixStopPortCapture $chas $card $txPort

# Get the ARP response from the capture buffer

if { [captureBuffer get $chas $card $txPort] } {

ixPuts "Error getting captureBuffer on $chas $card $txPort"

return 1

}

if {[captureBuffer cget -numFrames] == 0} {

ixPuts "No packets received"

} else {

# and extract just the returned address

if { [captureBuffer getframe 1] } {

ixPuts "Error getframe"

return 1

}

set data [captureBuffer cget -frame]

set data [string range $data 84 94]

ixPuts "ARP response (IP in hex): $data"

}

# Let go of the ports that we reserved

ixClearOwnership $portList

# Disconnect from the chassis we're using

if { [ixDisconnectFromChassis $host] } {

ixPuts $::ixErrorInfo

return 1

}

# If we're running on UNIX, disconnect from the TCL Server

if [isUNIX] {

ixDisconnectTclServer $host

}

SEE ALSO

ip, stream