LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 09-16-2008, 05:30 PM   #1
Primeiro
LQ Newbie
 
Registered: Sep 2008
Posts: 5

Rep: Reputation: 0
Compiling tcng in ubuntu 8.04


Hi,

I'm trying to compile tcng-10b (linux traffic control next generation) in ubuntu hardy. I'm getting the following errors. By looking at file ksvc.c I've noticed that errors occur whenever struct sk_buff is used. Any suggestions on how to fix this?

ksvc.c:28: warning: ‘struct sock’ declared inside parameter list
ksvc.c:28: warning: its scope is only this definition or declaration, which is probably not what you want
ksvc.c:46: warning: no previous prototype for ‘printk’
ksvc.c: In function ‘__kfree_skb’:
ksvc.c:70: error: dereferencing pointer to incomplete type
ksvc.c:71: error: dereferencing pointer to incomplete type
ksvc.c: In function ‘alloc_skb’:
ksvc.c:81: error: invalid application of ‘sizeof’ to incomplete type ‘struct sk_buff’
ksvc.c:82: error: dereferencing pointer to incomplete type
ksvc.c:83: error: dereferencing pointer to incomplete type
ksvc.c:83: error: dereferencing pointer to incomplete type
ksvc.c:83: error: dereferencing pointer to incomplete type
ksvc.c:83: error: dereferencing pointer to incomplete type
ksvc.c:84: error: dereferencing pointer to incomplete type
ksvc.c:88: error: dereferencing pointer to incomplete type
ksvc.c:89: error: dereferencing pointer to incomplete type
ksvc.c:89: error: invalid application of ‘sizeof’ to incomplete type ‘struct sk_buff’
ksvc.c:90: error: dereferencing pointer to incomplete type
ksvc.c:91: error: dereferencing pointer to incomplete type
ksvc.c:91: error: dereferencing pointer to incomplete type
ksvc.c: In function ‘rtnetlink_send’:
ksvc.c:150: error: dereferencing pointer to incomplete type
 
Old 09-16-2008, 06:17 PM   #2
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 59
use Synaptic to install this, unless you really need to compile from source. if the latter is true then you would need to post the code for us to look at, or send it to the developers of the tool if it is actually a bug (well, compilation error, not a bug).

Synaptic is in System->Administration. use the 'Search' button to find 'tcng'. you should be able to install it with GUI-only, no command line stuff.
 
Old 09-16-2008, 08:03 PM   #3
Primeiro
LQ Newbie
 
Registered: Sep 2008
Posts: 5

Original Poster
Rep: Reputation: 0
I've successfully installed tcng from the ubuntu repos using synaptic. However I don't want to use the tcng in the ubuntu repos because it doesn't have tcsim (traffic control simulator).

The problem is not in the tool itself because I've installed it before in Feisty. Now that I've updated to Hardy I can't seem to get it compiled. I'm I missing a package?

The errors happen to be in the followin two functions:

void __kfree_skb(struct sk_buff *skb)
{
if (--skb->users) return;
free(skb->data);
...
}

...

struct sk_buff *alloc_skb(unsigned int size,int priority)
{
...

skb = alloc_t(struct sk_buff);
memset(skb,0,sizeof(*skb));
skb->data = skb->head = skb->tail = skb->end = alloc(size);
if (!skb->data) {
...
}
skb->users = 1;
skb->truesize = size+sizeof(struct sk_buff);
skb->end += size;
SKB_GEN(skb) = generation++;
...
}
 
Old 09-16-2008, 08:23 PM   #4
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 59
can you post the complete ksvc.c file. use the "code" tags to put the source code in.
 
Old 09-16-2008, 08:29 PM   #5
Primeiro
LQ Newbie
 
Registered: Sep 2008
Posts: 5

Original Poster
Rep: Reputation: 0
Here it is:

Code:
/*
 * ksvc.c - Kernel services replacement for tcsim
 *
 * Written 2001,2002 by Werner Almesberger
 * Copyright 2001 EPFL-ICA, Network Robots
 * Copyright 2002 Werner Almesberger
 */


#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <sys/time.h> /* struct timeval for skbuff.h */

#define __TCSIM__
#include <linux/slab.h> /* for prototypes */
#include <linux/netdevice.h> /* for prototypes */

#include <memutil.h>

#include "tckernel.h"
#include "tcsim.h"


extern int netlink_unicast(struct sock *ssk,struct sk_buff *skb,u32 pid,
  int nonblock);

struct net_device *dev_base = NULL;


void *kmalloc(size_t size, int flags)
{
    return alloc(size);
}


void kfree(const void *ptr)
{
    free((void *) ptr);
}


int printk(const char *fmt,...)
{
    va_list ap;
    int res;

    if (fmt[0] == '<' && isdigit(fmt[1]) && fmt[2] == '>') {
	if (fmt[1]-'0' > printk_threshold) return 0; /* return more ? */
	fmt += 3;
    }
    else {
	/* KERN_WARNING, linux/kernel/printk.c:DEFAULT_MESSAGE_LOGLEVEL */
	if (4 > printk_threshold) return 0;
    }
    fflush(stdout);
    fprintf(stderr,"| ");
    va_start(ap,fmt);
    res = vfprintf(stderr,fmt,ap);
    va_end(ap);
    fflush(stderr);
    return res;
}


void __kfree_skb(struct sk_buff *skb)
{
    if (--skb->users) return;
    free(skb->data);
    free(skb);
}


struct sk_buff *alloc_skb(unsigned int size,int priority)
{
    static __u32 generation = 0; /* skb generation number */
    struct sk_buff *skb;

    skb = alloc_t(struct sk_buff);
    memset(skb,0,sizeof(*skb));
    skb->data = skb->head = skb->tail = skb->end = alloc(size);
    if (!skb->data) {
	perror("out of memory");
	exit(1);
    }
    skb->users = 1;
    skb->truesize = size+sizeof(struct sk_buff);
    skb->end += size;
    SKB_GEN(skb) = generation++;
    return skb;
}


void skb_over_panic(struct sk_buff *skb,int len,void *here);
    /* from linux/include/linux/skbuff.h */

void skb_over_panic(struct sk_buff *skb,int len,void *here)
{
    fflush(stdout);
    fprintf(stderr,"PANIC: skb %p, length %d\n",skb,len);
    abort();
}


int ___pskb_trim(struct sk_buff *skb, unsigned int len, int realloc);
    /* from linux/include/linux/skbuff.h */

int ___pskb_trim(struct sk_buff *skb, unsigned int len, int realloc)
{
    abort(); /* we shouldn't need this for now @@@ */
}


/*
 * From net/core/dev.c
 */


struct net_device *dev_get_by_index(int ifindex)
{
    struct net_device *dev;

    for (dev = dev_base; dev; dev = dev->next)
	if (dev->ifindex == ifindex) return dev;
    return NULL;
}


void dev_deactivate(struct net_device *dev)
{
    /* do nothing */
}


/*
 * From net/core/rtnetlink.c
 */


int pseudo_netlink_from_kernel(void *buf,int len)
{
    return netlink_recv(buf,len);
}


int rtnetlink_send(struct sk_buff *skb,__u32 pid,unsigned group,int echo)
{
    if (group) return skb->len;
    if (debug) debugf("rtnetlink_send to pid %u",pid);
//    NETLINK_CB(skb).dst_groups = group;
    return netlink_unicast(NULL,skb,pid,0);
}


int ffz(int v)
{
    return ffs(~v)-1;
}


/*
 * From net/core/utils.c
 */


static unsigned long net_rand_seed = 152L;


unsigned long net_random(void)
{
    net_rand_seed = net_rand_seed*69069L+1;
    return net_rand_seed;
}


/*
 * ll_name_to_index and ll_index_to_name ought to be in usvc.c, not ksvc.c.
 * Unfortunately, including netdevice.h there would cause problems, that's
 * why they're here.
 */


int ll_name_to_index(const char *name); /* in ulib */

int ll_name_to_index(const char *name)
{
    struct net_device *dev;

    for (dev = dev_base; dev; dev = dev->next)
	if (!strcmp(dev->name,name)) return dev->ifindex;
    return 0;
}


const char *ll_index_to_name(int idx); /* in ulib */

const char *ll_index_to_name(int idx)
{
    struct net_device *dev;

    for (dev = dev_base; dev; dev = dev->next)
	if (dev->ifindex == idx) return dev->name;
    return NULL;
}


extern void setup_netlink(void);
extern int pktsched_init(void);


int kernel_init(void)
{
    setup_netlink();
    return pktsched_init();
}
 
Old 09-16-2008, 09:02 PM   #6
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 59
is it just the above warnings and errors that you showed in post #1? or is there a larger list? did you read and follow the README for tcng exactly? (ie installed required libraries, etc)
 
Old 09-16-2008, 09:46 PM   #7
Primeiro
LQ Newbie
 
Registered: Sep 2008
Posts: 5

Original Poster
Rep: Reputation: 0
Yes, those are all the errors I got. I followed all the steps in the README. I installed all the packages they mentioned there.
 
Old 09-18-2008, 08:57 AM   #8
Primeiro
LQ Newbie
 
Registered: Sep 2008
Posts: 5

Original Poster
Rep: Reputation: 0
Thumbs up Fixed

The problem was the linux kernel (2.5.0) that I was using to compile tcsim. The kernels that compile are 2.4.27 and 2.5.4.

Thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compiling kernel 2.4.25 on ubuntu 8.04 freddo Linux - Kernel 3 08-27-2008 07:26 PM
compiling exmap on Ubuntu 8.04 Ryzol Linux - Software 3 06-11-2008 10:49 PM
TCNG installation ronban Linux - Networking 1 08-03-2007 02:58 AM
Nucleo not compiling in Ubuntu 6.06 Da_Panther Linux - Software 2 12-27-2006 07:09 PM
what has tcc (tcng) has become? eantoranz Linux - Networking 2 11-10-2005 01:05 AM


All times are GMT -5. The time now is 06:26 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration