summaryrefslogtreecommitdiff
path: root/epan
diff options
context:
space:
mode:
authorJoerg Mayer <jmayer@loplof.de>2016-05-03 10:50:38 +0200
committerJörg Mayer <jmayer@loplof.de>2016-05-03 08:57:49 +0000
commitfe5725380755a13c0b7daf4c79171c384c35ccd1 (patch)
tree65492dbc97319c3b376c401d1b5a9da156ca3589 /epan
parent13e302f33d707acc64b9380c27dedf6e56a055be (diff)
downloadwireshark-fe5725380755a13c0b7daf4c79171c384c35ccd1.tar.gz
Move common code outside switch statement.
Change-Id: Id94a686c0cffd47e4d51f14e620c59fd153b3d69 Reviewed-on: https://code.wireshark.org/review/15251 Reviewed-by: Jörg Mayer <jmayer@loplof.de>
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-bootp.c58
1 files changed, 18 insertions, 40 deletions
diff --git a/epan/dissectors/packet-bootp.c b/epan/dissectors/packet-bootp.c
index a5d7f50505..3ac40fc68c 100644
--- a/epan/dissectors/packet-bootp.c
+++ b/epan/dissectors/packet-bootp.c
@@ -2735,7 +2735,7 @@ bootp_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree, proto_item
}
break;
- case 124: { /* V-I Vendor Class */
+ case 124: { /* V-I Vendor Class (RFC 3925) */
int data_len;
if (optlen == 1) {
@@ -2769,7 +2769,7 @@ bootp_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree, proto_item
break;
}
- case 125: { /* V-I Vendor-specific Information */
+ case 125: { /* V-I Vendor-specific Information (RFC 3925) */
int enterprise = 0;
int s_end = 0;
int s_option_len = 0;
@@ -2793,51 +2793,29 @@ bootp_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree, proto_item
optoff += 5;
optleft -= 5;
- /* Handle DSL Forum TR-111 Option 125 */
- switch (enterprise) {
-
- case 3561: /* ADSL Forum */
- s_end = optoff + s_option_len;
- if ( s_end > optend ) {
- expert_add_info_format(pinfo, vti, &ei_bootp_option125_enterprise_malformed, "no room left in option for enterprise %u data", enterprise);
- break;
- }
-
- e_tree = proto_item_add_subtree(vti, ett_bootp_option);
- while (optoff < s_end) {
-
- optoff = dissect_vendor_tr111_suboption(pinfo, vti, e_tree, tvb, optoff, s_end);
+ s_end = optoff + s_option_len;
+ if ( s_end > optend ) {
+ expert_add_info_format(pinfo, vti, &ei_bootp_option125_enterprise_malformed, "no room left in option for enterprise %u data", enterprise);
+ break;
}
- break;
- case 4491: /* CableLab */
- s_end = optoff + s_option_len;
- if ( s_end > optend ) {
- expert_add_info_format(pinfo, vti, &ei_bootp_option125_enterprise_malformed, "no room left in option for enterprise %u data", enterprise);
- break;
- }
+ e_tree = proto_item_add_subtree(vti, ett_bootp_option);
+ while (optoff < s_end) {
+ switch (enterprise) {
- e_tree = proto_item_add_subtree(vti, ett_bootp_option);
- while (optoff < s_end) {
+ case 3561: /* ADSL Forum */
+ optoff = dissect_vendor_tr111_suboption(pinfo, vti, e_tree, tvb, optoff, s_end);
+ break;
+
+ case 4491: /* CableLab */
optoff = dissect_vendor_cl_suboption(pinfo, vti, e_tree, tvb, optoff, s_end);
- }
- break;
+ break;
- default:
- s_end = optoff + s_option_len;
- if ( s_end > optend ) {
- expert_add_info_format(pinfo, vti, &ei_bootp_option125_enterprise_malformed, "no room left in option for enterprise %u data", enterprise);
- break;
+ default:
+ optoff = dissect_vendor_generic_suboption(pinfo, vti, e_tree, tvb, optoff, s_end);
+ break;
}
-
- e_tree = proto_item_add_subtree(vti, ett_bootp_option);
- while (optoff < s_end) {
-
- optoff = dissect_vendor_generic_suboption(pinfo, vti, e_tree, tvb, optoff, s_end);
}
- break;
- }
-
optleft -= s_option_len;
}
break;