Top Banner
ACE Address Configuration Executive
32

ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

Dec 30, 2015

Download

Documents

Claude Stafford
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

ACE Address Configuration Executive

Page 2: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

Why ACE?

• ACE provides access to several address resolution protocols under a single API

• ACE is the only API available in Version 6 to obtain an IP address

Page 3: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

What ACE does

• Runs one or more address resolution protocols on a timeline provided by an input table

• Calls BSP-defined callbacks on IP address events

• Stops and restarts protocols as required

Page 4: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

Starting ACE

int aceStart(const char * ifname, const aceProtocolInfo * proto_info, int num_protocols, aceHaveAddrCallback have_addr_fn, aceHaveAddrCallback have_2nd_addr_fn, aceLostAddrCallback lost_address_fn);

Page 5: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

The aceProtocolInfo structuretypedef struct

{

aceProtoStartInfo proto_start_info;

void * proto_specific_info;

size_t proto_specific_info_size;

size_t proto_event_info_size;

aceProtoStartSrvRtn start_protocol_fn;

aceProtoStopSrvRtn stop_protocol_fn;

aceProtoGetAddrSrvRtn get_addr_fn;

aceProtoReleaseAddrSrvRtn release_addr_fn;

} aceProtocolInfo;

Page 6: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

aceProtocolInfo Fields

proto_start_info Generic data used to start the protocol

proto_specific_info Protocol-specific data used to start the protocol.

proto_specific_info_size Size in bytes of the protocol-specific data used to start the protocol

proto_event_info_size Size in bytes of protocol-specific data passed to ACE by the protocol in the aceAddressEvent function.

Page 7: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

aceProtocolInfo Fields (2)

start_protocol_fn Protocol-specific start function

stop_protocol_fn Protocol-specific stop function

get_addr_fn Protocol-specific function to convert IP address information from the protocol specific format to aceAddrInfo type

release_addr_fn Protocol-specific function to release an IP address, might be NULL

Page 8: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

The aceProtoStartInfo Structure

typedef struct

{int protocol; unsigned int priority;time_t delay_before_start;aceProtoShutdownType shutdown_type;

} aceProtoStartInfo;

Page 9: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

Shutdown Types

typedef enum

{ACE_ALWAYS_SHUTDOWN = 0,ACE_CONT_IF_GOT_ADDRESS = 1,ACE_NEVER_SHUTDOWN = 2

} aceProtoShutdownType;

Page 10: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

Example Protocol-Specific Information

typedef struct {

BOOLEAN isConfigValid;

BOOLEAN isEnabled; WORD32 autoip_local_addr;aceProtoStartInfo startInfo;

} configAceAutoipInfo;

Page 11: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

ACE Starts a Protocol…

• After the delay specified in delay_before_start from aceProtoStartInfo

• By calling the start_protocol_fn from aceProtocolInfo

• Passing it proto_specific_info from aceProtocolInfo

Page 12: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

When an Address Event is Detected…

• The protocol calls aceAddressEvent() with protocol-specific event information

• ACE copies the information into an internal table and returns

• The ACE thread resolves redundant address events and invokes the appropriate BSP callback to inform the BSP

Page 13: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

Address Eventstypedef enum

{

ACE_ADDR_NULL = 0,

ACE_ADDR_NEW = 1,

ACE_ADDR_RENEWED = 2,

ACE_ADDR_REBOUND = 3,

ACE_ADDR_LOST = 4

} aceAddrEventType;

Page 14: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

aceAddrInfo Structure

• typedef struct {

• WORD32 ipaddr;

• WORD32 netmask;

• WORD32 servaddr;

• WORD32 def_gateway;

• int mtu;

• WORD32 name_server_address[ACE_MAX_DNS_SERVERS];

• } aceAddrInfo;

Page 15: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

ACE Callbacks

• typedef BOOLEAN (* aceHaveAddrCallback)

( const char * ifname,

int protocol, aceAddrEventTypeaddr_event,

aceAddrInfo * addr_info,

const void * proto_event_info,

size_t proto_event_info_size);

Page 16: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

ACE Callbacks(2)

• aceHaveAddrCallback - IP address has been obtained or renewed

• To use this IP address, the callback must configure the interface’s IP address and return TRUE. ACE will update its IP address information for the interface, and shut down protocols according to their shutdown type.

Page 17: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

ACE Callbacks (3)

• To discard the IP address the callback must return FALSE

• ACE calls have_addr_fn() when the interface that obtained an IP address is not yet configured, or on an ACE_ADDR_RENEWED event

• ACE calls have_2nd_addr_fn() when the interface that obtained an IP address is already configured with the IP address.

Page 18: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

ACE Callbacks (4)

• typedef void (* aceLostAddrCallback)

( const char * ifname,

int protocol,

aceAddrEventType addr_event);

Page 19: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

ACE Callbacks (5)

• aceLostAddrCallback – IP address has been lost.

• This callback must unconfigure an interface that lost the IP address.

• ACE will restart all protocols that need restarting according to their delay before start.

Page 20: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

Adding a Protocol

• Add protocol service routines• Add aceAddressEvents() calls• The protocol should not run on the ACE

thread unless it is trivial.

Page 21: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

Protocol Service Routines• typedef BOOLEAN (* aceProtoStartSrvRtn)

(char * ifname, void * handle,

const void * proto_spec_info,

size_t proto_spec_info_size);

• typedef BOOLEAN (* aceProtoStopSrvRtn)(char * ifname);

• typedef BOOLEAN (* aceProtoGetAddrSrvRtn)

(void * handle, const void * event_info,

size_t event_info_size, aceAddrInfo * addr_info);

• typedef void (* aceProtoReleaseAddrSrvRtn)(char * ifname);

Page 22: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

How does the BSP run ACE?

Page 23: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

Supported Protocols• ACE_PROT_BOOTP

• ACE_PROT_DHCP

• ACE_PROT_AUTOIP

• ACE_PROT_PING_ARP

• ACE_PROT_RARP

• ACE_PROT_STATIC

• Defined in ace_params.h

Page 24: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

Protocol Specific Structures

• configAceDhcpInfo

• configAceBootpInfo

• configAceAutoipInfo

• configAceRarpInfo

• configAcePingArpInfo

• configAceStaticInfo

• In addition to specific data, each has isConfigValid and isEnabled fields, and generic startup data.

Page 25: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

aceConfigInterfaceInfoStructure

• typedef struct { BOOLEAN isConfigValid;

• BOOLEAN isEnabled;

• char ifname[NETOS_MAX_IF_NAMELEN + 1];

• configAceStaticInfo static_config;

• configAceDhcpInfo dhcp_config;

• configAceBootpInfo bootp_config;

• configAceAutoipInfo autoip_config;

• configAceRarpInfo rarp_config;

• configAcePingArpInfo ping_arp_config;

• } aceConfigInterfaceInfo;

Page 26: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

aceConfigInfo Structure

• typedef struct

• {

• int version; aceConfigInterfaceInfo

ace_interface_info[CONFIG_ACE_MAX_INTERFACES];

• } aceConfigInfo;

• Defined in ace_params.h.

• Part of board parameters, stored in NVRAM

Page 27: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

Default ACE Configuration

• aceParams.c has the default ACE configuration.

• To change ACE configuration in NVRAM:

1. Change the default table in aceParams.c

2. Rebuild and reload the application

3. To reset board configuration to default, answer YES to the dialog question:

“Reset configuration to default values?”

Page 28: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

Default ACE Configuration (2)

• APP_USE_STATIC_IP is defined to TRUE,

ACE runs static IP address on eth0

• If APP_USE_STATIC_IP is defined to FALSE,

ACE obtains IP address from the network on eth0

• If APP_ENABLE_AUTO_IP is defined to TRUE, ACE runs Auto IP on eth0:0

Page 29: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

The customizeStartAce function

• Called by netosStartTCP• Performs these steps:

– Reads ACE configuration data from NVRAM.– Calls aceInitialize to initialize data structures inside ACE.– Extracts the protocol-specific information for each interface from

the NVRAM structure.– Calls NAIfconfigBringDeviceUp to start the device for each

enabled interface.– Calls aceStart for each enabled interface to start the process of

getting an IP address.

Page 30: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

The customizeStopAce function

• Call this function to – stop ACE on a specified interface, and– unconfigure the IP address for the interface.

Page 31: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

Default ACE Callbacks

• customizeAceHaveAddress - configures the interface with the IP address by calling customizeAceConfigureInterface and returns TRUE. Makes a query for global IP parameters for DHCP.

• customizeAceHaveAnotherAddress – discards an IP address and returns FALSE.

• customizeAceLostAddress – for Auto IP only, unconfigures interface and continues to run; for other protocols, resets the board.

Page 32: ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.

High Level IP address Configuration API

• customizeAceGetInterfaceAddrInfo – if an address has been configured, returns this address and TRUE; otherwise, returns FALSE.

• customizeAceConfigureInterface – configures an IP address, subnet mask, default gateway (if present), DNS servers (if present), and global IP parameters (if present).

• customizeAceClearInterfaceConfiguration – unconfigures the IP address for the interface.