MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vlan_clone_match_ethervid

Function vlan_clone_match_ethervid

freebsd/net/if_vlan.c:922–952  ·  view source on GitHub ↗

* Check for . [. ...] style interface names. */

Source from the content-addressed store, hash-verified

920 * Check for <etherif>.<vlan>[.<vlan> ...] style interface names.
921 */
922static struct ifnet *
923vlan_clone_match_ethervid(const char *name, int *vidp)
924{
925 char ifname[IFNAMSIZ];
926 char *cp;
927 struct ifnet *ifp;
928 int vid;
929
930 strlcpy(ifname, name, IFNAMSIZ);
931 if ((cp = strrchr(ifname, '.')) == NULL)
932 return (NULL);
933 *cp = '\0';
934 if ((ifp = ifunit_ref(ifname)) == NULL)
935 return (NULL);
936 /* Parse VID. */
937 if (*++cp == '\0') {
938 if_rele(ifp);
939 return (NULL);
940 }
941 vid = 0;
942 for(; *cp >= '0' && *cp <= '9'; cp++)
943 vid = (vid * 10) + (*cp - '0');
944 if (*cp != '\0') {
945 if_rele(ifp);
946 return (NULL);
947 }
948 if (vidp != NULL)
949 *vidp = vid;
950
951 return (ifp);
952}
953
954static int
955vlan_clone_match(struct if_clone *ifc, const char *name)

Callers 2

vlan_clone_matchFunction · 0.85
vlan_clone_createFunction · 0.85

Calls 4

strrchrFunction · 0.85
ifunit_refFunction · 0.85
if_releFunction · 0.85
strlcpyFunction · 0.50

Tested by

no test coverage detected