Tool/software: TI-RTOS
Hello.
I have two ports on my device. For each of them, the address and mask are configured as shown here. Here I set the IP address, mask and gateway for the first Ethernet port. The second port is configured in the same way (only the PHY number changes upon initialization of the IP address and gateway).
/* Get current IP record */
if(CfgGetEntry(0, CFGTAG_IPNET, phy_num_to_ip2, 1, &hCfgIpAddr2)==1)
{
/* Remove it from entries */
CfgRemoveEntry(0, hCfgIpAddr2);
}
/* setup record with required values */
bzero(&NA, sizeof(NA)); /* Clear record */
NA.IPAddr = ip_addr1; /* Set new address */
NA.IPMask = ip_mask1; /* and new mask */
/* Add record in ip entries table */
int ret = CfgAddEntry( 0, CFGTAG_IPNET, phy_num_to_ip2, 0, sizeof(CI_IPNET), (UINT8 *)&NA, 0 );
/* Get current route from table */
if(CfgGetEntry(0, CFGTAG_ROUTE, phy_num_to_ip2, 1, &hCfgRoute2)==1)
{
/* Remove it from entries */
CfgRemoveEntry(0, hCfgRoute2);
}
/* setup record with required values */
bzero(&RT, sizeof(RT));
/* For gateways IP and Mask are always equal 0 */
RT.IPDestAddr = 0;
RT.IPDestMask = 0;
RT.IPGateAddr = ip_rt_addr;
/* Add entry */
ret = CfgAddEntry(0, CFGTAG_ROUTE, 0, 0, sizeof(CI_ROUTE), (UINT8 *)&RT, 0);
How do I need to configure an address table to bind a gateway to a specific port?
Respectfully,
Vitali
