Describe dummy test model. Work on OpenFlow intro.
[openvswitch] / lib / autopath.c
index ae8007dee0f82c45204dd04caaa06400313647e4..9da646339a19587ca6a7f928bf3b1628cef195ed 100644 (file)
@@ -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) {