# HG changeset patch # User Prakash Jalan # Date 1394471390 25200 # Node ID 5e8e50b4459c15522140e326c46b75d2d2b6db83 # Parent 84e093c079e256ebbe22b97309aa13acb15af2c8 18301028 ptpd in {kernel, native} Zone may conflict with hw mode ptpd in global zone 18340629 ptpd needs a way to enable or disable logging diff -r 84e093c079e2 -r 5e8e50b4459c components/ptp/Solaris/ptp.sh --- a/components/ptp/Solaris/ptp.sh Fri Mar 07 17:02:45 2014 -0800 +++ b/components/ptp/Solaris/ptp.sh Mon Mar 10 10:09:50 2014 -0700 @@ -20,7 +20,7 @@ # CDDL HEADER END # # -# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. # # Standard prolog @@ -92,8 +92,9 @@ CMD_LINE_ARGS="$CMD_LINE_ARGS -y $SYNC_INTVL" fi +ENABLE_LOGGING="`get_prop enable_logging`" LOGFILE="`get_prop logfile`" -if [ -n "$LOGFILE" -a "$LOGFILE" != "/var/log/ptp.log" ]; then +if [ -n "$LOGFILE" -a "$ENABLE_LOGGING" = "true" ]; then CMD_LINE_ARGS="$CMD_LINE_ARGS -f $LOGFILE" fi diff -r 84e093c079e2 -r 5e8e50b4459c components/ptp/Solaris/ptp.xml --- a/components/ptp/Solaris/ptp.xml Fri Mar 07 17:02:45 2014 -0800 +++ b/components/ptp/Solaris/ptp.xml Mon Mar 10 10:09:50 2014 -0700 @@ -20,7 +20,7 @@ CDDL HEADER END - Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. NOTE: This service manifest is not editable; its contents will be overwritten by package or patch operations, including @@ -99,6 +99,7 @@ + + + PtpClock *ptpClock; + +@@ -615,8 +616,25 @@ + ); + } + ++Boolean ++is_zone(void) { ++ v12n_env_t *env; ++ Boolean is_zone = FALSE; ++ char *name; + ++ if ((env = v12n_get_current_env()) == NULL) ++ return (is_zone); + ++ name = v12n_get_env_prop(env, V12N_PROP_NAME); ++ if (name != NULL && strstr(name, "zone") != NULL) { ++ INFO("Inside %s\n", name); ++ is_zone = TRUE; ++ } ++ free(name); ++ v12n_free_env(env); ++ return (is_zone); ++} ++ + PtpClock * + ptpdStartup(int argc, char **argv, Integer16 * ret, RunTimeOpts * rtOpts) + { +@@ -632,6 +650,7 @@ + Boolean time_mode_specified = FALSE; + TimeMode default_time_mode; + Boolean use_hardware_assist = FALSE; ++ Boolean allow_inside_zone = FALSE; + Boolean is_error; + + dump_command_line_parameters(argc, argv); +@@ -643,7 +662,7 @@ + #endif + */ + +- const char *getopt_string = "?HgGWb:cCf:ST:dDPR:xO:tM:a:w:u:ehzl:o:i:n:N:y:m:v:r:s:p:q:Y:BjLV:XZK"; ++ const char *getopt_string = "?HgGWb:cCf:ST:dDPR:xO:tM:a:w:u:ehzl:o:i:n:N:y:m:v:r:s:p:q:Y:BjLV:XZKF"; + + /* parse command line arguments */ + while ((c = getopt(argc, argv, getopt_string)) != -1) { +@@ -831,6 +850,10 @@ + rtOpts->verboseStats = TRUE; + rtOpts->csvStats = TRUE; + break; ++ ++ case 'F': ++ allow_inside_zone = TRUE; ++ break; + case 'P': + rtOpts->displayPackets = TRUE; + break; +@@ -1181,6 +1204,13 @@ + rtOpts->time_mode = default_time_mode; + } + ++ /* If insize a zone, fail to start unless forced */ ++ if (is_zone() && !allow_inside_zone) { ++ ERROR("Not allowed to run inside a zone\n"); ++ *ret = 4; ++ return 0; ++ } ++ + ptpClock = (PtpClock *) calloc(1, sizeof(PtpClock)); + if (!ptpClock) { + PERROR("failed to allocate memory for protocol engine data"); diff -r 84e093c079e2 -r 5e8e50b4459c components/ptp/patches/02-enable_logging.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/components/ptp/patches/02-enable_logging.patch Mon Mar 10 10:09:50 2014 -0700 @@ -0,0 +1,19 @@ +18340629 ptpd needs a way to enable or disable logging + +Following patch adds the capability to enable or disable logging via SMF service + +diff -ur ptpd-2.2.0/src/ptpd2.8 /builds/pjalan/ptp-userland/components/ptp/ptpd-2.2.0/src/ptpd2.8 +--- ptpd-2.2.0/src/ptpd2.8 Mon Mar 10 01:46:23 2014 ++++ /builds/pjalan/ptp-userland/components/ptp/ptpd-2.2.0/src/ptpd2.8 Fri Mar 7 11:01:09 2014 +@@ -133,6 +133,11 @@ + A string specifying the location of the file used for + log output. The default is /var/log/ptp.log + .TP ++.BR config/enable_logging ++A boolean which when true, instructs ptpd to log ++synchronization and other related information in the file ++specified by config/logfile. Default value is false. ++.TP + .BR config/other_options + A string specifying other command line options mentioned + below to be passed to svc:/network/ptp:default at startup. diff -r 84e093c079e2 -r 5e8e50b4459c components/ptp/resolve.deps --- a/components/ptp/resolve.deps Fri Mar 07 17:02:45 2014 -0800 +++ b/components/ptp/resolve.deps Mon Mar 10 10:09:50 2014 -0700 @@ -1,4 +1,5 @@ shell/ksh93 system/core-os system/library +system/library/libv12n system/library/math