mirror of
https://github.com/openvswitch/ovs
synced 2025-09-04 00:05:15 +00:00
dpif-netdev: Fix a zero-rate bug for meter
Open vSwitch daemon crashes (by receiving signal SIGFPE, Arithmetic exception) when a controller tries to send a meter-mod message with zero rate. Signed-off-by: Ali Volkan ATLI <volkan.atli@argela.com.tr> Signed-off-by: Andy Zhou <azhou@ovn.org>
This commit is contained in:
committed by
Andy Zhou
parent
1193857813
commit
2029ce9ac3
@@ -4276,10 +4276,19 @@ dpif_netdev_meter_set(struct dpif *dpif, ofproto_meter_id *meter_id,
|
|||||||
!(config->flags & (OFPMF13_KBPS | OFPMF13_PKTPS))) {
|
!(config->flags & (OFPMF13_KBPS | OFPMF13_PKTPS))) {
|
||||||
return EBADF; /* Unsupported flags set */
|
return EBADF; /* Unsupported flags set */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Validate bands */
|
/* Validate bands */
|
||||||
if (config->n_bands == 0 || config->n_bands > MAX_BANDS) {
|
if (config->n_bands == 0 || config->n_bands > MAX_BANDS) {
|
||||||
return EINVAL; /* Too many bands */
|
return EINVAL; /* Too many bands */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Validate rates */
|
||||||
|
for (i = 0; i < config->n_bands; i++) {
|
||||||
|
if (config->bands[i].rate == 0) {
|
||||||
|
return EBADRQC; /* rate must be non-zero */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < config->n_bands; ++i) {
|
for (i = 0; i < config->n_bands; ++i) {
|
||||||
switch (config->bands[i].type) {
|
switch (config->bands[i].type) {
|
||||||
case OFPMBT13_DROP:
|
case OFPMBT13_DROP:
|
||||||
|
@@ -5695,6 +5695,8 @@ meter_set(struct ofproto *ofproto_, ofproto_meter_id *meter_id,
|
|||||||
return OFPERR_OFPMMFC_OUT_OF_BANDS;
|
return OFPERR_OFPMMFC_OUT_OF_BANDS;
|
||||||
case ENODEV: /* Unsupported band type */
|
case ENODEV: /* Unsupported band type */
|
||||||
return OFPERR_OFPMMFC_BAD_BAND;
|
return OFPERR_OFPMMFC_BAD_BAND;
|
||||||
|
case EBADRQC: /* Rate must be non-zero */
|
||||||
|
return OFPERR_OFPMMFC_BAD_RATE;
|
||||||
default:
|
default:
|
||||||
return OFPERR_OFPMMFC_UNKNOWN;
|
return OFPERR_OFPMMFC_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user