Date: Wed, 4 Nov 2015 00:21:02 +0000 (UTC) From: Hiroki Sato <hrs@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r290347 - stable/10/sys/net Message-ID: <201511040021.tA40L2Y5033707@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hrs Date: Wed Nov 4 00:21:02 2015 New Revision: 290347 URL: https://svnweb.freebsd.org/changeset/base/290347 Log: MFC r288575: Add IFCAP_LINKSTATE support. Modified: stable/10/sys/net/if_gif.c stable/10/sys/net/if_gre.c stable/10/sys/net/if_me.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net/if_gif.c ============================================================================== --- stable/10/sys/net/if_gif.c Tue Nov 3 22:24:02 2015 (r290346) +++ stable/10/sys/net/if_gif.c Wed Nov 4 00:21:02 2015 (r290347) @@ -196,6 +196,8 @@ gif_clone_create(struct if_clone *ifc, i GIF2IFP(sc)->if_transmit = gif_transmit; GIF2IFP(sc)->if_qflush = gif_qflush; GIF2IFP(sc)->if_output = gif_output; + GIF2IFP(sc)->if_capabilities |= IFCAP_LINKSTATE; + GIF2IFP(sc)->if_capenable |= IFCAP_LINKSTATE; if_attach(GIF2IFP(sc)); bpfattach(GIF2IFP(sc), DLT_NULL, sizeof(u_int32_t)); if (ng_gif_attach_p != NULL) @@ -1038,10 +1040,13 @@ gif_set_tunnel(struct ifnet *ifp, struct #if defined(INET) || defined(INET6) bad: #endif - if (error == 0 && sc->gif_family != 0) + if (error == 0 && sc->gif_family != 0) { ifp->if_drv_flags |= IFF_DRV_RUNNING; - else + if_link_state_change(ifp, LINK_STATE_UP); + } else { ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + if_link_state_change(ifp, LINK_STATE_DOWN); + } return (error); } @@ -1063,4 +1068,5 @@ gif_delete_tunnel(struct ifnet *ifp) free(sc->gif_hdr, M_GIF); } ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + if_link_state_change(ifp, LINK_STATE_DOWN); } Modified: stable/10/sys/net/if_gre.c ============================================================================== --- stable/10/sys/net/if_gre.c Tue Nov 3 22:24:02 2015 (r290346) +++ stable/10/sys/net/if_gre.c Wed Nov 4 00:21:02 2015 (r290347) @@ -179,6 +179,8 @@ gre_clone_create(struct if_clone *ifc, i GRE2IFP(sc)->if_ioctl = gre_ioctl; GRE2IFP(sc)->if_transmit = gre_transmit; GRE2IFP(sc)->if_qflush = gre_qflush; + GRE2IFP(sc)->if_capabilities |= IFCAP_LINKSTATE; + GRE2IFP(sc)->if_capenable |= IFCAP_LINKSTATE; if_attach(GRE2IFP(sc)); bpfattach(GRE2IFP(sc), DLT_NULL, sizeof(u_int32_t)); GRE_LIST_LOCK(); @@ -648,8 +650,10 @@ gre_set_tunnel(struct ifnet *ifp, struct break; #endif } - if (error == 0) + if (error == 0) { ifp->if_drv_flags |= IFF_DRV_RUNNING; + if_link_state_change(ifp, LINK_STATE_UP); + } return (error); } @@ -668,6 +672,7 @@ gre_delete_tunnel(struct ifnet *ifp) free(sc->gre_hdr, M_GRE); } ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + if_link_state_change(ifp, LINK_STATE_DOWN); } int Modified: stable/10/sys/net/if_me.c ============================================================================== --- stable/10/sys/net/if_me.c Tue Nov 3 22:24:02 2015 (r290346) +++ stable/10/sys/net/if_me.c Wed Nov 4 00:21:02 2015 (r290347) @@ -193,6 +193,8 @@ me_clone_create(struct if_clone *ifc, in ME2IFP(sc)->if_ioctl = me_ioctl; ME2IFP(sc)->if_transmit = me_transmit; ME2IFP(sc)->if_qflush = me_qflush; + ME2IFP(sc)->if_capabilities |= IFCAP_LINKSTATE; + ME2IFP(sc)->if_capenable |= IFCAP_LINKSTATE; if_attach(ME2IFP(sc)); bpfattach(ME2IFP(sc), DLT_NULL, sizeof(u_int32_t)); ME_LIST_LOCK(); @@ -377,8 +379,10 @@ me_set_tunnel(struct ifnet *ifp, struct if (sc->me_ecookie == NULL) sc->me_ecookie = encap_attach_func(AF_INET, IPPROTO_MOBILE, me_encapcheck, &in_mobile_protosw, sc); - if (sc->me_ecookie != NULL) + if (sc->me_ecookie != NULL) { ifp->if_drv_flags |= IFF_DRV_RUNNING; + if_link_state_change(ifp, LINK_STATE_UP); + } return (0); } @@ -396,6 +400,7 @@ me_delete_tunnel(struct ifnet *ifp) sc->me_dst.s_addr = 0; ME_WUNLOCK(sc); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + if_link_state_change(ifp, LINK_STATE_DOWN); } static uint16_t
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511040021.tA40L2Y5033707>