기존 이솝 임베디드 포럼의 지식인 서비스가 게시판 형태로 변경되었습니다.

안녕하세요.


특정 네트워크가 무선인지 유선인지 알고 싶습니다.


제 상황은 이더넷드라이버랑 무선드라이버가 2개가 있습니다.


현재 이더넷드라이버는 eth0으로 잡히고 무선드라이버는 eth1로 잡힙니다.


그런데 드라이버를 올리는 순서를 달리하여서 무선드라이버를 먼저올리고 이더넷드라이버를 나중에 올리면 


무선이 eth0이 되고 유선 이더넷이 eth1이 됩니다.


이런 상황에서 eth0는 무조건 이더넷이라고 단정하기도 애매한 상황같아서 특정 인터페이스가 유선인지 무선인지 알았으면 합니다.


이러저러한 방법을 찾아보다가 udev를 이용 할수 있을것 같아서 각각의 네트워크 인터페이스에 대해서 udev정보를 읽어보았습니다.


root@test:~# udevadm info -a -p /sys/class/net/eth0


Udevadm info starts with the device specified by the devpath and then

walks up the chain of parent devices. It prints for every device

found, all possible attributes in the udev rules key format.

A rule to match, can be composed by the attributes of the device

and the attributes from one single parent device.


looking at device '/devices/virtual/net/eth0':

KERNEL=="eth0"

SUBSYSTEM=="net"

DRIVER==""

ATTR{mtu}=="1500"

ATTR{type}=="1"

ATTR{netdev_group}=="0"

ATTR{flags}=="0x1003"

ATTR{dormant}=="0"

ATTR{addr_assign_type}=="0"

ATTR{dev_id}=="0x0"

ATTR{iflink}=="2"

ATTR{addr_len}=="6"

ATTR{address}=="00:15:1d:00:00:00"

ATTR{operstate}=="up"

ATTR{broadcast}=="ff:ff:ff:ff:ff:ff"

ATTR{tx_queue_len}=="1000"

ATTR{ifalias}==""

ATTR{ifindex}=="2"

ATTR{link_mode}=="0"

ATTR{carrier}=="1"


root@test:~#



 root@test:~# udevadm info -a -p /sys/class/net/eth1


Udevadm info starts with the device specified by the devpath and then

walks up the chain of parent devices. It prints for every device

found, all possible attributes in the udev rules key format.

A rule to match, can be composed by the attributes of the device

and the attributes from one single parent device.


looking at device '/devices/platform/exynos4-sdhci.3/mmc_host/mmc1/mmc1:0001/mmc1:0001:1/net/eth1':

KERNEL=="eth1"

SUBSYSTEM=="net"

DRIVER==""

ATTR{mtu}=="1500"

ATTR{type}=="1"

ATTR{netdev_group}=="0"

ATTR{flags}=="0x1002"

ATTR{addr_assign_type}=="0"

ATTR{dev_id}=="0x0"

ATTR{iflink}=="3"

ATTR{addr_len}=="6"

ATTR{address}=="c4:23:7a:00:6e:93"

ATTR{operstate}=="down"

ATTR{broadcast}=="ff:ff:ff:ff:ff:ff"

ATTR{tx_queue_len}=="1000"

ATTR{ifalias}==""

ATTR{ifindex}=="3"

ATTR{link_mode}=="0"


looking at parent device '/devices/platform/exynos4-sdhci.3/mmc_host/mmc1/mmc1:0001/mmc1:0001:1':

KERNELS=="mmc1:0001:1"

SUBSYSTEMS=="sdio"

DRIVERS=="unifi"

ATTRS{class}=="0x00"

ATTRS{device}=="0x0007"

ATTRS{vendor}=="0x032a"


looking at parent device '/devices/platform/exynos4-sdhci.3/mmc_host/mmc1/mmc1:0001':

KERNELS=="mmc1:0001"

SUBSYSTEMS=="mmc"

DRIVERS==""

ATTRS{type}=="SDIO"


looking at parent device '/devices/platform/exynos4-sdhci.3/mmc_host/mmc1':

KERNELS=="mmc1"

SUBSYSTEMS=="mmc_host"

DRIVERS==""


looking at parent device '/devices/platform/exynos4-sdhci.3':

KERNELS=="exynos4-sdhci.3"

SUBSYSTEMS=="platform"

DRIVERS=="s3c-sdhci"


looking at parent device '/devices/platform':

KERNELS=="platform"

SUBSYSTEMS==""

DRIVERS==""


root@test:~#


정보를 보고 나름 생각하기로는 ATTR{flags}가 0x1002이면 무선이고 0x1003이면 유선이지 않을까 라고 생각도 해보았습니다. 그런데 이러한 flags에 대한 정보를 찾기가 힘들더군요. 이방법도 아닌거 같고...


특정 네트워크가 무선인지 유선인지 알 수 있는 방법이 있을까요 ? 


유형목

2014.11.12 23:31:36
*.200.239.210

SUSBSYSTEM 항목을 보면 알수 있네요.


무선랜은 SUBSYSTEMS=="sdio"

그냥 이더넷은 SUBSYSTEMS=="net"


으로 나오네요.

xoduddk123

2014.11.13 01:49:55
*.216.145.10

eth1의 경우에도 아랫부분은 사용하는 인터페이스가 SDIO인터페이스를  사용하는 무선랜이기 때문에 SDIO로 나오는것 같은데 맨위에는 동일하게 SUBSYSTEM 항목이 동일 하게 net이어서 구분하기 힘든 것 같습니다.

파일럿

2014.11.13 02:59:51
*.214.41.74

WiFi driver에서 network 장치 이름을 wlan0등으로 바꾸는게 쉽지 않을까요?

xoduddk123

2014.11.13 04:39:46
*.216.145.10

저도 다른 mlan0이나 wlan0이나 그런것들도 무선네트워크인것은 알고 있습니다. 

그런데 확실히 구분되게 현재 시스템이 있는 네트워크장치들은 하나씩 보면서 이건 무선 이건 유선 이렇게 알수있는 방법이 있지않을까해서요...   분명히 어디가에 그런정보가 있을거같기도 하고요 flags같기는 한데 .... ㅠㅠ 



배석헌

2014.11.15 04:40:34
*.236.10.19

iw (http://git.sipsolutions.net/iw.git/)

나 wireless tools 같은 툴을 참고하보세요.

$ iwconfig

eth0      no wireless extensions.


lo        no wireless extensions.


$ iw eth0

nl80211 not found

$ iw eth1



문철민

2014.12.02 00:38:53
*.37.242.22

cat /proc/net/wireless


하시면 무선 장비가 나옵니다

List of Articles
번호 제목 글쓴이 날짜 조회 수sort
6148 오드로이드 공구 구성품 관련 문의 [2] 이상우 2009-11-07 476
6147 [MFC]Bit Processor?? [1] 안드러오니 2010-02-02 476
6146 bluetooth device driver에 대한 질문입니다. [1] 김동래 2010-05-05 476
6145 application screen size OGeumDong Knife Ball 2010-05-07 476
6144 TV Out [1] 김주영 2010-05-14 476
6143 Android상에서 firmware upgrade [1] 파일럿 2010-05-15 476
6142 makefile 관련 질문입니다. [1] 마수리 2010-07-03 476
6141 Odroid-T의 소스를 받아볼 수 있을까요? [3] lived 2010-07-07 476
6140 app 실행 문제에 대한 로그.. file [1] 은재아빠 2010-11-08 476
6139 LCD 관련 문의 드립니다. [1] 조남희 2011-02-09 476
6138 device.c 퍼미션 수정.. [1] skean 2011-03-04 476
6137 이솝 MP2530F WinCE BSP 구해 봅니다... 에구릉 2011-08-18 476
6136 오드로이드 비스타용 드라이버 [2] day 2009-11-20 477
6135 6410 관련 초보 질문입니다. [1] 마린 2009-10-22 477
6134 파일시스템구축에 대해 [1] 우운용 2009-10-24 477
6133 오드로이드에서 Rootfs [1] 김성수 2010-03-27 477
6132 오드로이드에서 32bit 그래픽 사용 질문입니다. [1] 권도홍 2010-03-27 477
6131 s5pc100 & android-2.1 can't play 3gp file [1] stiff 2010-04-29 477
6130 이솝C100 회로도는 어디서 받나요? [1] 김장균 2010-05-08 477
6129 AESOP6410보드에서 SD메모리하고 관련된 Channel를 바꾸고 싶은데... 허경 2010-05-29 477

사용자 로그인