Bug 191428 - net/libbgpdump misbehaves when compiled with clang
Summary: net/libbgpdump misbehaves when compiled with clang
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Some People
Assignee: Kurt Jaeger
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-26 23:57 UTC by mjl
Modified: 2014-08-15 20:25 UTC (History)
2 users (show)

See Also:


Attachments
convert libbgpdump to gcc, bump portrevision (459 bytes, patch)
2014-06-26 23:57 UTC, mjl
no flags Details | Diff
use snprintf instead of buggy included int2str, revert back to system compiler (1.34 KB, patch)
2014-08-15 20:16 UTC, mjl
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description mjl 2014-06-26 23:57:02 UTC
Created attachment 144179 [details]
convert libbgpdump to gcc, bump portrevision

on my system:

FreeBSD sorcerer.caida.org 10.0-RELEASE-p4 FreeBSD 10.0-RELEASE-p4 #0: Tue Jun  3 12:52:18 UTC 2014     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  i386

a bgpdump compiled with base system compiler (clang) behaves differently (incorrectly) compared with bgpdump compiled with gcc (4.7 in my case)

For example, if you download

http://data.ris.ripe.net/rrc01/2014.06/bview.20140601.0000.gz

and then run bgpdump -m bview.20140601.0000.gz | head -n 1, the first line is:
TABLE_DUMP2|1401580800|B|195.66.226.20|56730|1.0.0.0/24|56730 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169 15169...|IGP|195.66.224.125|0|0|56730:8714|NAG||

If you recompile libbgpdump with the attached patch, the above command produces:

TABLE_DUMP2|1401580800|B|195.66.226.20|56730|1.0.0.0/24|56730 15169|IGP|195.66.224.125|0|0|56730:8714|NAG||
Comment 1 John Marino freebsd_committer freebsd_triage 2014-07-20 16:08:11 UTC
I see that you are the maintainer, so .... what are you going to do about this?  

Who was your intended target for this PR?  You are the POC for the port.
Comment 2 mjl 2014-07-20 19:25:46 UTC
I hoped that someone with commit would apply the patch.
Comment 3 Kurt Jaeger freebsd_committer freebsd_triage 2014-07-20 21:14:11 UTC
I'll take it.
Comment 4 commit-hook freebsd_committer freebsd_triage 2014-07-20 21:19:07 UTC
A commit references this bug:

Author: pi
Date: Sun Jul 20 21:19:05 UTC 2014
New revision: 362374
URL: http://svnweb.freebsd.org/changeset/ports/362374

Log:
  net/libbgpdump: use gcc, breaks with clang, and strip the lib

  PR:		191428
  Submitted by:	mjl@luckie.org.nz (maintainer)

Changes:
  head/net/libbgpdump/Makefile
Comment 5 Kurt Jaeger freebsd_committer freebsd_triage 2014-07-20 21:19:35 UTC
Committed, thanks!
Comment 6 mjl 2014-08-15 20:16:03 UTC
Created attachment 145837 [details]
use snprintf instead of buggy included int2str, revert back to system compiler

int int2str(uint32_t value, char* str)
{
    const int LEN = 11;
    char b[LEN];
    int i = LEN;
    b[i--] = '\0';

this code (in util.c) causes an overflow.  but the whole int2str should not exist so just remove it.
Comment 7 commit-hook freebsd_committer freebsd_triage 2014-08-15 20:24:32 UTC
A commit references this bug:

Author: pi
Date: Fri Aug 15 20:24:07 UTC 2014
New revision: 365034
URL: http://svnweb.freebsd.org/changeset/ports/365034

Log:
  net/libbgpdump: fix build with clang

  PR:		191428
  Submitted by:	mjl@luckie.org.nz (maintainer)

Changes:
  head/net/libbgpdump/Makefile
  head/net/libbgpdump/files/patch-util.c
Comment 8 Kurt Jaeger freebsd_committer freebsd_triage 2014-08-15 20:25:15 UTC
Committed, thanks!