svn commit: r288575 - head/sys/net
Hiroki Sato
hrs at FreeBSD.org
Sat Oct 3 09:15:24 UTC 2015
Author: hrs
Date: Sat Oct 3 09:15:23 2015
New Revision: 288575
URL: https://svnweb.freebsd.org/changeset/base/288575
Log:
Add IFCAP_LINKSTATE support.
Modified:
head/sys/net/if_gif.c
head/sys/net/if_gre.c
head/sys/net/if_me.c
Modified: head/sys/net/if_gif.c
==============================================================================
--- head/sys/net/if_gif.c Sat Oct 3 08:07:21 2015 (r288574)
+++ head/sys/net/if_gif.c Sat Oct 3 09:15:23 2015 (r288575)
@@ -197,6 +197,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)
@@ -1040,10 +1042,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);
}
@@ -1065,4 +1070,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: head/sys/net/if_gre.c
==============================================================================
--- head/sys/net/if_gre.c Sat Oct 3 08:07:21 2015 (r288574)
+++ head/sys/net/if_gre.c Sat Oct 3 09:15:23 2015 (r288575)
@@ -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: head/sys/net/if_me.c
==============================================================================
--- head/sys/net/if_me.c Sat Oct 3 08:07:21 2015 (r288574)
+++ head/sys/net/if_me.c Sat Oct 3 09:15:23 2015 (r288575)
@@ -192,6 +192,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();
@@ -376,8 +378,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);
}
@@ -395,6 +399,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
More information about the svn-src-head
mailing list