How Can I Change the VLAN Id and IP Address at Run Time?

Question:
How can I change the VLAN ID and IP address at run time?
Answer:

The VLAN Id and IP Address might be adapted before an Ethernet frame is sent if all possible VLAN Ids have been previously configured in the IP Stack like for instance:


 

In this case it is possible at run time to add for each of the configured VLAN an additional IP Address using the CAPL function IpAddAdapterAddress but it is not possible with CAPL to set or change the VLAN ID or priority.

To identify the ifIndex corresponding to the each VLAN out of the CANoe Configuration, use the IpGetAdapterDescription CAPL function that will deliver for each adapter a description containing the VLAN ID:

For exact syntax description of CAPL function, please consult CANoe Online Help (Key”F1")


 

Note for Video Streaming:
  • If you use the AVB_IL for AVTP, the Talker/Listener connection directly takes place on the MAC layer and not on the IP layer. Therefore the following CAPL function shall be used to adapt the VLAN ID of each concerned Talker/Listener:

    AvbSetProperty(talkerOrListenerHandle, „VlanId“, Integer)
    Example: AvbSetProperty(talkerOrListenerHandle, „VlanId“, 3)
     
  • If no VlanId setting is done in the CAPL code of your Talker, then the VLAN ID 2 is used (default value).
  • With RTP the VLAN ID might be from CANoe 10.0 on changed like indicated above.


Article ID: 927
Last updated: 2018-06-27
Revision: 17
CANalyzer/CANoe -> Options -> Ethernet (IP) -> How Can I Change the VLAN Id and IP Address at Run Time?
https://kb.vector.com/entry/927/