[quagga-dev 8256] Re: [PATCH] bgp: Fix display of unsigned attributes

Balaji G balajig81 at gmail.com
Sun Sep 12 14:41:40 BST 2010


Applied, Thanks Stephen.

But just curious to know whether we could get into this scenario of it
displaying such big values ?

Thanks,
Cheers,
  - Balaji

On Fri, Sep 10, 2010 at 10:17 PM, Stephen Hemminger
<shemminger at vyatta.com>wrote:

>
> From: Wataru Tanitsu <wataru at ate-mahoroba.jp>
>
> The local prefix, metric and weight values are all stored as uint32_t.
> Change the format to %u so that large values are not displayed
> as negative integers.
>
> Acked-by: Stephen Hemminger <shemminger at vyatta.com>
>
> --- a/bgpd/bgp_route.c  2010-01-15 12:54:28.000000000 -0800
> +++ b/bgpd/bgp_route.c  2010-09-10 09:49:42.000000000 -0700
> @@ -5723,12 +5723,12 @@ route_vty_out (struct vty *vty, struct p
>  #endif /* HAVE_IPV6 */
>
>       if (attr->flag & ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC))
> -       vty_out (vty, "%10d", attr->med);
> +       vty_out (vty, "%10u", attr->med);
>       else
>        vty_out (vty, "          ");
>
>       if (attr->flag & ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF))
> -       vty_out (vty, "%7d", attr->local_pref);
> +       vty_out (vty, "%7u", attr->local_pref);
>       else
>        vty_out (vty, "       ");
>
> @@ -5788,16 +5788,16 @@ route_vty_out_tmp (struct vty *vty, stru
>  #endif /* HAVE_IPV6 */
>
>       if (attr->flag & ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC))
> -       vty_out (vty, "%10d", attr->med);
> +       vty_out (vty, "%10u", attr->med);
>       else
>        vty_out (vty, "          ");
>
>       if (attr->flag & ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF))
> -       vty_out (vty, "%7d", attr->local_pref);
> +       vty_out (vty, "%7u", attr->local_pref);
>       else
>        vty_out (vty, "       ");
>
> -      vty_out (vty, "%7d ", (attr->extra ? attr->extra->weight : 0));
> +      vty_out (vty, "%7u ", (attr->extra ? attr->extra->weight : 0));
>
>       /* Print aspath */
>       if (attr->aspath)
> @@ -6064,15 +6064,15 @@ route_vty_out_detail (struct vty *vty, s
>       vty_out (vty, "      Origin %s", bgp_origin_long_str[attr->origin]);
>
>       if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC))
> -       vty_out (vty, ", metric %d", attr->med);
> +       vty_out (vty, ", metric %u", attr->med);
>
>       if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))
> -       vty_out (vty, ", localpref %d", attr->local_pref);
> +       vty_out (vty, ", localpref %u", attr->local_pref);
>       else
> -       vty_out (vty, ", localpref %d", bgp->default_local_pref);
> +       vty_out (vty, ", localpref %u", bgp->default_local_pref);
>
>       if (attr->extra && attr->extra->weight != 0)
> -       vty_out (vty, ", weight %d", attr->extra->weight);
> +       vty_out (vty, ", weight %u", attr->extra->weight);
>
>       if (! CHECK_FLAG (binfo->flags, BGP_INFO_HISTORY))
>        vty_out (vty, ", valid");
> _______________________________________________
> Quagga-dev mailing list
> Quagga-dev at lists.quagga.net
> http://lists.quagga.net/mailman/listinfo/quagga-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.quagga.net/pipermail/quagga-dev/attachments/20100912/9f25a086/attachment-0001.html>


More information about the Quagga-dev mailing list