Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions include/l2.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
BYTE destination_address_DSAP;
BYTE source_address_SSAP;
BYTE llc_frame_type;
} __attribute__((aligned(1))) LLC_HEADER;
} __attribute__((__packed__)) LLC_HEADER;

typedef struct SNAP_HEADER
{
Expand All @@ -85,13 +85,13 @@

BYTE protocol_id_filler[3];
UINT16 protocol_id;
} __attribute__((aligned(2))) SNAP_HEADER;
} __attribute__((__packed__)) SNAP_HEADER;

typedef struct MAC_ADDRESS
{
UINT32 _ulong;
UINT16 _ushort;
} __attribute__((aligned(4))) MAC_ADDRESS;
} __attribute__((__packed__)) MAC_ADDRESS;

#define COPY_MAC(sptr_mac2, sptr_mac1) \
(memcpy(sptr_mac2, sptr_mac1, sizeof(MAC_ADDRESS)))
Expand All @@ -111,7 +111,7 @@
MAC_ADDRESS source_address;

USHORT length;
} __attribute__((aligned(4))) MAC_HEADER;
} __attribute__((__packed__)) MAC_HEADER;

#define STP_BPDU_OFFSET (sizeof(MAC_HEADER) + sizeof(LLC_HEADER))
#define PVST_BPDU_OFFSET (sizeof(MAC_HEADER) + sizeof(SNAP_HEADER))
Expand Down Expand Up @@ -186,4 +186,4 @@
memset(_instance_mask_ptr_, 0, sizeof(L2_PROTO_INSTANCE_MASK))

#endif //__L2_H__


16 changes: 8 additions & 8 deletions include/mstp_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ typedef struct
// mac-address for the bridge
MAC_ADDRESS address;

}__attribute__((aligned(4))) MSTP_BRIDGE_IDENTIFIER;
}__attribute__((__packed__)) MSTP_BRIDGE_IDENTIFIER;

/*****************************************************************************/
/* msti configuration message structure */
Expand All @@ -69,7 +69,7 @@ typedef struct
UINT8 agreement:1;
UINT8 master:1;
#endif
} __attribute__((aligned(4)))MSTI_FLAGS;
} __attribute__((__packed__))MSTI_FLAGS;

/*****************************************************************************/
/* msti configuration message structure */
Expand Down Expand Up @@ -106,7 +106,7 @@ typedef struct
// mst instance remaining hops
UINT8 msti_remaining_hops;

} __attribute__((aligned(4))) MSTI_CONFIG_MESSAGE;
} __attribute__((__packed__)) MSTI_CONFIG_MESSAGE;

/*****************************************************************************/
/* mst configuration identification */
Expand All @@ -131,7 +131,7 @@ typedef struct
// the mst configuration table.
UINT8 config_digest[16];

} __attribute__((aligned(4))) MSTP_CONFIG_IDENTIFIER;
} __attribute__((__packed__)) MSTP_CONFIG_IDENTIFIER;

typedef struct RSTP_BPDU_FLAGS
{
Expand All @@ -152,7 +152,7 @@ typedef struct RSTP_BPDU_FLAGS
UINT8 agreement:1;
UINT8 topology_change_acknowledgement:1;
#endif
} __attribute__((aligned(4))) RSTP_BPDU_FLAGS;
} __attribute__((__packed__)) RSTP_BPDU_FLAGS;


/*****************************************************************************/
Expand Down Expand Up @@ -223,7 +223,7 @@ typedef struct
// a sequence of zero or more msti configuration messages
MSTI_CONFIG_MESSAGE msti_msgs[MSTP_MAX_INSTANCES_PER_REGION];

} __attribute__((aligned(4))) MSTP_BPDU;
} __attribute__((__packed__)) MSTP_BPDU;

// rstp bpdu
typedef struct RSTP_BPDU
Expand All @@ -243,6 +243,6 @@ typedef struct RSTP_BPDU
UINT16 hello_time;
UINT16 forward_delay;
UINT8 version1_length;
} __attribute__((aligned(4))) RSTP_BPDU;
} __attribute__((__packed__)) RSTP_BPDU;

#endif // //__MSTP_COMMON_H__
#endif // //__MSTP_COMMON_H__
14 changes: 7 additions & 7 deletions include/stp_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ typedef struct BRIDGE_BPDU_FLAGS
UINT8 blank : 6;
UINT8 topology_change_acknowledgement : 1;
#endif
} __attribute__((aligned(1))) BRIDGE_BPDU_FLAGS;
} __attribute__((__packed__)) BRIDGE_BPDU_FLAGS;

typedef struct BRIDGE_IDENTIFIER
{
Expand All @@ -82,7 +82,7 @@ typedef struct BRIDGE_IDENTIFIER

MAC_ADDRESS address;

} __attribute__((aligned(4))) BRIDGE_IDENTIFIER;
} __attribute__((__packed__)) BRIDGE_IDENTIFIER;

typedef struct PORT_IDENTIFIER
{
Expand All @@ -93,7 +93,7 @@ typedef struct PORT_IDENTIFIER
UINT16 number : 12;
UINT16 priority : 4;
#endif // BIG_ENDIAN
} __attribute__((aligned(2))) PORT_IDENTIFIER;
} __attribute__((__packed__)) PORT_IDENTIFIER;

// spanning-tree configuration bpdu
typedef struct STP_CONFIG_BPDU
Expand All @@ -112,7 +112,7 @@ typedef struct STP_CONFIG_BPDU
UINT16 max_age;
UINT16 hello_time;
UINT16 forward_delay;
} __attribute__((aligned(4))) STP_CONFIG_BPDU;
} __attribute__((__packed__)) STP_CONFIG_BPDU;

// spanning-tree topology change notification bpdu
typedef struct STP_TCN_BPDU
Expand All @@ -123,7 +123,7 @@ typedef struct STP_TCN_BPDU
UINT8 protocol_version_id;
UINT8 type;
UINT8 padding[3];
} __attribute__((aligned(4))) STP_TCN_BPDU;
} __attribute__((__packed__)) STP_TCN_BPDU;

// pvst configuration bpdu
typedef struct PVST_CONFIG_BPDU
Expand All @@ -145,7 +145,7 @@ typedef struct PVST_CONFIG_BPDU
UINT8 padding[3];
UINT16 tag_length;
UINT16 vlan_id;
} __attribute__((aligned(4))) PVST_CONFIG_BPDU;
} __attribute__((__packed__)) PVST_CONFIG_BPDU;

// pvst topology change notification bpdu
typedef struct PVST_TCN_BPDU
Expand All @@ -156,6 +156,6 @@ typedef struct PVST_TCN_BPDU
UINT8 protocol_version_id;
UINT8 type;
UINT8 padding[38];
} __attribute__((aligned(4))) PVST_TCN_BPDU;
} __attribute__((__packed__)) PVST_TCN_BPDU;

#endif //__STP_COMMON_H__
10 changes: 8 additions & 2 deletions include/stp_ipc.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ typedef enum STP_CTL_TYPE
STP_CTL_MAX
} STP_CTL_TYPE;

typedef enum LinkType {
AUTO = 0, // Auto
POINT_TO_POINT = 1, // Point-to-point
SHARED = 2 // Shared
} LinkType;

typedef struct STP_IPC_MSG
{
int msg_type;
Expand Down Expand Up @@ -137,8 +143,8 @@ typedef struct STP_PORT_CONFIG_MSG
uint8_t bpdu_guard_do_disable;
uint8_t portfast;
uint8_t uplink_fast;
int edge;
uint16_t padding;
uint8_t edge;
LinkType link_type; // MSTP only
int path_cost;
int priority;
int count;
Expand Down
10 changes: 6 additions & 4 deletions stp/stp_mgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1899,14 +1899,15 @@ static void stpmgr_process_ipc_msg(STP_IPC_MSG *msg, int len, struct sockaddr_un
}
case STP_BRIDGE_CONFIG:
{
if(msg->proto_mode == L2_PVSTP)
stpmgr_process_bridge_config_msg(msg->data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert the changes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@divyachandralekha, right now both PVST and MSTP are not working due to incorrect changes in stpmgrd. For now atleast this change will allow us to get PVST working with minimal changes. As part of MSTP we have to address the issue on stpmgrd where we pass the correct msg->proto_mode.

/*if(msg->proto_mode == L2_PVSTP)
{
stpmgr_process_bridge_config_msg(msg->data);
}
else if(msg->proto_mode == L2_MSTP)
{
mstpmgr_process_bridge_config_msg(msg->data);
}
}*/
break;
}
case STP_VLAN_CONFIG:
Expand All @@ -1921,14 +1922,15 @@ static void stpmgr_process_ipc_msg(STP_IPC_MSG *msg, int len, struct sockaddr_un
}
case STP_PORT_CONFIG:
{
if(msg->proto_mode == L2_PVSTP)
stpmgr_process_intf_config_msg(msg->data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert the changes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@divyachandralekha, right now both PVST and MSTP are not working due to incorrect changes in stpmgrd. For now atleast this change will allow us to get PVST working with minimal changes. As part of MSTP we have to address the issue on stpmgrd where we pass the correct msg->proto_mode.

/*if(msg->proto_mode == L2_PVSTP)
{
stpmgr_process_intf_config_msg(msg->data);
}
else if(msg->proto_mode == L2_MSTP)
{
mstpmgr_process_intf_config_msg(msg->data);
}
}*/
break;
}
case STP_VLAN_MEM_CONFIG:
Expand Down