Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Fix problems found in review by @infracaninophile
Lev Serebryakov committed 11 years ago
commit 5b179e00748680b8dc2cfabdeb8d264e0efd0083
parent 6f0a018
5 files changed +18 -21
modified docs/pkg.8
@@ -175,10 +175,10 @@ This overrides any value of
specified in the main configuration file.
.It Fl 4
.Nm
-
will use only IPv4 for fetching repository and packages.
+
will use IPv4 for fetching repository and packages.
.It Fl 6
.Nm
-
will use only IPv6 for fetching repository and packages.
+
will use IPv6 for fetching repository and packages.
.El
.\" ---------------------------------------------------------------------------
.Sh COMMANDS
modified docs/pkg.conf.5
@@ -266,10 +266,10 @@ How many workers are used for pkg-repo. If set to 0,
.Va hw.ncpu
is used.
Default: 0.
-
.It Cm USE_IP_VERSION: integer
+
.It Cm IP_VERSION: integer
Restrict network access to specified IP version.
-
Could be 0 (any), 4 or 6. Repositores or command line
-
options could override this setting.
+
Could be 4 for IPv4, 6 for IPv6 or any other value for system default.
+
Repositories or command line options could override this setting.
Default: 0.
.El
.Sh REPOSITORY CONFIGURATION
@@ -318,10 +318,11 @@ This should be set to a path containing public key for this repository
only. (default: NONE)
.It Cm FINGERPRINTS: string
This should be set to a path containing known signatures for the repository.
-
.It Cm USE_IP_VERSION: integer
+
.It Cm IP_VERSION: integer
Restrict network access to specified IP version.
-
Could be 0 (any), 4 or 6. This option override global setting with same name
-
and could be overwritten by command line option.
+
Could be 4 for IPv4, 6 for IPv6 or any other value for system default.
+
This option overrides the global setting with the same name and can be
+
overwritten by a command line option.
Default: 0.
.El
.El
modified libpkg/pkg_config.c
@@ -318,7 +318,7 @@ static struct config_entry c[] = {
	},
	{
		PKG_INT,
-
		"USE_IP_VERSION",
+
		"IP_VERSION",
		"0",
		"Restrict network access to IPv4 or IPv6 only"
	}
@@ -502,7 +502,7 @@ add_repo(const ucl_object_t *obj, struct pkg_repo *r, const char *rname, pkg_ini
				return;
			}
			type = ucl_object_tostring(cur);
-
		} else if (strcasecmp(key, "use_ip_version") == 0) {
+
		} else if (strcasecmp(key, "ip_version") == 0) {
			if (cur->type != UCL_INT) {
				pkg_emit_error("Expecting a integer for the "
					"'%s' key of the '%s' repo",
@@ -510,12 +510,8 @@ add_repo(const ucl_object_t *obj, struct pkg_repo *r, const char *rname, pkg_ini
				return;
			}
			use_ipvx = ucl_object_toint(cur);
-
			if (use_ipvx != 0 && use_ipvx != 4 && use_ipvx != 6) {
-
				pkg_emit_error("Expecting a 0, 4 or 6 for the "
-
					"'%s' key of the '%s' repo",
-
					key, rname);
-
				return;
-
			}
+
			if (use_ipvx != 4 && use_ipvx != 6)
+
				use_ipvx = 0;
		}
	}

@@ -565,8 +561,8 @@ add_repo(const ucl_object_t *obj, struct pkg_repo *r, const char *rname, pkg_ini
	else if ((flags & PKG_INIT_FLAG_USE_IPV6) == PKG_INIT_FLAG_USE_IPV6)
		use_ipvx = 6;

-
	if (use_ipvx == 0)
-
		use_ipvx = pkg_object_int(pkg_config_get("USE_IP_VERSION"));
+
	if (use_ipvx != 4 && use_ipvx != 6)
+
		use_ipvx = pkg_object_int(pkg_config_get("IP_VERSION"));

	if (use_ipvx == 4)
		r->flags = REPO_FLAGS_USE_IPV4;
modified src/main.c
@@ -181,8 +181,8 @@ usage(const char *conffile, const char *reposdir, FILE *out, enum pkg_usage_reas
		fprintf(out, "\t%-15s%s\n", "-v", "Display pkg(8) version");
		fprintf(out, "\t%-15s%s\n\n", "-N", "Test if pkg(8) is activated and avoid auto-activation");
		fprintf(out, "\t%-15s%s\n\n", "-o", "Override configuration option from the command line");
-
		fprintf(out, "\t%-15s%s\n", "-4", "Use only IPv4");
-
		fprintf(out, "\t%-15s%s\n", "-6", "Use only IPv6");
+
		fprintf(out, "\t%-15s%s\n", "-4", "Only use IPv4");
+
		fprintf(out, "\t%-15s%s\n", "-6", "Only use IPv6");
		fprintf(out, "Commands supported:\n");

		for (i = 0; i < cmd_len; i++)
modified src/pkg.conf.sample
@@ -49,7 +49,7 @@
#SAT_SOLVER = "";
#RUN_SCRIPTS = true;
#CASE_SENSITIVE_MATCH = false;
-
#USE_IP_VERSION=0
+
#IP_VERSION = 0

# Sample alias settings
ALIAS              : {