ip_options.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662
  1. /*
  2. * INET An implementation of the TCP/IP protocol suite for the LINUX
  3. * operating system. INET is implemented using the BSD Socket
  4. * interface as the means of communication with the user level.
  5. *
  6. * The options processing module for ip.c
  7. *
  8. * Authors: A.N.Kuznetsov
  9. *
  10. */
  11. #define pr_fmt(fmt) "IPv4: " fmt
  12. #include <linux/capability.h>
  13. #include <linux/module.h>
  14. #include <linux/slab.h>
  15. #include <linux/types.h>
  16. #include <asm/uaccess.h>
  17. #include <asm/unaligned.h>
  18. #include <linux/skbuff.h>
  19. #include <linux/ip.h>
  20. #include <linux/icmp.h>
  21. #include <linux/netdevice.h>
  22. #include <linux/rtnetlink.h>
  23. #include <net/sock.h>
  24. #include <net/ip.h>
  25. #include <net/icmp.h>
  26. #include <net/route.h>
  27. #include <net/cipso_ipv4.h>
  28. #include <net/ip_fib.h>
  29. /*
  30. * Write options to IP header, record destination address to
  31. * source route option, address of outgoing interface
  32. * (we should already know it, so that this function is allowed be
  33. * called only after routing decision) and timestamp,
  34. * if we originate this datagram.
  35. *
  36. * daddr is real destination address, next hop is recorded in IP header.
  37. * saddr is address of outgoing interface.
  38. */
  39. void ip_options_build(struct sk_buff *skb, struct ip_options *opt,
  40. __be32 daddr, struct rtable *rt, int is_frag)
  41. {
  42. unsigned char *iph = skb_network_header(skb);
  43. memcpy(&(IPCB(skb)->opt), opt, sizeof(struct ip_options));
  44. memcpy(iph+sizeof(struct iphdr), opt->__data, opt->optlen);
  45. opt = &(IPCB(skb)->opt);
  46. if (opt->srr)
  47. memcpy(iph+opt->srr+iph[opt->srr+1]-4, &daddr, 4);
  48. if (!is_frag) {
  49. if (opt->rr_needaddr)
  50. ip_rt_get_source(iph+opt->rr+iph[opt->rr+2]-5, skb, rt);
  51. if (opt->ts_needaddr)
  52. ip_rt_get_source(iph+opt->ts+iph[opt->ts+2]-9, skb, rt);
  53. if (opt->ts_needtime) {
  54. __be32 midtime;
  55. midtime = inet_current_timestamp();
  56. memcpy(iph+opt->ts+iph[opt->ts+2]-5, &midtime, 4);
  57. }
  58. return;
  59. }
  60. if (opt->rr) {
  61. memset(iph+opt->rr, IPOPT_NOP, iph[opt->rr+1]);
  62. opt->rr = 0;
  63. opt->rr_needaddr = 0;
  64. }
  65. if (opt->ts) {
  66. memset(iph+opt->ts, IPOPT_NOP, iph[opt->ts+1]);
  67. opt->ts = 0;
  68. opt->ts_needaddr = opt->ts_needtime = 0;
  69. }
  70. }
  71. /*
  72. * Provided (sopt, skb) points to received options,
  73. * build in dopt compiled option set appropriate for answering.
  74. * i.e. invert SRR option, copy anothers,
  75. * and grab room in RR/TS options.
  76. *
  77. * NOTE: dopt cannot point to skb.
  78. */
  79. int __ip_options_echo(struct ip_options *dopt, struct sk_buff *skb,
  80. const struct ip_options *sopt)
  81. {
  82. unsigned char *sptr, *dptr;
  83. int soffset, doffset;
  84. int optlen;
  85. memset(dopt, 0, sizeof(struct ip_options));
  86. if (sopt->optlen == 0)
  87. return 0;
  88. sptr = skb_network_header(skb);
  89. dptr = dopt->__data;
  90. if (sopt->rr) {
  91. optlen = sptr[sopt->rr+1];
  92. soffset = sptr[sopt->rr+2];
  93. dopt->rr = dopt->optlen + sizeof(struct iphdr);
  94. memcpy(dptr, sptr+sopt->rr, optlen);
  95. if (sopt->rr_needaddr && soffset <= optlen) {
  96. if (soffset + 3 > optlen)
  97. return -EINVAL;
  98. dptr[2] = soffset + 4;
  99. dopt->rr_needaddr = 1;
  100. }
  101. dptr += optlen;
  102. dopt->optlen += optlen;
  103. }
  104. if (sopt->ts) {
  105. optlen = sptr[sopt->ts+1];
  106. soffset = sptr[sopt->ts+2];
  107. dopt->ts = dopt->optlen + sizeof(struct iphdr);
  108. memcpy(dptr, sptr+sopt->ts, optlen);
  109. if (soffset <= optlen) {
  110. if (sopt->ts_needaddr) {
  111. if (soffset + 3 > optlen)
  112. return -EINVAL;
  113. dopt->ts_needaddr = 1;
  114. soffset += 4;
  115. }
  116. if (sopt->ts_needtime) {
  117. if (soffset + 3 > optlen)
  118. return -EINVAL;
  119. if ((dptr[3]&0xF) != IPOPT_TS_PRESPEC) {
  120. dopt->ts_needtime = 1;
  121. soffset += 4;
  122. } else {
  123. dopt->ts_needtime = 0;
  124. if (soffset + 7 <= optlen) {
  125. __be32 addr;
  126. memcpy(&addr, dptr+soffset-1, 4);
  127. if (inet_addr_type(dev_net(skb_dst(skb)->dev), addr) != RTN_UNICAST) {
  128. dopt->ts_needtime = 1;
  129. soffset += 8;
  130. }
  131. }
  132. }
  133. }
  134. dptr[2] = soffset;
  135. }
  136. dptr += optlen;
  137. dopt->optlen += optlen;
  138. }
  139. if (sopt->srr) {
  140. unsigned char *start = sptr+sopt->srr;
  141. __be32 faddr;
  142. optlen = start[1];
  143. soffset = start[2];
  144. doffset = 0;
  145. if (soffset > optlen)
  146. soffset = optlen + 1;
  147. soffset -= 4;
  148. if (soffset > 3) {
  149. memcpy(&faddr, &start[soffset-1], 4);
  150. for (soffset -= 4, doffset = 4; soffset > 3; soffset -= 4, doffset += 4)
  151. memcpy(&dptr[doffset-1], &start[soffset-1], 4);
  152. /*
  153. * RFC1812 requires to fix illegal source routes.
  154. */
  155. if (memcmp(&ip_hdr(skb)->saddr,
  156. &start[soffset + 3], 4) == 0)
  157. doffset -= 4;
  158. }
  159. if (doffset > 3) {
  160. __be32 daddr = fib_compute_spec_dst(skb);
  161. memcpy(&start[doffset-1], &daddr, 4);
  162. dopt->faddr = faddr;
  163. dptr[0] = start[0];
  164. dptr[1] = doffset+3;
  165. dptr[2] = 4;
  166. dptr += doffset+3;
  167. dopt->srr = dopt->optlen + sizeof(struct iphdr);
  168. dopt->optlen += doffset+3;
  169. dopt->is_strictroute = sopt->is_strictroute;
  170. }
  171. }
  172. if (sopt->cipso) {
  173. optlen = sptr[sopt->cipso+1];
  174. dopt->cipso = dopt->optlen+sizeof(struct iphdr);
  175. memcpy(dptr, sptr+sopt->cipso, optlen);
  176. dptr += optlen;
  177. dopt->optlen += optlen;
  178. }
  179. while (dopt->optlen & 3) {
  180. *dptr++ = IPOPT_END;
  181. dopt->optlen++;
  182. }
  183. return 0;
  184. }
  185. /*
  186. * Options "fragmenting", just fill options not
  187. * allowed in fragments with NOOPs.
  188. * Simple and stupid 8), but the most efficient way.
  189. */
  190. void ip_options_fragment(struct sk_buff *skb)
  191. {
  192. unsigned char *optptr = skb_network_header(skb) + sizeof(struct iphdr);
  193. struct ip_options *opt = &(IPCB(skb)->opt);
  194. int l = opt->optlen;
  195. int optlen;
  196. while (l > 0) {
  197. switch (*optptr) {
  198. case IPOPT_END:
  199. return;
  200. case IPOPT_NOOP:
  201. l--;
  202. optptr++;
  203. continue;
  204. }
  205. optlen = optptr[1];
  206. if (optlen < 2 || optlen > l)
  207. return;
  208. if (!IPOPT_COPIED(*optptr))
  209. memset(optptr, IPOPT_NOOP, optlen);
  210. l -= optlen;
  211. optptr += optlen;
  212. }
  213. opt->ts = 0;
  214. opt->rr = 0;
  215. opt->rr_needaddr = 0;
  216. opt->ts_needaddr = 0;
  217. opt->ts_needtime = 0;
  218. }
  219. /* helper used by ip_options_compile() to call fib_compute_spec_dst()
  220. * at most one time.
  221. */
  222. static void spec_dst_fill(__be32 *spec_dst, struct sk_buff *skb)
  223. {
  224. if (*spec_dst == htonl(INADDR_ANY))
  225. *spec_dst = fib_compute_spec_dst(skb);
  226. }
  227. /*
  228. * Verify options and fill pointers in struct options.
  229. * Caller should clear *opt, and set opt->data.
  230. * If opt == NULL, then skb->data should point to IP header.
  231. */
  232. int ip_options_compile(struct net *net,
  233. struct ip_options *opt, struct sk_buff *skb)
  234. {
  235. __be32 spec_dst = htonl(INADDR_ANY);
  236. unsigned char *pp_ptr = NULL;
  237. struct rtable *rt = NULL;
  238. unsigned char *optptr;
  239. unsigned char *iph;
  240. int optlen, l;
  241. if (skb) {
  242. rt = skb_rtable(skb);
  243. optptr = (unsigned char *)&(ip_hdr(skb)[1]);
  244. } else
  245. optptr = opt->__data;
  246. iph = optptr - sizeof(struct iphdr);
  247. for (l = opt->optlen; l > 0; ) {
  248. switch (*optptr) {
  249. case IPOPT_END:
  250. for (optptr++, l--; l > 0; optptr++, l--) {
  251. if (*optptr != IPOPT_END) {
  252. *optptr = IPOPT_END;
  253. opt->is_changed = 1;
  254. }
  255. }
  256. goto eol;
  257. case IPOPT_NOOP:
  258. l--;
  259. optptr++;
  260. continue;
  261. }
  262. if (unlikely(l < 2)) {
  263. pp_ptr = optptr;
  264. goto error;
  265. }
  266. optlen = optptr[1];
  267. if (optlen < 2 || optlen > l) {
  268. pp_ptr = optptr;
  269. goto error;
  270. }
  271. switch (*optptr) {
  272. case IPOPT_SSRR:
  273. case IPOPT_LSRR:
  274. if (optlen < 3) {
  275. pp_ptr = optptr + 1;
  276. goto error;
  277. }
  278. if (optptr[2] < 4) {
  279. pp_ptr = optptr + 2;
  280. goto error;
  281. }
  282. /* NB: cf RFC-1812 5.2.4.1 */
  283. if (opt->srr) {
  284. pp_ptr = optptr;
  285. goto error;
  286. }
  287. if (!skb) {
  288. if (optptr[2] != 4 || optlen < 7 || ((optlen-3) & 3)) {
  289. pp_ptr = optptr + 1;
  290. goto error;
  291. }
  292. memcpy(&opt->faddr, &optptr[3], 4);
  293. if (optlen > 7)
  294. memmove(&optptr[3], &optptr[7], optlen-7);
  295. }
  296. opt->is_strictroute = (optptr[0] == IPOPT_SSRR);
  297. opt->srr = optptr - iph;
  298. break;
  299. case IPOPT_RR:
  300. if (opt->rr) {
  301. pp_ptr = optptr;
  302. goto error;
  303. }
  304. if (optlen < 3) {
  305. pp_ptr = optptr + 1;
  306. goto error;
  307. }
  308. if (optptr[2] < 4) {
  309. pp_ptr = optptr + 2;
  310. goto error;
  311. }
  312. if (optptr[2] <= optlen) {
  313. if (optptr[2]+3 > optlen) {
  314. pp_ptr = optptr + 2;
  315. goto error;
  316. }
  317. if (rt) {
  318. spec_dst_fill(&spec_dst, skb);
  319. memcpy(&optptr[optptr[2]-1], &spec_dst, 4);
  320. opt->is_changed = 1;
  321. }
  322. optptr[2] += 4;
  323. opt->rr_needaddr = 1;
  324. }
  325. opt->rr = optptr - iph;
  326. break;
  327. case IPOPT_TIMESTAMP:
  328. if (opt->ts) {
  329. pp_ptr = optptr;
  330. goto error;
  331. }
  332. if (optlen < 4) {
  333. pp_ptr = optptr + 1;
  334. goto error;
  335. }
  336. if (optptr[2] < 5) {
  337. pp_ptr = optptr + 2;
  338. goto error;
  339. }
  340. if (optptr[2] <= optlen) {
  341. unsigned char *timeptr = NULL;
  342. if (optptr[2]+3 > optlen) {
  343. pp_ptr = optptr + 2;
  344. goto error;
  345. }
  346. switch (optptr[3]&0xF) {
  347. case IPOPT_TS_TSONLY:
  348. if (skb)
  349. timeptr = &optptr[optptr[2]-1];
  350. opt->ts_needtime = 1;
  351. optptr[2] += 4;
  352. break;
  353. case IPOPT_TS_TSANDADDR:
  354. if (optptr[2]+7 > optlen) {
  355. pp_ptr = optptr + 2;
  356. goto error;
  357. }
  358. if (rt) {
  359. spec_dst_fill(&spec_dst, skb);
  360. memcpy(&optptr[optptr[2]-1], &spec_dst, 4);
  361. timeptr = &optptr[optptr[2]+3];
  362. }
  363. opt->ts_needaddr = 1;
  364. opt->ts_needtime = 1;
  365. optptr[2] += 8;
  366. break;
  367. case IPOPT_TS_PRESPEC:
  368. if (optptr[2]+7 > optlen) {
  369. pp_ptr = optptr + 2;
  370. goto error;
  371. }
  372. {
  373. __be32 addr;
  374. memcpy(&addr, &optptr[optptr[2]-1], 4);
  375. if (inet_addr_type(net, addr) == RTN_UNICAST)
  376. break;
  377. if (skb)
  378. timeptr = &optptr[optptr[2]+3];
  379. }
  380. opt->ts_needtime = 1;
  381. optptr[2] += 8;
  382. break;
  383. default:
  384. if (!skb && !ns_capable(net->user_ns, CAP_NET_RAW)) {
  385. pp_ptr = optptr + 3;
  386. goto error;
  387. }
  388. break;
  389. }
  390. if (timeptr) {
  391. __be32 midtime;
  392. midtime = inet_current_timestamp();
  393. memcpy(timeptr, &midtime, 4);
  394. opt->is_changed = 1;
  395. }
  396. } else if ((optptr[3]&0xF) != IPOPT_TS_PRESPEC) {
  397. unsigned int overflow = optptr[3]>>4;
  398. if (overflow == 15) {
  399. pp_ptr = optptr + 3;
  400. goto error;
  401. }
  402. if (skb) {
  403. optptr[3] = (optptr[3]&0xF)|((overflow+1)<<4);
  404. opt->is_changed = 1;
  405. }
  406. }
  407. opt->ts = optptr - iph;
  408. break;
  409. case IPOPT_RA:
  410. if (optlen < 4) {
  411. pp_ptr = optptr + 1;
  412. goto error;
  413. }
  414. if (optptr[2] == 0 && optptr[3] == 0)
  415. opt->router_alert = optptr - iph;
  416. break;
  417. case IPOPT_CIPSO:
  418. if ((!skb && !ns_capable(net->user_ns, CAP_NET_RAW)) || opt->cipso) {
  419. pp_ptr = optptr;
  420. goto error;
  421. }
  422. opt->cipso = optptr - iph;
  423. if (cipso_v4_validate(skb, &optptr)) {
  424. pp_ptr = optptr;
  425. goto error;
  426. }
  427. break;
  428. case IPOPT_SEC:
  429. case IPOPT_SID:
  430. default:
  431. if (!skb && !ns_capable(net->user_ns, CAP_NET_RAW)) {
  432. pp_ptr = optptr;
  433. goto error;
  434. }
  435. break;
  436. }
  437. l -= optlen;
  438. optptr += optlen;
  439. }
  440. eol:
  441. if (!pp_ptr)
  442. return 0;
  443. error:
  444. if (skb) {
  445. icmp_send(skb, ICMP_PARAMETERPROB, 0, htonl((pp_ptr-iph)<<24));
  446. }
  447. return -EINVAL;
  448. }
  449. EXPORT_SYMBOL(ip_options_compile);
  450. /*
  451. * Undo all the changes done by ip_options_compile().
  452. */
  453. void ip_options_undo(struct ip_options *opt)
  454. {
  455. if (opt->srr) {
  456. unsigned char *optptr = opt->__data+opt->srr-sizeof(struct iphdr);
  457. memmove(optptr+7, optptr+3, optptr[1]-7);
  458. memcpy(optptr+3, &opt->faddr, 4);
  459. }
  460. if (opt->rr_needaddr) {
  461. unsigned char *optptr = opt->__data+opt->rr-sizeof(struct iphdr);
  462. optptr[2] -= 4;
  463. memset(&optptr[optptr[2]-1], 0, 4);
  464. }
  465. if (opt->ts) {
  466. unsigned char *optptr = opt->__data+opt->ts-sizeof(struct iphdr);
  467. if (opt->ts_needtime) {
  468. optptr[2] -= 4;
  469. memset(&optptr[optptr[2]-1], 0, 4);
  470. if ((optptr[3]&0xF) == IPOPT_TS_PRESPEC)
  471. optptr[2] -= 4;
  472. }
  473. if (opt->ts_needaddr) {
  474. optptr[2] -= 4;
  475. memset(&optptr[optptr[2]-1], 0, 4);
  476. }
  477. }
  478. }
  479. static struct ip_options_rcu *ip_options_get_alloc(const int optlen)
  480. {
  481. return kzalloc(sizeof(struct ip_options_rcu) + ((optlen + 3) & ~3),
  482. GFP_KERNEL);
  483. }
  484. static int ip_options_get_finish(struct net *net, struct ip_options_rcu **optp,
  485. struct ip_options_rcu *opt, int optlen)
  486. {
  487. while (optlen & 3)
  488. opt->opt.__data[optlen++] = IPOPT_END;
  489. opt->opt.optlen = optlen;
  490. if (optlen && ip_options_compile(net, &opt->opt, NULL)) {
  491. kfree(opt);
  492. return -EINVAL;
  493. }
  494. kfree(*optp);
  495. *optp = opt;
  496. return 0;
  497. }
  498. int ip_options_get_from_user(struct net *net, struct ip_options_rcu **optp,
  499. unsigned char __user *data, int optlen)
  500. {
  501. struct ip_options_rcu *opt = ip_options_get_alloc(optlen);
  502. if (!opt)
  503. return -ENOMEM;
  504. if (optlen && copy_from_user(opt->opt.__data, data, optlen)) {
  505. kfree(opt);
  506. return -EFAULT;
  507. }
  508. return ip_options_get_finish(net, optp, opt, optlen);
  509. }
  510. int ip_options_get(struct net *net, struct ip_options_rcu **optp,
  511. unsigned char *data, int optlen)
  512. {
  513. struct ip_options_rcu *opt = ip_options_get_alloc(optlen);
  514. if (!opt)
  515. return -ENOMEM;
  516. if (optlen)
  517. memcpy(opt->opt.__data, data, optlen);
  518. return ip_options_get_finish(net, optp, opt, optlen);
  519. }
  520. void ip_forward_options(struct sk_buff *skb)
  521. {
  522. struct ip_options *opt = &(IPCB(skb)->opt);
  523. unsigned char *optptr;
  524. struct rtable *rt = skb_rtable(skb);
  525. unsigned char *raw = skb_network_header(skb);
  526. if (opt->rr_needaddr) {
  527. optptr = (unsigned char *)raw + opt->rr;
  528. ip_rt_get_source(&optptr[optptr[2]-5], skb, rt);
  529. opt->is_changed = 1;
  530. }
  531. if (opt->srr_is_hit) {
  532. int srrptr, srrspace;
  533. optptr = raw + opt->srr;
  534. for ( srrptr = optptr[2], srrspace = optptr[1];
  535. srrptr <= srrspace;
  536. srrptr += 4
  537. ) {
  538. if (srrptr + 3 > srrspace)
  539. break;
  540. if (memcmp(&opt->nexthop, &optptr[srrptr-1], 4) == 0)
  541. break;
  542. }
  543. if (srrptr + 3 <= srrspace) {
  544. opt->is_changed = 1;
  545. ip_hdr(skb)->daddr = opt->nexthop;
  546. ip_rt_get_source(&optptr[srrptr-1], skb, rt);
  547. optptr[2] = srrptr+4;
  548. } else {
  549. net_crit_ratelimited("%s(): Argh! Destination lost!\n",
  550. __func__);
  551. }
  552. if (opt->ts_needaddr) {
  553. optptr = raw + opt->ts;
  554. ip_rt_get_source(&optptr[optptr[2]-9], skb, rt);
  555. opt->is_changed = 1;
  556. }
  557. }
  558. if (opt->is_changed) {
  559. opt->is_changed = 0;
  560. ip_send_check(ip_hdr(skb));
  561. }
  562. }
  563. int ip_options_rcv_srr(struct sk_buff *skb)
  564. {
  565. struct ip_options *opt = &(IPCB(skb)->opt);
  566. int srrspace, srrptr;
  567. __be32 nexthop;
  568. struct iphdr *iph = ip_hdr(skb);
  569. unsigned char *optptr = skb_network_header(skb) + opt->srr;
  570. struct rtable *rt = skb_rtable(skb);
  571. struct rtable *rt2;
  572. unsigned long orefdst;
  573. int err;
  574. if (!rt)
  575. return 0;
  576. if (skb->pkt_type != PACKET_HOST)
  577. return -EINVAL;
  578. if (rt->rt_type == RTN_UNICAST) {
  579. if (!opt->is_strictroute)
  580. return 0;
  581. icmp_send(skb, ICMP_PARAMETERPROB, 0, htonl(16<<24));
  582. return -EINVAL;
  583. }
  584. if (rt->rt_type != RTN_LOCAL)
  585. return -EINVAL;
  586. for (srrptr = optptr[2], srrspace = optptr[1]; srrptr <= srrspace; srrptr += 4) {
  587. if (srrptr + 3 > srrspace) {
  588. icmp_send(skb, ICMP_PARAMETERPROB, 0, htonl((opt->srr+2)<<24));
  589. return -EINVAL;
  590. }
  591. memcpy(&nexthop, &optptr[srrptr-1], 4);
  592. orefdst = skb->_skb_refdst;
  593. skb_dst_set(skb, NULL);
  594. err = ip_route_input(skb, nexthop, iph->saddr, iph->tos, skb->dev);
  595. rt2 = skb_rtable(skb);
  596. if (err || (rt2->rt_type != RTN_UNICAST && rt2->rt_type != RTN_LOCAL)) {
  597. skb_dst_drop(skb);
  598. skb->_skb_refdst = orefdst;
  599. return -EINVAL;
  600. }
  601. refdst_drop(orefdst);
  602. if (rt2->rt_type != RTN_LOCAL)
  603. break;
  604. /* Superfast 8) loopback forward */
  605. iph->daddr = nexthop;
  606. opt->is_changed = 1;
  607. }
  608. if (srrptr <= srrspace) {
  609. opt->srr_is_hit = 1;
  610. opt->nexthop = nexthop;
  611. opt->is_changed = 1;
  612. }
  613. return 0;
  614. }
  615. EXPORT_SYMBOL(ip_options_rcv_srr);