OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

556 lines
16 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../open-iscsi/open-iscsi-2.0.873-upstream-fixes.patch
  5. # Copyright (C) 2013 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. From 71cd021b74a7094b5186a42bfe59a35e2fa66018 Mon Sep 17 00:00:00 2001
  17. From: Mike Christie <michaelc@cs.wisc.edu>
  18. Date: Wed, 5 Sep 2012 16:18:16 -0500
  19. Subject: [PATCH] iscsid: fix iscsid segfault during qla4xxx login
  20. If the kernel sends multiple ISCSI_KEVENT_CONN_LOGIN_STATE
  21. events for the same login event iscsid will segault.
  22. When we get a conn error we will set the r_stage to reopen, then when
  23. session_conn_process_login handles the first login event we set the r_stage
  24. to R_STAGE_NO_CHANGE. But then it looks like if we get a second login event
  25. r_stage is no_change and session_conn_process_login will run again and
  26. call mgmt_ipc_write_rsp on a bad qtask.
  27. ---
  28. usr/initiator.c | 5 ++++-
  29. 1 files changed, 4 insertions(+), 1 deletions(-)
  30. diff --git a/usr/initiator.c b/usr/initiator.c
  31. index 79ca32c..d475358 100644
  32. --- a/usr/initiator.c
  33. +++ b/usr/initiator.c
  34. @@ -993,7 +993,7 @@ static void session_scan_host(struct iscsi_session *session, int hostno,
  35. exit(0);
  36. } else if (pid > 0) {
  37. reap_inc();
  38. - if (qtask) {
  39. + if (qtask && qtask->mgmt_ipc_fd >= 0) {
  40. close(qtask->mgmt_ipc_fd);
  41. free(qtask);
  42. }
  43. @@ -1618,6 +1618,9 @@ static void session_conn_process_login(void *data)
  44. if (state == ISCSI_CONN_STATE_FREE)
  45. goto failed_login;
  46. + if (conn->state == ISCSI_CONN_STATE_LOGGED_IN)
  47. + return;
  48. +
  49. conn->state = ISCSI_CONN_STATE_LOGGED_IN;
  50. /*
  51. * ok we were in_login and now we got the notification that we are
  52. --
  53. 1.7.2.3
  54. From f0a8c95426d21413d9980d31740e193208e3280e Mon Sep 17 00:00:00 2001
  55. From: Eddie Wai <eddie.wai@broadcom.com>
  56. Date: Wed, 5 Sep 2012 14:14:20 -0700
  57. Subject: [PATCH] ISCSISTART: Bring up the corresponding network interface for iboot
  58. This is needed for the iSCSI offload boot.
  59. Snip from M. Christie:
  60. Note that we must bring up the interface before iface_setup_from_boot_context,
  61. because we will want iscsi_sysfs_get_host_no_from_hwaddress to be able to match
  62. a MAC to a iscsi host. For some bnx2i cards, the card has to be ifupd for the
  63. iscsi interface to have a MAC. If it is not ifupd we have seen MACs with all
  64. zeros or no iscsi_hosts on different cards.
  65. Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
  66. ---
  67. usr/iface.c | 4 ++++
  68. 1 files changed, 4 insertions(+), 0 deletions(-)
  69. diff --git a/usr/iface.c b/usr/iface.c
  70. index 3a9582e..4028e34 100644
  71. --- a/usr/iface.c
  72. +++ b/usr/iface.c
  73. @@ -917,6 +917,10 @@ int iface_setup_from_boot_context(struct iface_rec *iface,
  74. transport_name))
  75. t = iscsi_sysfs_get_transport_by_name(transport_name);
  76. + if (net_ifup_netdev(context->iface))
  77. + log_warning("Could not bring up netdev %s for boot",
  78. + context->iface);
  79. +
  80. hostno = iscsi_sysfs_get_host_no_from_hwaddress(context->mac,
  81. &rc);
  82. if (rc) {
  83. --
  84. 1.7.2.3
  85. From d81fd4903cebb1d00aa48b0718d20e34b00dfde1 Mon Sep 17 00:00:00 2001
  86. From: Mike Christie <michaelc@cs.wisc.edu>
  87. Date: Wed, 26 Sep 2012 21:19:39 -0500
  88. Subject: [PATCH] iscsi tools: fix compile error when OFFLOAD_BOOT_SUPPORT defined
  89. Fix compile error when OFFLOAD_BOOT_SUPPORT is defined and fix
  90. warning when it is defined.
  91. ---
  92. usr/iface.c | 3 ++-
  93. 1 files changed, 2 insertions(+), 1 deletions(-)
  94. diff --git a/usr/iface.c b/usr/iface.c
  95. index 4028e34..4f81a76 100644
  96. --- a/usr/iface.c
  97. +++ b/usr/iface.c
  98. @@ -894,7 +894,6 @@ int iface_setup_from_boot_context(struct iface_rec *iface,
  99. struct boot_context *context)
  100. {
  101. struct iscsi_transport *t = NULL;
  102. - char transport_name[ISCSI_TRANSPORT_NAME_MAXLEN];
  103. uint32_t hostno;
  104. if (strlen(context->initiatorname))
  105. @@ -910,6 +909,8 @@ int iface_setup_from_boot_context(struct iface_rec *iface,
  106. } else if (strlen(context->iface)) {
  107. /* this ifdef is only temp until distros and firmwares are updated */
  108. #ifdef OFFLOAD_BOOT_SUPPORTED
  109. + char transport_name[ISCSI_TRANSPORT_NAME_MAXLEN];
  110. + int rc;
  111. memset(transport_name, 0, ISCSI_TRANSPORT_NAME_MAXLEN);
  112. /* make sure offload driver is loaded */
  113. --
  114. 1.7.2.3
  115. From 13d08e79090421fbf67fd727aada487ea23ecc2d Mon Sep 17 00:00:00 2001
  116. From: Eddie Wai <eddie.wai@broadcom.com>
  117. Date: Thu, 27 Sep 2012 13:57:12 -0700
  118. Subject: [PATCH] ISCSID: Passing more net params from ibft to iface
  119. Added the passing of the vlan_id, subnet_mask, and gateway attributes
  120. from the ibft context to the iface struct for the connection request.
  121. Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
  122. ---
  123. usr/iface.c | 5 +++++
  124. 1 files changed, 5 insertions(+), 0 deletions(-)
  125. diff --git a/usr/iface.c b/usr/iface.c
  126. index 4f81a76..c86892e 100644
  127. --- a/usr/iface.c
  128. +++ b/usr/iface.c
  129. @@ -962,6 +962,11 @@ int iface_setup_from_boot_context(struct iface_rec *iface,
  130. sizeof(iface->hwaddress));
  131. strlcpy(iface->ipaddress, context->ipaddr,
  132. sizeof(iface->ipaddress));
  133. + iface->vlan_id = atoi(context->vlan);
  134. + strlcpy(iface->subnet_mask, context->mask,
  135. + sizeof(iface->subnet_mask));
  136. + strlcpy(iface->gateway, context->gateway,
  137. + sizeof(iface->gateway));
  138. log_debug(1, "iface " iface_fmt "\n", iface_str(iface));
  139. return 1;
  140. }
  141. --
  142. 1.7.2.3
  143. From 9dd181dcb1ca299cd82075b8e598fc57d87ee1c0 Mon Sep 17 00:00:00 2001
  144. From: Jim Ramsay <jim_ramsay@dell.com>
  145. Date: Wed, 3 Oct 2012 09:57:43 -0400
  146. Subject: [PATCH] iscsi tools: Convert '-r' argument to an integer before checking if it is a path
  147. If there is a file in the CWD named '1' and you were trying to run
  148. 'iscsiadm -m session -r 1 ...', the command would fail with "1 is not a
  149. directory".
  150. Root cause: The code that parses the -r option's argument tries lstat(2)
  151. first, falling back to atoi(3) only if lstat fails.
  152. This change inverts the order of checks, first with strtol(3) to see if
  153. the argument given is a positive integer, then falling back to lstat(2)
  154. only if it is not.
  155. Signed-off-by: Jim Ramsay <jim_ramsay@dell.com>
  156. ---
  157. usr/iscsi_sysfs.c | 17 +++++++++--------
  158. 1 files changed, 9 insertions(+), 8 deletions(-)
  159. diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
  160. index 123dde3..4015b35 100644
  161. --- a/usr/iscsi_sysfs.c
  162. +++ b/usr/iscsi_sysfs.c
  163. @@ -740,7 +740,7 @@ int iscsi_sysfs_session_has_leadconn(uint32_t sid)
  164. * /sys/devices/platform/hostH/sessionS/targetH:B:I
  165. * /sys/devices/platform/hostH/sessionS
  166. *
  167. - * return the sid S. If just the sid is passed in it will be covnerted
  168. + * return the sid S. If just the sid is passed in it will be converted
  169. * to a int.
  170. */
  171. int iscsi_sysfs_get_sid_from_path(char *session)
  172. @@ -748,15 +748,16 @@ int iscsi_sysfs_get_sid_from_path(char *session)
  173. struct sysfs_device *dev_parent, *dev;
  174. struct stat statb;
  175. char devpath[PATH_SIZE];
  176. + char *end;
  177. + int sid;
  178. +
  179. + sid = strtol(session, &end, 10);
  180. + if (sid > 0 && *session != '\0' && *end == '\0')
  181. + return sid;
  182. if (lstat(session, &statb)) {
  183. - log_debug(1, "Could not stat %s failed with %d",
  184. - session, errno);
  185. - if (index(session, '/')) {
  186. - log_error("%s is an invalid session path\n", session);
  187. - exit(1);
  188. - }
  189. - return atoi(session);
  190. + log_error("%s is an invalid session ID or path\n", session);
  191. + exit(1);
  192. }
  193. if (!S_ISDIR(statb.st_mode) && !S_ISLNK(statb.st_mode)) {
  194. --
  195. 1.7.2.3
  196. From 97db3db45c7e96888ea48a54ff19b7ff5d08cca6 Mon Sep 17 00:00:00 2001
  197. From: Andy Grover <agrover@redhat.com>
  198. Date: Wed, 24 Oct 2012 15:37:28 -0700
  199. Subject: [PATCH] Update README for removal of DBM requirement
  200. Removed in 093b1f4 (2006)
  201. Signed-off-by: Andy Grover <agrover@redhat.com>
  202. ---
  203. README | 23 ++++++++++++++---------
  204. 1 files changed, 14 insertions(+), 9 deletions(-)
  205. diff --git a/README b/README
  206. index 7364b2d..ec22098 100644
  207. --- a/README
  208. +++ b/README
  209. @@ -159,15 +159,20 @@ Usage: iscsid [OPTION]
  210. 5. Open-iSCSI Configuration Utility
  211. ===================================
  212. -Open-iSCSI persistent configuration is implemented as a DBM database
  213. -available on all Linux installations.
  214. -
  215. -The database contains two tables:
  216. -
  217. -- Discovery table (/etc/iscsi/send_targets);
  218. -- Node table (/etc/iscsi/nodes).
  219. -
  220. -The regular place for iSCSI database files: /etc/iscsi/nodes
  221. +Open-iSCSI persistent configuration is stored in a number of
  222. +directories under a configuration root directory, using a flat-file
  223. +format. This configuration root directory is /etc/iscsi by default,
  224. +but may also commonly be in /var/lib/iscsi.
  225. +
  226. +Configuration is contained in directories for:
  227. +
  228. +- nodes
  229. +- slp
  230. +- isns
  231. +- static
  232. +- fw
  233. +- send_targets
  234. +- ifaces
  235. The iscsiadm utility is a command-line tool to manage (update, delete,
  236. insert, query) the persistent database.
  237. --
  238. 1.7.2.3
  239. From 2d086a831dc16d10729d6fce17bed3ade3efd16c Mon Sep 17 00:00:00 2001
  240. From: Tomasz Torcz <tomek@pipebreaker.pl>
  241. Date: Wed, 28 Nov 2012 13:37:06 +0100
  242. Subject: [PATCH] iscsid,iscsiadm: fix abstract socket length in bind() call
  243. For abstract sockets, the addrlen parameter should be the actual
  244. length of socket's name. Otherwise socket gets padded with some
  245. number of NULs.
  246. ---
  247. usr/iscsid_req.c | 10 ++++++----
  248. usr/mgmt_ipc.c | 9 +++++----
  249. 2 files changed, 11 insertions(+), 8 deletions(-)
  250. diff --git a/usr/iscsid_req.c b/usr/iscsid_req.c
  251. index 0902011..1c4678d 100644
  252. --- a/usr/iscsid_req.c
  253. +++ b/usr/iscsid_req.c
  254. @@ -56,7 +56,7 @@ static void iscsid_startup(void)
  255. static int iscsid_connect(int *fd, int start_iscsid)
  256. {
  257. - int nsec;
  258. + int nsec, addr_len;
  259. struct sockaddr_un addr;
  260. *fd = socket(AF_LOCAL, SOCK_STREAM, 0);
  261. @@ -65,15 +65,17 @@ static int iscsid_connect(int *fd, int start_iscsid)
  262. return ISCSI_ERR_ISCSID_NOTCONN;
  263. }
  264. + addr_len = offsetof(struct sockaddr_un, sun_path) + strlen(ISCSIADM_NAMESPACE) + 1;
  265. +
  266. memset(&addr, 0, sizeof(addr));
  267. addr.sun_family = AF_LOCAL;
  268. - memcpy((char *) &addr.sun_path + 1, ISCSIADM_NAMESPACE,
  269. - strlen(ISCSIADM_NAMESPACE));
  270. + memcpy((char *) &addr.sun_path + 1, ISCSIADM_NAMESPACE, addr_len);
  271. +
  272. /*
  273. * Trying to connect with exponential backoff
  274. */
  275. for (nsec = 1; nsec <= MAXSLEEP; nsec <<= 1) {
  276. - if (connect(*fd, (struct sockaddr *) &addr, sizeof(addr)) == 0)
  277. + if (connect(*fd, (struct sockaddr *) &addr, addr_len) == 0)
  278. /* Connection established */
  279. return ISCSI_SUCCESS;
  280. diff --git a/usr/mgmt_ipc.c b/usr/mgmt_ipc.c
  281. index 5c39c2e..a1dafc9 100644
  282. --- a/usr/mgmt_ipc.c
  283. +++ b/usr/mgmt_ipc.c
  284. @@ -43,7 +43,7 @@
  285. int
  286. mgmt_ipc_listen(void)
  287. {
  288. - int fd, err;
  289. + int fd, err, addr_len;
  290. struct sockaddr_un addr;
  291. fd = socket(AF_LOCAL, SOCK_STREAM, 0);
  292. @@ -52,12 +52,13 @@ mgmt_ipc_listen(void)
  293. return fd;
  294. }
  295. + addr_len = offsetof(struct sockaddr_un, sun_path) + strlen(ISCSIADM_NAMESPACE) + 1;
  296. +
  297. memset(&addr, 0, sizeof(addr));
  298. addr.sun_family = AF_LOCAL;
  299. - memcpy((char *) &addr.sun_path + 1, ISCSIADM_NAMESPACE,
  300. - strlen(ISCSIADM_NAMESPACE));
  301. + memcpy((char *) &addr.sun_path + 1, ISCSIADM_NAMESPACE, addr_len);
  302. - if ((err = bind(fd, (struct sockaddr *) &addr, sizeof(addr))) < 0) {
  303. + if ((err = bind(fd, (struct sockaddr *) &addr, addr_len)) < 0 ) {
  304. log_error("Can not bind IPC socket");
  305. close(fd);
  306. return err;
  307. --
  308. 1.7.2.3
  309. From 5d0e19fcc1cea77a72647cf96c5d3d773e8ee277 Mon Sep 17 00:00:00 2001
  310. From: Tomasz Torcz <tomek@pipebreaker.pl>
  311. Date: Wed, 28 Nov 2012 13:37:07 +0100
  312. Subject: [PATCH] iscsid: implement systemd-compatible socket activation
  313. ---
  314. usr/mgmt_ipc.c | 29 +++++++++++++++++++++++++++++
  315. usr/mgmt_ipc.h | 1 +
  316. 2 files changed, 30 insertions(+), 0 deletions(-)
  317. diff --git a/usr/mgmt_ipc.c b/usr/mgmt_ipc.c
  318. index a1dafc9..87bd346 100644
  319. --- a/usr/mgmt_ipc.c
  320. +++ b/usr/mgmt_ipc.c
  321. @@ -39,6 +39,7 @@
  322. #define PEERUSER_MAX 64
  323. #define EXTMSG_MAX (64 * 1024)
  324. +#define SD_SOCKET_FDS_START 3
  325. int
  326. mgmt_ipc_listen(void)
  327. @@ -46,6 +47,12 @@ mgmt_ipc_listen(void)
  328. int fd, err, addr_len;
  329. struct sockaddr_un addr;
  330. + /* first check if we have fd handled by systemd */
  331. + fd = mgmt_ipc_systemd();
  332. + if (fd >= 0)
  333. + return fd;
  334. +
  335. + /* manually establish a socket */
  336. fd = socket(AF_LOCAL, SOCK_STREAM, 0);
  337. if (fd < 0) {
  338. log_error("Can not create IPC socket");
  339. @@ -73,6 +80,28 @@ mgmt_ipc_listen(void)
  340. return fd;
  341. }
  342. +int mgmt_ipc_systemd(void)
  343. +{
  344. + const char *env;
  345. +
  346. + env = getenv("LISTEN_PID");
  347. +
  348. + if (!env || (strtoul(env, NULL, 10) != getpid()))
  349. + return -EINVAL;
  350. +
  351. + env = getenv("LISTEN_FDS");
  352. +
  353. + if (!env)
  354. + return -EINVAL;
  355. +
  356. + if (strtoul(env, NULL, 10) != 1) {
  357. + log_error("Did not receive exactly one IPC socket from systemd");
  358. + return -EINVAL;
  359. + }
  360. +
  361. + return SD_SOCKET_FDS_START;
  362. +}
  363. +
  364. void
  365. mgmt_ipc_close(int fd)
  366. {
  367. diff --git a/usr/mgmt_ipc.h b/usr/mgmt_ipc.h
  368. index 7d8ce72..55972ed 100644
  369. --- a/usr/mgmt_ipc.h
  370. +++ b/usr/mgmt_ipc.h
  371. @@ -112,6 +112,7 @@ typedef int mgmt_ipc_fn_t(struct queue_task *);
  372. struct queue_task;
  373. void mgmt_ipc_write_rsp(struct queue_task *qtask, int err);
  374. int mgmt_ipc_listen(void);
  375. +int mgmt_ipc_systemd(void);
  376. void mgmt_ipc_close(int fd);
  377. void mgmt_ipc_handle(int accept_fd);
  378. --
  379. 1.7.2.3
  380. From c34e0bdcbafdb6f9304e1474d51fe1c789c5dea2 Mon Sep 17 00:00:00 2001
  381. From: Tomasz Torcz <tomek@pipebreaker.pl>
  382. Date: Wed, 28 Nov 2012 13:37:08 +0100
  383. Subject: [PATCH] iscsid: add example unit files for systemd
  384. MIME-Version: 1.0
  385. Content-Type: text/plain; charset=UTF-8
  386. Content-Transfer-Encoding: 8bit
  387. Those two units, based on the work by Jóhann B. Guðmundsson, exploit
  388. on-demand socket activation in iscsid.
  389. ---
  390. etc/systemd/iscsid.service | 13 +++++++++++++
  391. etc/systemd/iscsid.socket | 9 +++++++++
  392. 2 files changed, 22 insertions(+), 0 deletions(-)
  393. create mode 100644 etc/systemd/iscsid.service
  394. create mode 100644 etc/systemd/iscsid.socket
  395. diff --git a/etc/systemd/iscsid.service b/etc/systemd/iscsid.service
  396. new file mode 100644
  397. index 0000000..028e0b3
  398. --- /dev/null
  399. +++ b/etc/systemd/iscsid.service
  400. @@ -0,0 +1,13 @@
  401. +[Unit]
  402. +Description=Open-iSCSI
  403. +Documentation=man:iscsid(8) man:iscsiuio(8) man:iscsiadm(8)
  404. +After=network.target NetworkManager-wait-online.service iscsiuio.service tgtd.service targetcli.service
  405. +
  406. +[Service]
  407. +Type=forking
  408. +PIDFile=/var/run/iscsid.pid
  409. +ExecStart=/usr/sbin/iscsid
  410. +ExecStop=/sbin/iscsiadm -k 0 2
  411. +
  412. +[Install]
  413. +WantedBy=multi-user.target
  414. diff --git a/etc/systemd/iscsid.socket b/etc/systemd/iscsid.socket
  415. new file mode 100644
  416. index 0000000..832451d
  417. --- /dev/null
  418. +++ b/etc/systemd/iscsid.socket
  419. @@ -0,0 +1,9 @@
  420. +[Unit]
  421. +Description=Open-iSCSI iscsid Socket
  422. +Documentation=man:iscsid(8) man:iscsiuio(8) man:iscsiadm(8)
  423. +
  424. +[Socket]
  425. +ListenStream=@ISCSIADM_ABSTRACT_NAMESPACE
  426. +
  427. +[Install]
  428. +WantedBy=sockets.target
  429. --
  430. 1.7.2.3
  431. From a7afdf46c3193eb102cc6ec2a3b61e8d36794437 Mon Sep 17 00:00:00 2001
  432. From: Mike Christie <michaelc@cs.wisc.edu>
  433. Date: Fri, 14 Dec 2012 12:40:27 -0600
  434. Subject: [PATCH] iscsi tools: fix get_random_bytes error handling
  435. Bug report from Rahul:
  436. There seems to be a bug in function get_random_bytes(). I reported
  437. this earlier as well but somehow it didn't appear here.
  438. get_random_bytes(unsigned char *data, unsigned int length)
  439. {
  440. long r;
  441. unsigned n;
  442. int fd;
  443. fd = open("/dev/urandom", O_RDONLY);
  444. while (length > 0) {
  445. if (!fd || read(fd, &r, sizeof(long)) != -1) <<<< the condition is
  446. incorrect
  447. ---
  448. usr/auth.c | 8 ++++----
  449. 1 files changed, 4 insertions(+), 4 deletions(-)
  450. diff --git a/usr/auth.c b/usr/auth.c
  451. index c924545..4ff0425 100644
  452. --- a/usr/auth.c
  453. +++ b/usr/auth.c
  454. @@ -189,24 +189,24 @@ get_random_bytes(unsigned char *data, unsigned int length)
  455. long r;
  456. unsigned n;
  457. - int fd;
  458. + int fd, r_size = sizeof(r);
  459. fd = open("/dev/urandom", O_RDONLY);
  460. while (length > 0) {
  461. - if (!fd || read(fd, &r, sizeof(long)) != -1)
  462. + if (fd == -1 || read(fd, &r, r_size) != r_size)
  463. r = rand();
  464. r = r ^ (r >> 8);
  465. r = r ^ (r >> 4);
  466. n = r & 0x7;
  467. - if (!fd || read(fd, &r, sizeof(long)) != -1)
  468. + if (fd == -1 || read(fd, &r, r_size) != r_size)
  469. r = rand();
  470. r = r ^ (r >> 8);
  471. r = r ^ (r >> 5);
  472. n = (n << 3) | (r & 0x7);
  473. - if (!fd || read(fd, &r, sizeof(long)) != -1)
  474. + if (fd == -1 || read(fd, &r, r_size) != r_size)
  475. r = rand();
  476. r = r ^ (r >> 8);
  477. r = r ^ (r >> 5);
  478. --
  479. 1.7.2.3