On Tue, Jan 24, 2017 at 11:39 AM, Sriram V <vshrir...@gmail.com> wrote: > Hello, > > Apologies in case, this is not the right list of this question. > > I wanted to check, How can i find out if a network status has changed > > 1. How can the user application find out if the link status has changed?
There are some flags per netdevice for its link status, IFF_LOWER_UP etc., they are sent to user-space via rtnetlink message, ->ifi_flags. > 2. what changes do i need to add in the driver to indicate to the user > applications that ethernet cable has been plugged in or unplugged. > Probably nothing but calling netif_carrier_on/off() API's. > 3. How should a user application know the status change (Should the > userapp poll on the interface/is there an uevent interface to indicate > the link status change) > It needs to subscribe to the rtnetlink group RTNLGRP_LINK to receive the broadcasts from kernel.