I am glad to say, I have extracted the MAC address of every switch port from
struct ofp_port.

2011/7/13 hzy <yyjianx...@gmail.com>

> Thank  you for your reply.
> When I change the switch into router, it will have many ports. Can I get
> MAC address of every port ?
>
>   2011/7/13 Junlong <junlong...@gmail.com>
>
>> I think you mean that how to get the MAC address for a port within the
>> switch. According to the Spec_v1.1, it's defined in ofp_port structure which
>> can be  sent to the controller in an OFPT_FEATURES_REPLY message(A.3.1
>> Handshake)
>>
>> /* Switch features. */
>> struct ofp_switch_features {
>> struct ofp_header header;
>> uint64_t datapath_id;
>> /* Datapath unique ID. The lower 48-bits are for
>> a MAC address, while the upper 16-bits are
>> implementer-defined. */
>> uint32_t n_buffers; /* Max packets buffered at once. */
>> uint8_t n_tables; /* Number of tables supported by datapath. */
>> uint8_t pad[3]; /* Align to 64-bits. */
>> /* Features. */ /* Bitmap of support "ofp_capabilities". */
>> uint32_t capabilities;
>> uint32_t reserved;
>> /* Port info.*/
>> struct ofp_port ports[0];
>> /* Port definitions. The number of ports
>> is inferred from the length field in
>> the header. */
>> };
>> OFP_ASSERT(sizeof(struct ofp_switch_features) == 32);
>>
>>
>> BTW,  in the following paragraph, it says:
>> The datapath_id field uniquely identifies a datapath. The lower 48 bits
>> are intended for the switch MAC
>> address, while the top 16 bits are up to the implementer.
>>
>> So it can also help you to "get the MAC address of switch"
>>
>>
>>   On Mon, Jul 11, 2011 at 9:19 PM, hzy <yyjianx...@gmail.com> wrote:
>>
>>>   I am doing excercise “Create Router” on web
>>> http://www.openflow.org/wk/index.php/OpenFlow_Tutorial#Create_Router
>>> I am running into trouble, when I am dealing with ARP.
>>> When the controller receives a arp request, it first check the arp table
>>> to get destinate MAC address. If the check is succeed, the controller
>>> contructs a arp reply back to the host sending the arp request. If not, the
>>>  controller should flood the arp request.(If this process is not correct,
>>> please tell me.)
>>>
>>> My question is that, when I flood the arp request, I need to change the
>>> source MAC address to the switch's(the switch receiving the arp request).
>>> How can I get the MAC address of switch?
>>> (is there a parameter? something like "dpid" mark the switch id.)
>>>
>>> Thanks
>>> -hzy
>>>
>>> _______________________________________________
>>> openflow-discuss mailing list
>>> openflow-discuss@lists.stanford.edu
>>> https://mailman.stanford.edu/mailman/listinfo/openflow-discuss
>>>
>>>
>>
>>
>> --
>>
>> ***Best regards,   :-)
>>
>>
>>                **
>>                             Junlong Peng*
>>
>>
>>
>
_______________________________________________
openflow-discuss mailing list
openflow-discuss@lists.stanford.edu
https://mailman.stanford.edu/mailman/listinfo/openflow-discuss

Reply via email to