Multiple definitions. Code issue

ahuguet at cttc.es ahuguet at cttc.es
Tue Apr 17 05:20:04 EDT 2007


Greetings,

I've been adding code to the driver in order to perform certain
experiments with it. Just now, I encountered an issue that is preventing
me from advancing any further. I'm sure though that solving it should be
quite simple.

First, I attach the errors when compiling:

  LD [M]  /usr/src/linux-source-2.6.17/drivers/net/wireless/hostap/hostap.o
/usr/src/linux-source-2.6.17/drivers/net/wireless/hostap/hostap_80211_tx.o:(.bss+0x0):
multiple definitions of `last_data_rx'
/usr/src/linux-source-2.6.17/drivers/net/wireless/hostap/hostap_80211_rx.o:(.bss+0x0):
it was first defined here
/usr/src/linux-source-2.6.17/drivers/net/wireless/hostap/hostap_ap.o:(.bss+0x0):
multiple definitions of `last_data_rx'
/usr/src/linux-source-2.6.17/drivers/net/wireless/hostap/hostap_80211_rx.o:(.bss+0x0):
it was first defined here
/usr/src/linux-source-2.6.17/drivers/net/wireless/hostap/hostap_info.o:(.bss+0x0):
multiple definitions of `last_data_rx'
/usr/src/linux-source-2.6.17/drivers/net/wireless/hostap/hostap_80211_rx.o:(.bss+0x0):
it was first defined here
/usr/src/linux-source-2.6.17/drivers/net/wireless/hostap/hostap_ioctl.o:(.bss+0x0):
multiple definitions of `last_data_rx'
/usr/src/linux-source-2.6.17/drivers/net/wireless/hostap/hostap_80211_rx.o:(.bss+0x0):
it was first defined here
/usr/src/linux-source-2.6.17/drivers/net/wireless/hostap/hostap_main.o:(.bss+0x0):
multiple definitions of `last_data_rx'
/usr/src/linux-source-2.6.17/drivers/net/wireless/hostap/hostap_80211_rx.o:(.bss+0x0):
it was first defined here
/usr/src/linux-source-2.6.17/drivers/net/wireless/hostap/hostap_proc.o:(.bss+0x0):
multiple definitions of `last_data_rx'
/usr/src/linux-source-2.6.17/drivers/net/wireless/hostap/hostap_80211_rx.o:(.bss+0x0):
it was first defined here
make[1]: ***
[/usr/src/linux-source-2.6.17/drivers/net/wireless/hostap/hostap.o] Error
1
make: ***
[_module_/usr/src/linux-source-2.6.17/drivers/net/wireless/hostap] Error 2


I describe now what I intended to do, and where I think the source of the
problem is.

I'd like to keep a copy of certain packets that reach the station, for
later use.
To that end, I cannot use local variables, so I tried using a global
variable.

So, at hostap_80211.h I defined the following:

struct sk_buff *last_data_rx;

The line #endif /* HOSTAP_80211_H */ goes just after my declaration.

That pointer to an sk_buff is then used in hostap_80211_rx.c (and only
there that I know of), in void hostap_80211_rx function where what I do,
mainly, is call the function skb_copy to have a copy of the current skb on
last_data_rx.
This way:
last_data_rx = skb_copy (skb,GFP_KERNEL);

that way last_data_rx should keep (or that's the idea) a copy of that skb,
even if more packets of different kind are received later, so I can have a
copy of one type of packets that have reached the station.

I thought that, since hostap_80211.h has the
#ifndef HOSTAP_80211_H
#define HOSTAP_80211_H

#endif /* HOSTAP_80211_H */

then there would be no problem with multiple declarations, but I was
clearly wrong. Perhaps I've not placed the global variable in the right
place?

Thanks for all the help, and let me know if you need more information.




More information about the HostAP mailing list