socsvn commit: r308213 - in soc2016/yuanxunzhang/head: sys/net usr.sbin/eaps
yuanxunzhang at FreeBSD.org
yuanxunzhang at FreeBSD.org
Mon Aug 22 20:37:12 UTC 2016
Author: yuanxunzhang
Date: Mon Aug 22 20:37:11 2016
New Revision: 308213
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308213
Log:
EAPS: implement add primary/secondary port interface
Modified:
soc2016/yuanxunzhang/head/sys/net/eaps.c
soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c
Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c
==============================================================================
--- soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Aug 22 20:22:12 2016 (r308212)
+++ soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Aug 22 20:37:11 2016 (r308213)
@@ -275,7 +275,7 @@
(void) strlcpy(es->ifname, sc->sc_ifp->if_xname, sizeof(sc->sc_ifp->if_xname));
EAPS_RUNLOCK(sc, &tracker);
- reutrn (0);
+ return (0);
}
int
@@ -285,7 +285,7 @@
EAPS_WLOCK(sc);
sc->sc_eaps.mode = es->mode;
EAPS_WUNLOCK(sc);
- reutrn (0);
+ return (0);
}
int
@@ -295,7 +295,7 @@
EAPS_WLOCK(sc);
sc->sc_eaps.priority = es->priority;
EAPS_WUNLOCK(sc);
- reutrn (0);
+ return (0);
}
int
@@ -305,7 +305,7 @@
sc->sc_eaps.hellotime = es->hellotime;
EAPS_WUNLOCK(sc);
- reutrn (0);
+ return (0);
}
int
@@ -315,7 +315,7 @@
sc->sc_eaps.failtime = es->failtime;
EAPS_WUNLOCK(sc);
- reutrn (0);
+ return (0);
}
int
@@ -323,29 +323,30 @@
{
int error = 0;
- char p_port[IFNAMSIZ] = NULL;
+ char p_port[IFNAMSIZ];
(void) strlcpy(p_port, es->p_port, sizeof(es->p_port));
struct rm_priotracker tracker;
EAPS_RLOCK(sc, &tracker);
// If the primary port has already used for secondary port, return error
- if (sc->sc_eaps.s_port == p_port) {
+ if (strcmp(sc->sc_eaps.s_port, p_port) == 0) {
return ENODEV;
}
+
EAPS_RUNLOCK(sc, &tracker);
EAPS_WLOCK(sc);
sc->sc_eaps.p_port = p_port
EAPS_WUNLOCK(sc);
- reutrn (0);
+ return (0);
}
int
set_eaps_secondary_port(struct eaps_softc *sc, struct eaps_state *es)
{
- reutrn (0);
+ return (0);
}
@@ -360,8 +361,8 @@
sc->sc_eaps.priority = EAPS_PRIORITY_NORMAL;
sc->sc_eaps.hellotime = EAPS_HELLO_TIME_DEFAULT;
sc->sc_eaps.failtime = EAPS_FAIL_TIME_DEFAULT;
- sc->sc_eaps.p_port = NULL;
- sc->sc_eaps.s_port = NULL;
+ sc->sc_eaps.p_port[0] = '\0'; //means empty
+ sc->sc_eaps.s_port[0] = '\0'; //means empty
EAPS_WUNLOCK(sc);
}
Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c
==============================================================================
--- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 22 20:22:12 2016 (r308212)
+++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 22 20:37:11 2016 (r308213)
@@ -242,14 +242,14 @@
printf("\thellotime: %d (milliseconds)\n", es.hellotime);
printf("\tfailtime: %d (milliseconds)\n", es.failtime);
- if (es.p_port == NULL)
+ if (es.p_port[0] == '\0')
{
printf("\tprimary port: not assigned\n");
} else {
printf("\tprimary port: %s\n", es.p_port);
}
- if (es.s_port == NULL)
+ if (es.s_port[0] == '\0')
{
printf("\tsecondary port: not assigned\n");
} else {
More information about the svn-soc-all
mailing list