Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] uml: reintroduce pcap support

The pcap support was not working because of some linking problems (expressing
the construct in Kbuild was a bit difficult) and because there was no user
request. Now that this has come back, here's the support.

This has been tested and works on both 32 and 64-bit hosts, even when
"cross-"building 32-bit binaries.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Paolo 'Blaisorblade' Giarrusso and committed by
Linus Torvalds
ecc354a9 8e0a2181

+25 -10
+1 -1
arch/um/Kconfig_net
··· 135 135 136 136 config UML_NET_PCAP 137 137 bool "pcap transport" 138 - depends on UML_NET && BROKEN 138 + depends on UML_NET && EXPERIMENTAL 139 139 help 140 140 The pcap transport makes a pcap packet stream on the host look 141 141 like an ethernet device inside UML. This is useful for making
+10 -6
arch/um/Makefile
··· 56 56 core-y += $(SUBARCH_CORE) 57 57 libs-y += $(SUBARCH_LIBS) 58 58 59 + # -Dvmap=kernel_vmap affects everything, and prevents anything from 60 + # referencing the libpcap.o symbol so named. 61 + 62 + CFLAGS += $(CFLAGS-y) -D__arch_um__ -DSUBARCH=\"$(SUBARCH)\" \ 63 + $(ARCH_INCLUDE) $(MODE_INCLUDE) -Dvmap=kernel_vmap 64 + 65 + USER_CFLAGS := $(patsubst -I%,,$(CFLAGS)) 66 + USER_CFLAGS := $(patsubst -D__KERNEL__,,$(USER_CFLAGS)) $(ARCH_INCLUDE) \ 67 + $(MODE_INCLUDE) $(ARCH_USER_CFLAGS) 68 + 59 69 # -Derrno=kernel_errno - This turns all kernel references to errno into 60 70 # kernel_errno to separate them from the libc errno. This allows -fno-common 61 71 # in CFLAGS. Otherwise, it would cause ld to complain about the two different 62 72 # errnos. 63 73 64 - CFLAGS += $(CFLAGS-y) -D__arch_um__ -DSUBARCH=\"$(SUBARCH)\" \ 65 - $(ARCH_INCLUDE) $(MODE_INCLUDE) 66 - 67 - USER_CFLAGS := $(patsubst -I%,,$(CFLAGS)) 68 - USER_CFLAGS := $(patsubst -D__KERNEL__,,$(USER_CFLAGS)) $(ARCH_INCLUDE) \ 69 - $(MODE_INCLUDE) $(ARCH_USER_CFLAGS) 70 74 CFLAGS += -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask 71 75 CFLAGS += $(call cc-option,-fno-unit-at-a-time,) 72 76
+14 -3
arch/um/drivers/Makefile
··· 10 10 slirp-objs := slirp_kern.o slirp_user.o 11 11 daemon-objs := daemon_kern.o daemon_user.o 12 12 mcast-objs := mcast_kern.o mcast_user.o 13 - #pcap-objs := pcap_kern.o pcap_user.o $(PCAP) 14 13 net-objs := net_kern.o net_user.o 15 14 mconsole-objs := mconsole_kern.o mconsole_user.o 16 15 hostaudio-objs := hostaudio_kern.o 17 16 ubd-objs := ubd_kern.o ubd_user.o 18 17 port-objs := port_kern.o port_user.o 19 18 harddog-objs := harddog_kern.o harddog_user.o 19 + 20 + LDFLAGS_pcap.o := -r $(shell $(CC) $(CFLAGS) -print-file-name=libpcap.a) 21 + 22 + $(obj)/pcap.o: $(obj)/pcap_kern.o $(obj)/pcap_user.o 23 + $(LD) -r -dp -o $@ $^ $(LDFLAGS) $(LDFLAGS_pcap.o) 24 + #XXX: The call below does not work because the flags are added before the 25 + # object name, so nothing from the library gets linked. 26 + #$(call if_changed,ld) 27 + 28 + # When the above is fixed, don't forget to add this too! 29 + #targets := $(obj)/pcap.o 20 30 21 31 obj-y := stdio_console.o fd.o chan_kern.o chan_user.o line.o 22 32 obj-$(CONFIG_SSL) += ssl.o ··· 36 26 obj-$(CONFIG_UML_NET_SLIRP) += slirp.o slip_common.o 37 27 obj-$(CONFIG_UML_NET_DAEMON) += daemon.o 38 28 obj-$(CONFIG_UML_NET_MCAST) += mcast.o 39 - #obj-$(CONFIG_UML_NET_PCAP) += pcap.o $(PCAP) 29 + obj-$(CONFIG_UML_NET_PCAP) += pcap.o 40 30 obj-$(CONFIG_UML_NET) += net.o 41 31 obj-$(CONFIG_MCONSOLE) += mconsole.o 42 32 obj-$(CONFIG_MMAPPER) += mmapper_kern.o ··· 51 41 obj-$(CONFIG_BLK_DEV_COW_COMMON) += cow_user.o 52 42 obj-$(CONFIG_UML_RANDOM) += random.o 53 43 54 - USER_OBJS := fd.o null.o pty.o tty.o xterm.o slip_common.o 44 + # pcap_user.o must be added explicitly. 45 + USER_OBJS := fd.o null.o pty.o tty.o xterm.o slip_common.o pcap_user.o 55 46 56 47 include arch/um/scripts/Makefile.rules