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

안녕하세요.


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


제 상황은 이더넷드라이버랑 무선드라이버가 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
번호 제목 글쓴이 날짜 조회 수
6148 [directFB] 폰트 아웃라인 관련... [2] 프리챌 2014-12-04 891
6147 S5PC110 wince 관련 질문 [4] 고도리 2014-12-01 702
6146 i2c-1 포트로 두개의 슬레이브를 제어하려고합니다 질문좀요 [2] 문철민 2014-11-28 664
6145 full hd 동영상 재생 가능한 리눅스 기반 임베디드 보드가 어떤게 ... [2] 새삶 2014-11-26 866
6144 U-BOOT에 FW 올린 후 Data Abort 문제 질문드려요. [2] 신의발자국 2014-11-20 921
6143 디바이스 드라이버를 배포 하려면 소스상태로만 배포해야 하나요? [1] pedor11 2014-11-14 907
6142 NAND partition과 u-boot [1] 김진희 2014-11-14 911
6141 커널 uvc 드라이버 설정 및 usb캠 드라이버 질문입니다. [1] ice179 2014-11-14 1182
6140 Ramdisk와 initrd [1] 테크 2014-11-13 955
» 특정 네트워크 인터페이스가 무선인지 유선인지 알수있을까요? [6] xoduddk123 2014-11-11 1185
6138 wifi direct(wifi p2p)에서 채널별 감도 측정 방법 있을까요? [3] 톳끼아빠 2014-11-08 1472
6137 컴파일을 할때마다 Image랑 zImage용량이 바뀌는건 왜 그런것인가요? file [2] xoduddk123 2014-11-07 1233
6136 양산시에 Flash 메모리를 구울 때 [1] 어떤이의꿈 2014-11-05 1284
6135 전원에서 BEAD관련 질문 [1] SpecialCase 2014-11-05 1133
6134 Android touch Event?? [1] Supsupi 2014-11-03 1151
6133 sclk_uart0 ~ 4까지의 clock들의 주파수는 어떻게 알 수 있을까여? [2] 혜민아빠 2014-10-31 1156
6132 요즘… ARM9, ARM11로 개발할 경우는 어떻게 해야 합니까? [3] 오르다 2014-10-31 1383
6131 arm-linux-gnueabi/bin/ld 에러 관련.... [1] blue0sky 2014-10-31 1243
6130 android에서 serial APP을 개발하기 위해서 어떻게 하면 되는가요... [3] 김경식 2014-10-24 1432
6129 tvp5150 [4] 삐까삐까룸 2014-10-24 1254

사용자 로그인