Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F105304136
D38198.id115734.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D38198.id115734.diff
View Options
diff --git a/sys/net/if.c b/sys/net/if.c
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -4834,6 +4834,12 @@
return (0);
};
+int
+if_gettype(if_t ifp)
+{
+ return (ifp->if_type);
+}
+
#ifdef DDB
static void
if_show_ifnet(struct ifnet *ifp)
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -585,6 +585,7 @@
char *if_allocdescr(size_t sz, int malloc_flag);
void if_freedescr(char *descrbuf);
int if_getalloctype(const if_t ifp);
+int if_gettype(const if_t ifp);
int if_setdev(if_t ifp, void *dev);
int if_setdrvflagbits(if_t ifp, int if_setflags, int clear_flags);
int if_getdrvflags(const if_t ifp);
diff --git a/sys/net/if_vlan_var.h b/sys/net/if_vlan_var.h
--- a/sys/net/if_vlan_var.h
+++ b/sys/net/if_vlan_var.h
@@ -143,15 +143,15 @@
} while (0)
#define VLAN_TRUNKDEV(_ifp) \
- ((_ifp)->if_type == IFT_L2VLAN ? (*vlan_trunkdev_p)((_ifp)) : NULL)
+ (if_gettype(_ifp) == IFT_L2VLAN ? (*vlan_trunkdev_p)((_ifp)) : NULL)
#define VLAN_TAG(_ifp, _vid) \
- ((_ifp)->if_type == IFT_L2VLAN ? (*vlan_tag_p)((_ifp), (_vid)) : EINVAL)
+ (if_gettype(_ifp) == IFT_L2VLAN ? (*vlan_tag_p)((_ifp), (_vid)) : EINVAL)
#define VLAN_PCP(_ifp, _pcp) \
- ((_ifp)->if_type == IFT_L2VLAN ? (*vlan_pcp_p)((_ifp), (_pcp)) : EINVAL)
+ (if_gettype(_ifp) == IFT_L2VLAN ? (*vlan_pcp_p)((_ifp), (_pcp)) : EINVAL)
#define VLAN_COOKIE(_ifp) \
- ((_ifp)->if_type == IFT_L2VLAN ? (*vlan_cookie_p)((_ifp)) : NULL)
+ (if_gettype(_ifp) == IFT_L2VLAN ? (*vlan_cookie_p)((_ifp)) : NULL)
#define VLAN_SETCOOKIE(_ifp, _cookie) \
- ((_ifp)->if_type == IFT_L2VLAN ? \
+ (if_gettype(_ifp) == IFT_L2VLAN ? \
(*vlan_setcookie_p)((_ifp), (_cookie)) : EINVAL)
#define VLAN_DEVAT(_ifp, _vid) \
((_ifp)->if_vlantrunk != NULL ? (*vlan_devat_p)((_ifp), (_vid)) : NULL)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 15, 5:05 PM (21 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15414586
Default Alt Text
D38198.id115734.diff (1 KB)
Attached To
Mode
D38198: IfAPI: Add if_gettype() API and use it for vlan
Attached
Detach File
Event Timeline
Log In to Comment