diff options
| author | songyanchao <[email protected]> | 2024-01-09 02:53:49 +0000 |
|---|---|---|
| committer | songyanchao <[email protected]> | 2024-01-09 02:53:49 +0000 |
| commit | 1e6ebaefdb3c874b2ac35ad97c795688a366ecc2 (patch) | |
| tree | 0ccc3f5941a8819e3d8ed1c3bd5dd9e0945f62d3 /service/include | |
| parent | 5e99a82cecb2f1f370c797aa2c391eb7c8a3cfb4 (diff) | |
✨ feat(TSG-18251): Enable Dual-Stack Support for Dev Trunk Mode.
Enable Dual-Stack Support for Dev Trunk Mode.
Diffstat (limited to 'service/include')
| -rw-r--r-- | service/include/sc_devmgr.h | 26 | ||||
| -rw-r--r-- | service/include/sc_node_common.h | 9 |
2 files changed, 13 insertions, 22 deletions
diff --git a/service/include/sc_devmgr.h b/service/include/sc_devmgr.h index bbb0b5c..5ba205b 100644 --- a/service/include/sc_devmgr.h +++ b/service/include/sc_devmgr.h @@ -71,23 +71,19 @@ enum mr_dev_mode struct vlan_member { - int sa_family; uint16_t vlan_id; - union { - struct in_addr in_addr; - struct in6_addr in6_addr; - }; - - union { - struct in_addr in_mask; - struct in6_addr in6_mask; - }; - - union { - struct in_addr in_gateway; - struct in6_addr in6_gateway; - }; + /* AF_INET */ + int sa_family_v4; + struct in_addr in_addr; + struct in_addr in_mask; + struct in_addr in_gateway; + + /* AF_INET6 */ + int sa_family_v6; + struct in6_addr in6_addr; + struct in6_addr in6_mask; + struct in6_addr in6_gateway; }; struct representor_config diff --git a/service/include/sc_node_common.h b/service/include/sc_node_common.h index c494110..5014cb0 100644 --- a/service/include/sc_node_common.h +++ b/service/include/sc_node_common.h @@ -100,24 +100,19 @@ static inline int mr_is_local_addr_for_trunk(struct mr_dev_desc * dev_desc, uint for (int i = 0; i < dev_desc->nr_vlan_members; i++) { struct vlan_member * vlan_member = &dev_desc->vlan_members[i]; - if (vlan_member->sa_family != ip_hdr->sa_family) - { - continue; - } - if (vlan_member->vlan_id != vlan_id) { continue; } - if (ip_hdr->sa_family == AF_INET) + if (ip_hdr->sa_family == vlan_member->sa_family_v4) { if (vlan_member->in_addr.s_addr == ip_hdr->ipv4_hdr->dst_addr) { return RT_SUCCESS; } } - else if (ip_hdr->sa_family == AF_INET6) + else if (ip_hdr->sa_family == vlan_member->sa_family_v6) { if (memcmp(&vlan_member->in6_addr, &ip_hdr->ipv6_hdr->dst_addr, sizeof(struct in6_addr)) == 0) { |
