diff mbox

example: classifier: fix ipv4 address input format

Message ID 1449756800-10730-1-git-send-email-bala.manoharan@linaro.org
State Accepted
Commit 3824a72a48da0954ec3f28d5fb6ff51cec891363
Headers show

Commit Message

Balasubramanian Manoharan Dec. 10, 2015, 2:13 p.m. UTC
Fixes ipv4 address input format issue.

Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
---
 example/classifier/odp_classifier.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Bill Fischofer Dec. 10, 2015, 3:49 p.m. UTC | #1
On Thu, Dec 10, 2015 at 8:13 AM, Balasubramanian Manoharan <
bala.manoharan@linaro.org> wrote:

> Fixes ipv4 address input format issue.

>

> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>

>


Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>



> ---

>  example/classifier/odp_classifier.c | 5 ++---

>  1 file changed, 2 insertions(+), 3 deletions(-)

>

> diff --git a/example/classifier/odp_classifier.c

> b/example/classifier/odp_classifier.c

> index 2ecf733..0da07e7 100644

> --- a/example/classifier/odp_classifier.c

> +++ b/example/classifier/odp_classifier.c

> @@ -167,9 +167,8 @@ int parse_ipv4_addr(const char *ipaddress, uint64_t

> *addr)

>         uint32_t b[4];

>         int converted;

>

> -       converted = sscanf(ipaddress, "%" SCNx32 ".%" SCNx32

> -                          ".%" SCNx32 ".%" SCNx32,

> -                       &b[3], &b[2], &b[1], &b[0]);

> +       converted = sscanf(ipaddress, "%d.%d.%d.%d",

> +                          &b[3], &b[2], &b[1], &b[0]);

>         if (4 != converted)

>                 return -1;

>

> --

> 1.9.1

>

> _______________________________________________

> lng-odp mailing list

> lng-odp@lists.linaro.org

> https://lists.linaro.org/mailman/listinfo/lng-odp

>
Maxim Uvarov Dec. 11, 2015, 7:17 a.m. UTC | #2
Merged,
Maxim.

On 12/10/2015 18:49, Bill Fischofer wrote:
>
>
> On Thu, Dec 10, 2015 at 8:13 AM, Balasubramanian Manoharan 
> <bala.manoharan@linaro.org <mailto:bala.manoharan@linaro.org>> wrote:
>
>     Fixes ipv4 address input format issue.
>
>     Signed-off-by: Balasubramanian Manoharan
>     <bala.manoharan@linaro.org <mailto:bala.manoharan@linaro.org>>
>
>
> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org 
> <mailto:bill.fischofer@linaro.org>>
>
>     ---
>      example/classifier/odp_classifier.c | 5 ++---
>      1 file changed, 2 insertions(+), 3 deletions(-)
>
>     diff --git a/example/classifier/odp_classifier.c
>     b/example/classifier/odp_classifier.c
>     index 2ecf733..0da07e7 100644
>     --- a/example/classifier/odp_classifier.c
>     +++ b/example/classifier/odp_classifier.c
>     @@ -167,9 +167,8 @@ int parse_ipv4_addr(const char *ipaddress,
>     uint64_t *addr)
>             uint32_t b[4];
>             int converted;
>
>     -       converted = sscanf(ipaddress, "%" SCNx32 ".%" SCNx32
>     -                          ".%" SCNx32 ".%" SCNx32,
>     -                       &b[3], &b[2], &b[1], &b[0]);
>     +       converted = sscanf(ipaddress, "%d.%d.%d.%d",
>     +                          &b[3], &b[2], &b[1], &b[0]);
>             if (4 != converted)
>                     return -1;
>
>     --
>     1.9.1
>
>     _______________________________________________
>     lng-odp mailing list
>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>     https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
diff mbox

Patch

diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c
index 2ecf733..0da07e7 100644
--- a/example/classifier/odp_classifier.c
+++ b/example/classifier/odp_classifier.c
@@ -167,9 +167,8 @@  int parse_ipv4_addr(const char *ipaddress, uint64_t *addr)
 	uint32_t b[4];
 	int converted;
 
-	converted = sscanf(ipaddress, "%" SCNx32 ".%" SCNx32
-			   ".%" SCNx32 ".%" SCNx32,
-			&b[3], &b[2], &b[1], &b[0]);
+	converted = sscanf(ipaddress, "%d.%d.%d.%d",
+			   &b[3], &b[2], &b[1], &b[0]);
 	if (4 != converted)
 		return -1;