[HECnet] New bridge.c feedback

Johnny Billquist bqt at softjar.se
Thu Jun 7 08:42:50 PDT 2012


Hi, Alastair. Thanks for the feedback. Interesting... Care to help me figure some things out...?

On 2012-06-07 08:33, Boyanich, Alastair wrote:
Hi Johnny. New bridge.c compiled. Seems fine in GCC, MIPSpro is still
too strict. Build output and config are as follows:


jazz:~/src/HECnet[97]%cc -O2 -o bridge bridge.c -I/opt/skunkware/include
-L/opt/skunkware/lib -lpcap
cc-1515 cc: ERROR File = bridge.c, Line = 229
    A value of type "int" cannot be assigned to an entity of type "char
*".

            p = index(dst,':');
                ^

Eh... So your compiler thinks that index() returns an int?
Is there another include file needed to get the right index() function prototype? What does your documentation (or man-page) say about index() ?
Either it has a different (and strange) definition of index(), or else this is the default assumption in C that unknown functions return an int. But in that case, it might also have been nice if it complained about the unknown function. Either way, there is nothing wrong in the code, with the possible exception that some file needs to be included to fix this.

cc-1185 cc: WARNING File = bridge.c, Line = 578
    An enumerated type is mixed with another type.

        d->type = classify_packet(d);
                        ^

Ah. Thanks. Fixed. Silly of me. I moved to the enums several years ago, but didn't do it proper all the way.

cc-1171 cc: WARNING File = bridge.c, Line = 684
    The indicated expression has no effect.

        if (port == 0) port == DPORT;
                                      ^

Blech! Well, DPORT is by default set to 0. See the documentation of the define in the sources... This one will stay.

1 error detected in the compilation of "bridge.c".
gmake: *** [bridge] Error 2

I've added -Wall to my Makefile now (that checks a lot), and the only warning I get here is about this last one... (which was expected)

jazz:~/src/HECnet[98]%gcc -O2 -o bridge bridge.c
-I/opt/skunkware/include -L/opt/skunkware/lib -lpcap
bridge.c: In function 'add_bridge':
bridge.c:218: warning: incompatible implicit declaration of built-in
function 'bzero'
bridge.c:229: warning: incompatible implicit declaration of built-in
function 'index'

It would definitely appear that some include file is needed to make the compilation happy on your system. Care to find out which file defines bzero() and index()?

jazz:~/src/HECnet[99]%file bridge;ls -l bridge
bridge:                 ELF N32 MSB mips-4 dynamic executable MIPS - version 1
-rwxr-xr-x       1 uridium   clowns       302060 Jun   7 16:25 bridge
jazz:~/src/HECnet[100]%cat bridge.conf
[bridge]
local ec0
update tempo.update.uu.se:4711

[decnet]
local
update

[lat]
local
update
####

Looks like some casting might be in order. I think I'm ready to go with
the port forwarding and bridge setup on this end. Spotted a nice guide a
while ago as to how to configure the decnet side of things. I'll follow
that guide once the bridge is up. :)

Looks good, yes...

	Johnny



More information about the Hecnet-list mailing list