X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fautopath.c;h=9da646339a19587ca6a7f928bf3b1628cef195ed;hb=bee6b8bc16b1c42fef8843cffe4d68b464cddadf;hp=ae8007dee0f82c45204dd04caaa06400313647e4;hpb=c51c638a13261a17bc39e7d7cef3fc4bc458a508;p=openvswitch diff --git a/lib/autopath.c b/lib/autopath.c index ae8007de..9da64633 100644 --- a/lib/autopath.c +++ b/lib/autopath.c @@ -36,8 +36,8 @@ void autopath_parse(struct ofpact_autopath *ap, const char *s_) { char *s; - int id_int; char *id_str, *dst, *save_ptr; + uint16_t port; ofpact_init_AUTOPATH(ap); @@ -50,12 +50,10 @@ autopath_parse(struct ofpact_autopath *ap, const char *s_) ovs_fatal(0, "%s: not enough arguments to autopath action", s_); } - id_int = atoi(id_str); - if (id_int < 1 || id_int > UINT32_MAX) { - ovs_fatal(0, "%s: autopath id %d is not in valid range " - "1 to %"PRIu32, s_, id_int, UINT32_MAX); + if (!ofputil_port_from_string(id_str, &port)) { + ovs_fatal(0, "%s: bad port number", s_); } - ap->port = id_int; + ap->port = port; mf_parse_subfield(&ap->dst, dst); if (ap->dst.n_bits < 16) {